AppCode:Unit Testing: goto test/class action (OC-2623)

This commit is contained in:
Anton Makeev
2013-01-31 10:50:42 +01:00
parent 23624e90af
commit 03a1e481f6
3 changed files with 12 additions and 3 deletions
@@ -82,7 +82,7 @@ public class TestFinderHelper {
}
});
final List<PsiElement> result = new ArrayList<PsiElement>();
final List<PsiElement> result = new ArrayList<PsiElement>(elementsWithWeights.size());
for (Pair<? extends PsiNamedElement, Integer> each : elementsWithWeights) {
result.add(each.first);
}
@@ -20,9 +20,9 @@ import org.jetbrains.annotations.Nullable;
/**
* @author peter
*/
public interface NullableFunction<Dom, Img> extends Function<Dom,Img> {
public interface NullableFunction<Param, Result> extends Function<Param, Result> {
@Nullable
Img fun(final Dom dom);
Result fun(final Param param);
/**
* @see FunctionUtil#nullConstant()
@@ -712,6 +712,15 @@ public class ContainerUtil extends ContainerUtilRt {
return set;
}
@NotNull
public static <KEY, VALUE> Map<KEY, VALUE> map2Map(@NotNull Collection<Pair<KEY, VALUE>> collection) {
final Map<KEY, VALUE> result = new THashMap<KEY, VALUE>(collection.size());
for (Pair<KEY, VALUE> pair : collection) {
result.put(pair.first, pair.second);
}
return result;
}
@NotNull
public static <T> Object[] map2Array(@NotNull T[] array, @NotNull Function<T, Object> mapper) {
return map2Array(array, Object.class, mapper);