Fix some issues caught by IntelliJ static code analysis

The most common issues were:
* Arrays.asList() shouldn't be called with a single parameter.
* Broken Javadoc @links.
* Unnecessary casts and type declarations.
* Unnecessary unused variable initializations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=230994311
This commit is contained in:
mcilwain 2019-01-25 16:53:20 -08:00 committed by Ben McIlwain
parent 3cf26ff9b6
commit c6e58d3bff
39 changed files with 132 additions and 165 deletions

View file

@ -50,27 +50,27 @@ public class CollectionUtils {
/** Turns a null set into an empty set. JAXB leaves lots of null sets lying around. */
public static <T> Set<T> nullToEmpty(@Nullable Set<T> potentiallyNull) {
return firstNonNull(potentiallyNull, ImmutableSet.<T>of());
return firstNonNull(potentiallyNull, ImmutableSet.of());
}
/** Turns a null list into an empty list. */
public static <T> List<T> nullToEmpty(@Nullable List<T> potentiallyNull) {
return firstNonNull(potentiallyNull, ImmutableList.<T>of());
return firstNonNull(potentiallyNull, ImmutableList.of());
}
/** Turns a null map into an empty map. */
public static <T, U> Map<T, U> nullToEmpty(@Nullable Map<T, U> potentiallyNull) {
return firstNonNull(potentiallyNull, ImmutableMap.<T, U>of());
return firstNonNull(potentiallyNull, ImmutableMap.of());
}
/** Turns a null multimap into an empty multimap. */
public static <T, U> Multimap<T, U> nullToEmpty(@Nullable Multimap<T, U> potentiallyNull) {
return firstNonNull(potentiallyNull, ImmutableMultimap.<T, U>of());
return firstNonNull(potentiallyNull, ImmutableMultimap.of());
}
/** Turns a null sorted map into an empty sorted map.. */
public static <T, U> SortedMap<T, U> nullToEmpty(@Nullable SortedMap<T, U> potentiallyNull) {
return firstNonNull(potentiallyNull, ImmutableSortedMap.<T, U>of());
return firstNonNull(potentiallyNull, ImmutableSortedMap.of());
}
/** Defensive copy helper for {@link Set}. */