diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java index fefca9707b9..28eb17af1d0 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java @@ -3,6 +3,7 @@ import static com.google.common.base.Preconditions.checkElementIndex; import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.collect.Sets.toImmutableEnumSet; +import static java.util.Collections.disjoint; import static java.util.Objects.checkIndex; import com.google.common.base.Splitter; @@ -162,7 +163,7 @@ boolean before2(Set set1, Set set2) { @AfterTemplate boolean after(Set set1, Set set2) { - return Collections.disjoint(set1, set2); + return disjoint(set1, set2); } } @@ -177,15 +178,15 @@ static final class DisjointCollections { @BeforeTemplate boolean before(Collection collection1, Collection collection2) { return Refaster.anyOf( - Collections.disjoint(ImmutableSet.copyOf(collection1), collection2), - Collections.disjoint(new HashSet<>(collection1), collection2), - Collections.disjoint(collection1, ImmutableSet.copyOf(collection2)), - Collections.disjoint(collection1, new HashSet<>(collection2))); + disjoint(ImmutableSet.copyOf(collection1), collection2), + disjoint(new HashSet<>(collection1), collection2), + disjoint(collection1, ImmutableSet.copyOf(collection2)), + disjoint(collection1, new HashSet<>(collection2))); } @AfterTemplate boolean after(Collection collection1, Collection collection2) { - return Collections.disjoint(collection1, collection2); + return disjoint(collection1, collection2); } } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java index c6f6c3bbc13..370cb0a7c7a 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java @@ -2,6 +2,7 @@ import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.ImmutableSet.toImmutableSet; +import static java.util.Collections.singletonList; import static java.util.Comparator.naturalOrder; import static java.util.stream.Collectors.collectingAndThen; import static java.util.stream.Collectors.toList; @@ -16,7 +17,6 @@ import com.google.errorprone.refaster.annotation.UseImportPolicy; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; @@ -63,7 +63,7 @@ ImmutableList after() { static final class SingletonImmutableList { @BeforeTemplate List before(T element) { - return Collections.singletonList(element); + return singletonList(element); } @AfterTemplate diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java index 9c307a8e3af..eeb05d00d8b 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java @@ -1,6 +1,7 @@ package tech.picnic.errorprone.refastertemplates; import static com.google.common.collect.ImmutableMap.toImmutableMap; +import static java.util.Collections.singletonMap; import static java.util.function.Function.identity; import com.google.common.collect.ImmutableMap; @@ -14,7 +15,6 @@ import com.google.errorprone.refaster.annotation.Placeholder; import com.google.errorprone.refaster.annotation.UseImportPolicy; import java.util.Collection; -import java.util.Collections; import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -65,8 +65,7 @@ static final class PairToImmutableMap { @BeforeTemplate Map before(K key, V value) { return Refaster.anyOf( - ImmutableMap.builder().put(key, value).build(), - Collections.singletonMap(key, value)); + ImmutableMap.builder().put(key, value).build(), singletonMap(key, value)); } @AfterTemplate diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java index f2391b9cd5a..dbc8297e029 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java @@ -1,6 +1,7 @@ package tech.picnic.errorprone.refastertemplates; import static com.google.common.collect.ImmutableSet.toImmutableSet; +import static java.util.Collections.singleton; import static java.util.stream.Collectors.collectingAndThen; import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toSet; @@ -15,7 +16,6 @@ import com.google.errorprone.refaster.annotation.UseImportPolicy; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Iterator; import java.util.Set; import java.util.stream.Stream; @@ -61,7 +61,7 @@ ImmutableSet after() { static final class SingletonImmutableSet { @BeforeTemplate Set before(T element) { - return Collections.singleton(element); + return singleton(element); } @AfterTemplate