IDEA-66185 Malformed format string inspection: Instruct the inspection that int -> char conversion is correct

Utility collection population method signature is corrected in order to covariantly return given IS-A Collection instead of Collection
This commit is contained in:
Denis Zhdanov
2011-03-11 14:58:43 +03:00
parent f0ee218178
commit 5eb6df8348
@@ -488,7 +488,7 @@ public class ContainerUtil {
}
}
public static <T> Collection<T> addAll(@NotNull Collection<T> collection, @NotNull T... elements) {
public static <T, A extends T, C extends Collection<T>> C addAll(@NotNull C collection, @NotNull A... elements) {
//noinspection ManualArrayToCollectionCopy
for (T element : elements) {
collection.add(element);
@@ -842,6 +842,11 @@ public class ContainerUtil {
return result.toArray(emptyArray);
}
@NotNull
public static <T> Set<T> set(T ... items) {
return addAll(new HashSet<T>(), items);
}
public static <T> void addIfNotNull(final T element, @NotNull Collection<T> result) {
if (element != null) {
result.add(element);