aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlerbsc <jean-pierre.lerbscher@jperf.com>2024-04-01 09:06:30 -0700
committerGoogle Java Core Libraries <jake-team+copybara@google.com>2024-04-01 09:15:01 -0700
commit57ff7d93b503513a17fac8683e840e1b6c2ad1e9 (patch)
tree72d1f3e7de1791acf5083b4ec0e6e891645bc4b0
parentaecd2f0ac00b50f7ff01964a41b20227775064f3 (diff)
downloadguava-57ff7d93b503513a17fac8683e840e1b6c2ad1e9.tar.gz
Use the diamond operator more.
Fixes #7128 RELNOTES=n/a PiperOrigin-RevId: 620863838
-rw-r--r--android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java8
-rw-r--r--android/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java2
-rw-r--r--android/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java2
-rw-r--r--android/guava/src/com/google/common/base/Equivalence.java2
-rw-r--r--android/guava/src/com/google/common/base/Optional.java2
-rw-r--r--android/guava/src/com/google/common/base/Suppliers.java2
-rw-r--r--android/guava/src/com/google/common/collect/ArrayListMultimap.java2
-rw-r--r--android/guava/src/com/google/common/collect/Collections2.java7
-rw-r--r--android/guava/src/com/google/common/collect/CompactLinkedHashMap.java2
-rw-r--r--android/guava/src/com/google/common/collect/EnumMultiset.java2
-rw-r--r--android/guava/src/com/google/common/collect/HashMultiset.java2
-rw-r--r--android/guava/src/com/google/common/collect/ImmutableCollection.java2
-rw-r--r--android/guava/src/com/google/common/collect/ImmutableEnumSet.java2
-rw-r--r--android/guava/src/com/google/common/collect/ImmutableList.java4
-rw-r--r--android/guava/src/com/google/common/collect/ImmutableMultiset.java2
-rw-r--r--android/guava/src/com/google/common/collect/ImmutableRangeMap.java4
-rw-r--r--android/guava/src/com/google/common/collect/ImmutableRangeSet.java14
-rw-r--r--android/guava/src/com/google/common/collect/ImmutableSet.java6
-rw-r--r--android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java14
-rw-r--r--android/guava/src/com/google/common/collect/ImmutableSortedSet.java12
-rw-r--r--android/guava/src/com/google/common/collect/LinkedHashMultiset.java2
-rw-r--r--android/guava/src/com/google/common/collect/MapMakerInternalMap.java16
-rw-r--r--android/guava/src/com/google/common/collect/Maps.java2
-rw-r--r--android/guava/src/com/google/common/collect/Multimaps.java2
-rw-r--r--android/guava/src/com/google/common/collect/Multisets.java14
-rw-r--r--android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java4
-rw-r--r--android/guava/src/com/google/common/collect/Ordering.java8
-rw-r--r--android/guava/src/com/google/common/collect/Queues.java44
-rw-r--r--android/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java2
-rw-r--r--android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java2
-rw-r--r--android/guava/src/com/google/common/collect/Sets.java48
-rw-r--r--android/guava/src/com/google/common/collect/Synchronized.java12
-rw-r--r--android/guava/src/com/google/common/collect/TopKSelector.java4
-rw-r--r--android/guava/src/com/google/common/collect/TreeMultiset.java12
-rw-r--r--android/guava/src/com/google/common/collect/TreeTraverser.java4
-rw-r--r--android/guava/src/com/google/common/graph/Graphs.java4
-rw-r--r--android/guava/src/com/google/common/hash/BloomFilter.java6
-rw-r--r--android/guava/src/com/google/common/util/concurrent/AbstractFuture.java2
-rw-r--r--android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java2
-rw-r--r--android/guava/src/com/google/common/util/concurrent/ClosingFuture.java2
-rw-r--r--android/guava/src/com/google/common/util/concurrent/Futures.java14
-rw-r--r--android/guava/src/com/google/common/util/concurrent/MoreExecutors.java2
-rw-r--r--guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java10
-rw-r--r--guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java2
-rw-r--r--guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java2
-rw-r--r--guava/src/com/google/common/base/Equivalence.java2
-rw-r--r--guava/src/com/google/common/base/Optional.java2
-rw-r--r--guava/src/com/google/common/base/Suppliers.java2
-rw-r--r--guava/src/com/google/common/collect/ArrayListMultimap.java2
-rw-r--r--guava/src/com/google/common/collect/Collections2.java7
-rw-r--r--guava/src/com/google/common/collect/CompactLinkedHashMap.java2
-rw-r--r--guava/src/com/google/common/collect/EnumMultiset.java2
-rw-r--r--guava/src/com/google/common/collect/HashMultiset.java4
-rw-r--r--guava/src/com/google/common/collect/ImmutableCollection.java2
-rw-r--r--guava/src/com/google/common/collect/ImmutableEnumSet.java2
-rw-r--r--guava/src/com/google/common/collect/ImmutableList.java8
-rw-r--r--guava/src/com/google/common/collect/ImmutableMultiset.java2
-rw-r--r--guava/src/com/google/common/collect/ImmutableRangeMap.java4
-rw-r--r--guava/src/com/google/common/collect/ImmutableRangeSet.java14
-rw-r--r--guava/src/com/google/common/collect/ImmutableSet.java22
-rw-r--r--guava/src/com/google/common/collect/ImmutableSortedMultiset.java14
-rw-r--r--guava/src/com/google/common/collect/ImmutableSortedSet.java16
-rw-r--r--guava/src/com/google/common/collect/LinkedHashMultiset.java4
-rw-r--r--guava/src/com/google/common/collect/MapMakerInternalMap.java16
-rw-r--r--guava/src/com/google/common/collect/Maps.java2
-rw-r--r--guava/src/com/google/common/collect/Multimaps.java2
-rw-r--r--guava/src/com/google/common/collect/Multisets.java14
-rw-r--r--guava/src/com/google/common/collect/MutableClassToInstanceMap.java4
-rw-r--r--guava/src/com/google/common/collect/Ordering.java8
-rw-r--r--guava/src/com/google/common/collect/Queues.java44
-rw-r--r--guava/src/com/google/common/collect/RegularImmutableMultiset.java4
-rw-r--r--guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java2
-rw-r--r--guava/src/com/google/common/collect/RegularImmutableSortedSet.java2
-rw-r--r--guava/src/com/google/common/collect/Sets.java48
-rw-r--r--guava/src/com/google/common/collect/Synchronized.java12
-rw-r--r--guava/src/com/google/common/collect/TopKSelector.java4
-rw-r--r--guava/src/com/google/common/collect/TreeMultiset.java12
-rw-r--r--guava/src/com/google/common/collect/TreeTraverser.java4
-rw-r--r--guava/src/com/google/common/graph/Graphs.java4
-rw-r--r--guava/src/com/google/common/hash/BloomFilter.java6
-rw-r--r--guava/src/com/google/common/util/concurrent/AbstractFuture.java2
-rw-r--r--guava/src/com/google/common/util/concurrent/AtomicLongMap.java2
-rw-r--r--guava/src/com/google/common/util/concurrent/ClosingFuture.java2
-rw-r--r--guava/src/com/google/common/util/concurrent/Futures.java14
-rw-r--r--guava/src/com/google/common/util/concurrent/MoreExecutors.java2
85 files changed, 319 insertions, 317 deletions
diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java
index bbb29fd58..377da08d5 100644
--- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java
+++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java
@@ -137,12 +137,14 @@ abstract class AbstractIteratorTester<E extends @Nullable Object, I extends Iter
* The elements to be returned by future calls to {@code next()}, with the first at the top of
* the stack.
*/
- final Stack<E> nextElements = new Stack<E>();
+ final Stack<E> nextElements = new Stack<>();
+
/**
* The elements to be returned by future calls to {@code previous()}, with the first at the top
* of the stack.
*/
- final Stack<E> previousElements = new Stack<E>();
+ final Stack<E> previousElements = new Stack<>();
+
/**
* {@link #nextElements} if {@code next()} was called more recently then {@code previous},
* {@link #previousElements} if the reverse is true, or -- overriding both of these -- {@code
@@ -256,7 +258,7 @@ abstract class AbstractIteratorTester<E extends @Nullable Object, I extends Iter
}
private List<E> getElements() {
- List<E> elements = new ArrayList<E>();
+ List<E> elements = new ArrayList<>();
Helpers.addAll(elements, previousElements);
Helpers.addAll(elements, Helpers.reverse(nextElements));
return elements;
diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java b/android/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java
index e9014fbfa..dbb0ddd58 100644
--- a/android/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java
+++ b/android/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java
@@ -465,7 +465,7 @@ public class TestsForMapsInJavaUtil {
}
static <T> Comparator<T> arbitraryNullFriendlyComparator() {
- return new NullFriendlyComparator<T>();
+ return new NullFriendlyComparator<>();
}
private static final class NullFriendlyComparator<T> implements Comparator<T>, Serializable {
diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java b/android/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java
index 3324ace0f..b5268ea5c 100644
--- a/android/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java
+++ b/android/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java
@@ -434,7 +434,7 @@ public class TestsForSetsInJavaUtil {
}
static <T> Comparator<T> arbitraryNullFriendlyComparator() {
- return new NullFriendlyComparator<T>();
+ return new NullFriendlyComparator<>();
}
private static final class NullFriendlyComparator<T> implements Comparator<T>, Serializable {
diff --git a/android/guava/src/com/google/common/base/Equivalence.java b/android/guava/src/com/google/common/base/Equivalence.java
index d4c9566c0..02c342301 100644
--- a/android/guava/src/com/google/common/base/Equivalence.java
+++ b/android/guava/src/com/google/common/base/Equivalence.java
@@ -275,7 +275,7 @@ public abstract class Equivalence<T> {
* @since 10.0
*/
public final Predicate<@Nullable T> equivalentTo(@CheckForNull T target) {
- return new EquivalentToPredicate<T>(this, target);
+ return new EquivalentToPredicate<>(this, target);
}
private static final class EquivalentToPredicate<T>
diff --git a/android/guava/src/com/google/common/base/Optional.java b/android/guava/src/com/google/common/base/Optional.java
index 20d1233fb..c8141322f 100644
--- a/android/guava/src/com/google/common/base/Optional.java
+++ b/android/guava/src/com/google/common/base/Optional.java
@@ -105,7 +105,7 @@ public abstract class Optional<T> implements Serializable {
* @throws NullPointerException if {@code reference} is null
*/
public static <T> Optional<T> of(T reference) {
- return new Present<T>(checkNotNull(reference));
+ return new Present<>(checkNotNull(reference));
}
/**
diff --git a/android/guava/src/com/google/common/base/Suppliers.java b/android/guava/src/com/google/common/base/Suppliers.java
index 3989e7710..9ef29af08 100644
--- a/android/guava/src/com/google/common/base/Suppliers.java
+++ b/android/guava/src/com/google/common/base/Suppliers.java
@@ -265,7 +265,7 @@ public final class Suppliers {
// The alternative of `duration.compareTo(Duration.ZERO) > 0` causes J2ObjC trouble.
checkArgument(
!duration.isNegative() && !duration.isZero(), "duration (%s) must be > 0", duration);
- return new ExpiringMemoizingSupplier<T>(delegate, toNanosSaturated(duration));
+ return new ExpiringMemoizingSupplier<>(delegate, toNanosSaturated(duration));
}
@VisibleForTesting
diff --git a/android/guava/src/com/google/common/collect/ArrayListMultimap.java b/android/guava/src/com/google/common/collect/ArrayListMultimap.java
index 5983a58ed..6fe8d33a4 100644
--- a/android/guava/src/com/google/common/collect/ArrayListMultimap.java
+++ b/android/guava/src/com/google/common/collect/ArrayListMultimap.java
@@ -133,7 +133,7 @@ public final class ArrayListMultimap<K extends @Nullable Object, V extends @Null
*/
@Override
List<V> createCollection() {
- return new ArrayList<V>(expectedValuesPerKey);
+ return new ArrayList<>(expectedValuesPerKey);
}
/**
diff --git a/android/guava/src/com/google/common/collect/Collections2.java b/android/guava/src/com/google/common/collect/Collections2.java
index 2b21acc10..3f19e97a5 100644
--- a/android/guava/src/com/google/common/collect/Collections2.java
+++ b/android/guava/src/com/google/common/collect/Collections2.java
@@ -91,7 +91,7 @@ public final class Collections2 {
return ((FilteredCollection<E>) unfiltered).createCombined(predicate);
}
- return new FilteredCollection<E>(checkNotNull(unfiltered), checkNotNull(predicate));
+ return new FilteredCollection<>(checkNotNull(unfiltered), checkNotNull(predicate));
}
/**
@@ -130,8 +130,7 @@ public final class Collections2 {
}
FilteredCollection<E> createCombined(Predicate<? super E> newPredicate) {
- return new FilteredCollection<E>(unfiltered, Predicates.<E>and(predicate, newPredicate));
- // .<E> above needed to compile in JDK 5
+ return new FilteredCollection<>(unfiltered, Predicates.and(predicate, newPredicate));
}
@Override
@@ -616,7 +615,7 @@ public final class Collections2 {
int j;
PermutationIterator(List<E> list) {
- this.list = new ArrayList<E>(list);
+ this.list = new ArrayList<>(list);
int n = list.size();
c = new int[n];
o = new int[n];
diff --git a/android/guava/src/com/google/common/collect/CompactLinkedHashMap.java b/android/guava/src/com/google/common/collect/CompactLinkedHashMap.java
index d32e38f92..38b9a9882 100644
--- a/android/guava/src/com/google/common/collect/CompactLinkedHashMap.java
+++ b/android/guava/src/com/google/common/collect/CompactLinkedHashMap.java
@@ -125,7 +125,7 @@ class CompactLinkedHashMap<K extends @Nullable Object, V extends @Nullable Objec
@Override
Map<K, V> createHashFloodingResistantDelegate(int tableSize) {
- return new LinkedHashMap<K, V>(tableSize, 1.0f, accessOrder);
+ return new LinkedHashMap<>(tableSize, 1.0f, accessOrder);
}
@Override
diff --git a/android/guava/src/com/google/common/collect/EnumMultiset.java b/android/guava/src/com/google/common/collect/EnumMultiset.java
index ee5fc9e2e..44beb013d 100644
--- a/android/guava/src/com/google/common/collect/EnumMultiset.java
+++ b/android/guava/src/com/google/common/collect/EnumMultiset.java
@@ -51,7 +51,7 @@ public final class EnumMultiset<E extends Enum<E>> extends AbstractMultiset<E>
implements Serializable {
/** Creates an empty {@code EnumMultiset}. */
public static <E extends Enum<E>> EnumMultiset<E> create(Class<E> type) {
- return new EnumMultiset<E>(type);
+ return new EnumMultiset<>(type);
}
/**
diff --git a/android/guava/src/com/google/common/collect/HashMultiset.java b/android/guava/src/com/google/common/collect/HashMultiset.java
index 0bc4ccac4..9ed604d97 100644
--- a/android/guava/src/com/google/common/collect/HashMultiset.java
+++ b/android/guava/src/com/google/common/collect/HashMultiset.java
@@ -45,7 +45,7 @@ public final class HashMultiset<E extends @Nullable Object> extends AbstractMapB
* @throws IllegalArgumentException if {@code distinctElements} is negative
*/
public static <E extends @Nullable Object> HashMultiset<E> create(int distinctElements) {
- return new HashMultiset<E>(distinctElements);
+ return new HashMultiset<>(distinctElements);
}
/**
diff --git a/android/guava/src/com/google/common/collect/ImmutableCollection.java b/android/guava/src/com/google/common/collect/ImmutableCollection.java
index c8167e8f6..25d3336ea 100644
--- a/android/guava/src/com/google/common/collect/ImmutableCollection.java
+++ b/android/guava/src/com/google/common/collect/ImmutableCollection.java
@@ -358,7 +358,7 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
* @since 2.0
*/
public ImmutableList<E> asList() {
- return isEmpty() ? ImmutableList.<E>of() : ImmutableList.<E>asImmutableList(toArray());
+ return isEmpty() ? ImmutableList.of() : ImmutableList.asImmutableList(toArray());
}
/**
diff --git a/android/guava/src/com/google/common/collect/ImmutableEnumSet.java b/android/guava/src/com/google/common/collect/ImmutableEnumSet.java
index 2f042f85f..7f20a18af 100644
--- a/android/guava/src/com/google/common/collect/ImmutableEnumSet.java
+++ b/android/guava/src/com/google/common/collect/ImmutableEnumSet.java
@@ -42,7 +42,7 @@ final class ImmutableEnumSet<E extends Enum<E>> extends ImmutableSet<E> {
case 1:
return ImmutableSet.of(Iterables.getOnlyElement(set));
default:
- return new ImmutableEnumSet<E>(set);
+ return new ImmutableEnumSet<>(set);
}
}
diff --git a/android/guava/src/com/google/common/collect/ImmutableList.java b/android/guava/src/com/google/common/collect/ImmutableList.java
index 4f95ba775..30328bb6f 100644
--- a/android/guava/src/com/google/common/collect/ImmutableList.java
+++ b/android/guava/src/com/google/common/collect/ImmutableList.java
@@ -724,7 +724,7 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
* Builder} constructor.
*/
public static <E> Builder<E> builder() {
- return new Builder<E>();
+ return new Builder<>();
}
/**
@@ -741,7 +741,7 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
*/
public static <E> Builder<E> builderWithExpectedSize(int expectedSize) {
checkNonnegative(expectedSize, "expectedSize");
- return new ImmutableList.Builder<E>(expectedSize);
+ return new ImmutableList.Builder<>(expectedSize);
}
/**
diff --git a/android/guava/src/com/google/common/collect/ImmutableMultiset.java b/android/guava/src/com/google/common/collect/ImmutableMultiset.java
index b5e2e347e..4612e30c1 100644
--- a/android/guava/src/com/google/common/collect/ImmutableMultiset.java
+++ b/android/guava/src/com/google/common/collect/ImmutableMultiset.java
@@ -439,7 +439,7 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa
* Builder} constructor.
*/
public static <E> Builder<E> builder() {
- return new Builder<E>();
+ return new Builder<>();
}
/**
diff --git a/android/guava/src/com/google/common/collect/ImmutableRangeMap.java b/android/guava/src/com/google/common/collect/ImmutableRangeMap.java
index a4d7948f8..7d52da8a5 100644
--- a/android/guava/src/com/google/common/collect/ImmutableRangeMap.java
+++ b/android/guava/src/com/google/common/collect/ImmutableRangeMap.java
@@ -88,7 +88,7 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
}
Map<Range<K>, ? extends V> map = rangeMap.asMapOfRanges();
ImmutableList.Builder<Range<K>> rangesBuilder = new ImmutableList.Builder<>(map.size());
- ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<V>(map.size());
+ ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<>(map.size());
for (Entry<Range<K>, ? extends V> entry : map.entrySet()) {
rangesBuilder.add(entry.getKey());
valuesBuilder.add(entry.getValue());
@@ -152,7 +152,7 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
public ImmutableRangeMap<K, V> build() {
Collections.sort(entries, Range.<K>rangeLexOrdering().onKeys());
ImmutableList.Builder<Range<K>> rangesBuilder = new ImmutableList.Builder<>(entries.size());
- ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<V>(entries.size());
+ ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<>(entries.size());
for (int i = 0; i < entries.size(); i++) {
Range<K> range = entries.get(i).getKey();
if (i > 0) {
diff --git a/android/guava/src/com/google/common/collect/ImmutableRangeSet.java b/android/guava/src/com/google/common/collect/ImmutableRangeSet.java
index f88bde291..ac31fae5f 100644
--- a/android/guava/src/com/google/common/collect/ImmutableRangeSet.java
+++ b/android/guava/src/com/google/common/collect/ImmutableRangeSet.java
@@ -93,7 +93,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
} else if (range.equals(Range.all())) {
return all();
} else {
- return new ImmutableRangeSet<C>(ImmutableList.of(range));
+ return new ImmutableRangeSet<>(ImmutableList.of(range));
}
}
@@ -118,7 +118,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
return immutableRangeSet;
}
}
- return new ImmutableRangeSet<C>(ImmutableList.copyOf(rangeSet.asRanges()));
+ return new ImmutableRangeSet<>(ImmutableList.copyOf(rangeSet.asRanges()));
}
/**
@@ -390,7 +390,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
return complement = of();
} else {
ImmutableList<Range<C>> complementRanges = new ComplementRanges();
- result = complement = new ImmutableRangeSet<C>(complementRanges, this);
+ result = complement = new ImmutableRangeSet<>(complementRanges, this);
}
return result;
}
@@ -517,7 +517,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
if (range.encloses(span)) {
return this;
} else if (range.isConnected(span)) {
- return new ImmutableRangeSet<C>(intersectRanges(range));
+ return new ImmutableRangeSet<>(intersectRanges(range));
}
}
return of();
@@ -695,7 +695,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
@Override
ImmutableSortedSet<C> createDescendingSet() {
- return new DescendingImmutableSortedSet<C>(this);
+ return new DescendingImmutableSortedSet<>(this);
}
@Override
@@ -746,7 +746,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
/** Returns a new builder for an immutable range set. */
public static <C extends Comparable<?>> Builder<C> builder() {
- return new Builder<C>();
+ return new Builder<>();
}
/**
@@ -841,7 +841,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
&& Iterables.getOnlyElement(mergedRanges).equals(Range.all())) {
return all();
} else {
- return new ImmutableRangeSet<C>(mergedRanges);
+ return new ImmutableRangeSet<>(mergedRanges);
}
}
}
diff --git a/android/guava/src/com/google/common/collect/ImmutableSet.java b/android/guava/src/com/google/common/collect/ImmutableSet.java
index 018eaad12..54dda3208 100644
--- a/android/guava/src/com/google/common/collect/ImmutableSet.java
+++ b/android/guava/src/com/google/common/collect/ImmutableSet.java
@@ -82,7 +82,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
* type conveys the immutability guarantee.
*/
public static <E> ImmutableSet<E> of(E element) {
- return new SingletonImmutableSet<E>(element);
+ return new SingletonImmutableSet<>(element);
}
/**
@@ -417,7 +417,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
* Builder} constructor.
*/
public static <E> Builder<E> builder() {
- return new Builder<E>();
+ return new Builder<>();
}
/**
@@ -434,7 +434,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
*/
public static <E> Builder<E> builderWithExpectedSize(int expectedSize) {
checkNonnegative(expectedSize, "expectedSize");
- return new Builder<E>(expectedSize);
+ return new Builder<>(expectedSize);
}
/**
diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java
index c31a8c21c..52362e461 100644
--- a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java
+++ b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java
@@ -137,7 +137,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
RegularImmutableSortedSet<E> elementSet =
(RegularImmutableSortedSet<E>) ImmutableSortedSet.of(element);
long[] cumulativeCounts = {0, 1};
- return new RegularImmutableSortedMultiset<E>(elementSet, cumulativeCounts, 0, 1);
+ return new RegularImmutableSortedMultiset<>(elementSet, cumulativeCounts, 0, 1);
}
/**
@@ -316,7 +316,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
if (entries.isEmpty()) {
return emptyMultiset(comparator);
}
- ImmutableList.Builder<E> elementsBuilder = new ImmutableList.Builder<E>(entries.size());
+ ImmutableList.Builder<E> elementsBuilder = new ImmutableList.Builder<>(entries.size());
long[] cumulativeCounts = new long[entries.size() + 1];
int i = 0;
for (Entry<E> entry : entries) {
@@ -324,7 +324,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
cumulativeCounts[i + 1] = cumulativeCounts[i] + entry.getCount();
i++;
}
- return new RegularImmutableSortedMultiset<E>(
+ return new RegularImmutableSortedMultiset<>(
new RegularImmutableSortedSet<E>(elementsBuilder.build(), comparator),
cumulativeCounts,
0,
@@ -336,7 +336,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
if (Ordering.natural().equals(comparator)) {
return (ImmutableSortedMultiset<E>) RegularImmutableSortedMultiset.NATURAL_EMPTY_MULTISET;
} else {
- return new RegularImmutableSortedMultiset<E>(comparator);
+ return new RegularImmutableSortedMultiset<>(comparator);
}
}
@@ -424,7 +424,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
* @throws NullPointerException if {@code comparator} is null
*/
public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
- return new Builder<E>(comparator);
+ return new Builder<>(comparator);
}
/**
@@ -436,7 +436,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
* href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6468354">bug 6468354</a>.
*/
public static <E extends Comparable<?>> Builder<E> reverseOrder() {
- return new Builder<E>(Ordering.<E>natural().reverse());
+ return new Builder<>(Ordering.<E>natural().reverse());
}
/**
@@ -450,7 +450,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
* href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6468354">bug 6468354</a>.
*/
public static <E extends Comparable<?>> Builder<E> naturalOrder() {
- return new Builder<E>(Ordering.natural());
+ return new Builder<>(Ordering.natural());
}
/**
diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedSet.java b/android/guava/src/com/google/common/collect/ImmutableSortedSet.java
index c6acfa70b..b92d6cf93 100644
--- a/android/guava/src/com/google/common/collect/ImmutableSortedSet.java
+++ b/android/guava/src/com/google/common/collect/ImmutableSortedSet.java
@@ -84,7 +84,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet<E>
(RegularImmutableSortedSet<E>) RegularImmutableSortedSet.NATURAL_EMPTY_SET;
return result;
} else {
- return new RegularImmutableSortedSet<E>(ImmutableList.<E>of(), comparator);
+ return new RegularImmutableSortedSet<>(ImmutableList.of(), comparator);
}
}
@@ -100,7 +100,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet<E>
/** Returns an immutable sorted set containing a single element. */
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element) {
- return new RegularImmutableSortedSet<E>(ImmutableList.of(element), Ordering.natural());
+ return new RegularImmutableSortedSet<>(ImmutableList.of(element), Ordering.natural());
}
/**
@@ -344,7 +344,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet<E>
if (list.isEmpty()) {
return emptySet(comparator);
} else {
- return new RegularImmutableSortedSet<E>(list, comparator);
+ return new RegularImmutableSortedSet<>(list, comparator);
}
}
@@ -393,7 +393,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet<E>
* @throws NullPointerException if {@code comparator} is null
*/
public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
- return new Builder<E>(comparator);
+ return new Builder<>(comparator);
}
/**
@@ -401,7 +401,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet<E>
* of their natural ordering.
*/
public static <E extends Comparable<?>> Builder<E> reverseOrder() {
- return new Builder<E>(Collections.reverseOrder());
+ return new Builder<>(Collections.reverseOrder());
}
/**
@@ -411,7 +411,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet<E>
* implement {@link Comparable}.
*/
public static <E extends Comparable<?>> Builder<E> naturalOrder() {
- return new Builder<E>(Ordering.natural());
+ return new Builder<>(Ordering.natural());
}
/**
diff --git a/android/guava/src/com/google/common/collect/LinkedHashMultiset.java b/android/guava/src/com/google/common/collect/LinkedHashMultiset.java
index 97595a9e0..867c3f93f 100644
--- a/android/guava/src/com/google/common/collect/LinkedHashMultiset.java
+++ b/android/guava/src/com/google/common/collect/LinkedHashMultiset.java
@@ -51,7 +51,7 @@ public final class LinkedHashMultiset<E extends @Nullable Object>
* @throws IllegalArgumentException if {@code distinctElements} is negative
*/
public static <E extends @Nullable Object> LinkedHashMultiset<E> create(int distinctElements) {
- return new LinkedHashMultiset<E>(distinctElements);
+ return new LinkedHashMultiset<>(distinctElements);
}
/**
diff --git a/android/guava/src/com/google/common/collect/MapMakerInternalMap.java b/android/guava/src/com/google/common/collect/MapMakerInternalMap.java
index 159b88a55..ead769e12 100644
--- a/android/guava/src/com/google/common/collect/MapMakerInternalMap.java
+++ b/android/guava/src/com/google/common/collect/MapMakerInternalMap.java
@@ -636,7 +636,7 @@ class MapMakerInternalMap<
MapMakerInternalMap<K, Dummy, StrongKeyDummyValueEntry<K>, StrongKeyDummyValueSegment<K>>
map,
int initialCapacity) {
- return new StrongKeyDummyValueSegment<K>(map, initialCapacity);
+ return new StrongKeyDummyValueSegment<>(map, initialCapacity);
}
@Override
@@ -1274,7 +1274,7 @@ class MapMakerInternalMap<
}
AtomicReferenceArray<E> newEntryArray(int size) {
- return new AtomicReferenceArray<E>(size);
+ return new AtomicReferenceArray<>(size);
}
void initTable(AtomicReferenceArray<E> newTable) {
@@ -2066,7 +2066,7 @@ class MapMakerInternalMap<
/** Concrete implementation of {@link Segment} for strong keys and weak values. */
static final class StrongKeyWeakValueSegment<K, V>
extends Segment<K, V, StrongKeyWeakValueEntry<K, V>, StrongKeyWeakValueSegment<K, V>> {
- private final ReferenceQueue<V> queueForValues = new ReferenceQueue<V>();
+ private final ReferenceQueue<V> queueForValues = new ReferenceQueue<>();
StrongKeyWeakValueSegment(
MapMakerInternalMap<K, V, StrongKeyWeakValueEntry<K, V>, StrongKeyWeakValueSegment<K, V>>
@@ -2154,7 +2154,7 @@ class MapMakerInternalMap<
/** Concrete implementation of {@link Segment} for weak keys and strong values. */
static final class WeakKeyStrongValueSegment<K, V>
extends Segment<K, V, WeakKeyStrongValueEntry<K, V>, WeakKeyStrongValueSegment<K, V>> {
- private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<K>();
+ private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<>();
WeakKeyStrongValueSegment(
MapMakerInternalMap<K, V, WeakKeyStrongValueEntry<K, V>, WeakKeyStrongValueSegment<K, V>>
@@ -2193,8 +2193,8 @@ class MapMakerInternalMap<
/** Concrete implementation of {@link Segment} for weak keys and weak values. */
static final class WeakKeyWeakValueSegment<K, V>
extends Segment<K, V, WeakKeyWeakValueEntry<K, V>, WeakKeyWeakValueSegment<K, V>> {
- private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<K>();
- private final ReferenceQueue<V> queueForValues = new ReferenceQueue<V>();
+ private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<>();
+ private final ReferenceQueue<V> queueForValues = new ReferenceQueue<>();
WeakKeyWeakValueSegment(
MapMakerInternalMap<K, V, WeakKeyWeakValueEntry<K, V>, WeakKeyWeakValueSegment<K, V>> map,
@@ -2264,7 +2264,7 @@ class MapMakerInternalMap<
/** Concrete implementation of {@link Segment} for weak keys and {@link Dummy} values. */
static final class WeakKeyDummyValueSegment<K>
extends Segment<K, Dummy, WeakKeyDummyValueEntry<K>, WeakKeyDummyValueSegment<K>> {
- private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<K>();
+ private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<>();
WeakKeyDummyValueSegment(
MapMakerInternalMap<K, Dummy, WeakKeyDummyValueEntry<K>, WeakKeyDummyValueSegment<K>> map,
@@ -2303,7 +2303,7 @@ class MapMakerInternalMap<
final WeakReference<MapMakerInternalMap<?, ?, ?, ?>> mapReference;
public CleanupMapTask(MapMakerInternalMap<?, ?, ?, ?> map) {
- this.mapReference = new WeakReference<MapMakerInternalMap<?, ?, ?, ?>>(map);
+ this.mapReference = new WeakReference<>(map);
}
@Override
diff --git a/android/guava/src/com/google/common/collect/Maps.java b/android/guava/src/com/google/common/collect/Maps.java
index 7bd560092..e89eac157 100644
--- a/android/guava/src/com/google/common/collect/Maps.java
+++ b/android/guava/src/com/google/common/collect/Maps.java
@@ -683,7 +683,7 @@ public final class Maps {
static <V extends @Nullable Object> ValueDifference<V> create(
@ParametricNullness V left, @ParametricNullness V right) {
- return new ValueDifferenceImpl<V>(left, right);
+ return new ValueDifferenceImpl<>(left, right);
}
private ValueDifferenceImpl(@ParametricNullness V left, @ParametricNullness V right) {
diff --git a/android/guava/src/com/google/common/collect/Multimaps.java b/android/guava/src/com/google/common/collect/Multimaps.java
index 34d56b077..3b113ff82 100644
--- a/android/guava/src/com/google/common/collect/Multimaps.java
+++ b/android/guava/src/com/google/common/collect/Multimaps.java
@@ -1215,7 +1215,7 @@ public final class Multimaps {
@Override
public Set<V> removeAll(@CheckForNull Object key) {
- Set<V> values = new HashSet<V>(2);
+ Set<V> values = new HashSet<>(2);
if (!map.containsKey(key)) {
return values;
}
diff --git a/android/guava/src/com/google/common/collect/Multisets.java b/android/guava/src/com/google/common/collect/Multisets.java
index 45d45acb7..b477391be 100644
--- a/android/guava/src/com/google/common/collect/Multisets.java
+++ b/android/guava/src/com/google/common/collect/Multisets.java
@@ -105,7 +105,7 @@ public final class Multisets {
Multiset<E> result = (Multiset<E>) multiset;
return result;
}
- return new UnmodifiableMultiset<E>(checkNotNull(multiset));
+ return new UnmodifiableMultiset<>(checkNotNull(multiset));
}
/**
@@ -231,7 +231,7 @@ public final class Multisets {
public static <E extends @Nullable Object> SortedMultiset<E> unmodifiableSortedMultiset(
SortedMultiset<E> sortedMultiset) {
// it's in its own file so it can be emulated for GWT
- return new UnmodifiableSortedMultiset<E>(checkNotNull(sortedMultiset));
+ return new UnmodifiableSortedMultiset<>(checkNotNull(sortedMultiset));
}
/**
@@ -244,7 +244,7 @@ public final class Multisets {
*/
public static <E extends @Nullable Object> Multiset.Entry<E> immutableEntry(
@ParametricNullness E e, int n) {
- return new ImmutableEntry<E>(e, n);
+ return new ImmutableEntry<>(e, n);
}
static class ImmutableEntry<E extends @Nullable Object> extends AbstractEntry<E>
@@ -308,10 +308,10 @@ public final class Multisets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredMultiset<E> filtered = (FilteredMultiset<E>) unfiltered;
- Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
- return new FilteredMultiset<E>(filtered.unfiltered, combinedPredicate);
+ Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
+ return new FilteredMultiset<>(filtered.unfiltered, combinedPredicate);
}
- return new FilteredMultiset<E>(unfiltered, predicate);
+ return new FilteredMultiset<>(unfiltered, predicate);
}
private static final class FilteredMultiset<E extends @Nullable Object> extends ViewMultiset<E> {
@@ -1079,7 +1079,7 @@ public final class Multisets {
/** An implementation of {@link Multiset#iterator}. */
static <E extends @Nullable Object> Iterator<E> iteratorImpl(Multiset<E> multiset) {
- return new MultisetIteratorImpl<E>(multiset, multiset.entrySet().iterator());
+ return new MultisetIteratorImpl<>(multiset, multiset.entrySet().iterator());
}
static final class MultisetIteratorImpl<E extends @Nullable Object> implements Iterator<E> {
diff --git a/android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java b/android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java
index a5b792d00..c289b1757 100644
--- a/android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java
+++ b/android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java
@@ -58,7 +58,7 @@ public final class MutableClassToInstanceMap<B extends @Nullable Object>
* default initial capacity and load factor.
*/
public static <B extends @Nullable Object> MutableClassToInstanceMap<B> create() {
- return new MutableClassToInstanceMap<B>(new HashMap<Class<? extends @NonNull B>, B>());
+ return new MutableClassToInstanceMap<>(new HashMap<Class<? extends @NonNull B>, B>());
}
/**
@@ -68,7 +68,7 @@ public final class MutableClassToInstanceMap<B extends @Nullable Object>
*/
public static <B extends @Nullable Object> MutableClassToInstanceMap<B> create(
Map<Class<? extends @NonNull B>, B> backingMap) {
- return new MutableClassToInstanceMap<B>(backingMap);
+ return new MutableClassToInstanceMap<>(backingMap);
}
private final Map<Class<? extends @NonNull B>, B> delegate;
diff --git a/android/guava/src/com/google/common/collect/Ordering.java b/android/guava/src/com/google/common/collect/Ordering.java
index f3c0744d5..8568caee5 100644
--- a/android/guava/src/com/google/common/collect/Ordering.java
+++ b/android/guava/src/com/google/common/collect/Ordering.java
@@ -224,7 +224,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
// TODO(kevinb): provide replacement
@GwtCompatible(serializable = true)
public static <T> Ordering<T> explicit(List<T> valuesInOrder) {
- return new ExplicitOrdering<T>(valuesInOrder);
+ return new ExplicitOrdering<>(valuesInOrder);
}
/**
@@ -411,7 +411,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
// Ordering<String> o = Ordering.<String>natural().reverse();
@GwtCompatible(serializable = true)
public <S extends T> Ordering<S> reverse() {
- return new ReverseOrdering<S>(this);
+ return new ReverseOrdering<>(this);
}
/**
@@ -484,7 +484,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
*/
@GwtCompatible(serializable = true)
public <U extends T> Ordering<U> compound(Comparator<? super U> secondaryComparator) {
- return new CompoundOrdering<U>(this, checkNotNull(secondaryComparator));
+ return new CompoundOrdering<>(this, checkNotNull(secondaryComparator));
}
/**
@@ -511,7 +511,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
@GwtCompatible(serializable = true)
public static <T extends @Nullable Object> Ordering<T> compound(
Iterable<? extends Comparator<? super T>> comparators) {
- return new CompoundOrdering<T>(comparators);
+ return new CompoundOrdering<>(comparators);
}
/**
diff --git a/android/guava/src/com/google/common/collect/Queues.java b/android/guava/src/com/google/common/collect/Queues.java
index b3121bb64..4525f2623 100644
--- a/android/guava/src/com/google/common/collect/Queues.java
+++ b/android/guava/src/com/google/common/collect/Queues.java
@@ -55,7 +55,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // ArrayBlockingQueue
public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(int capacity) {
- return new ArrayBlockingQueue<E>(capacity);
+ return new ArrayBlockingQueue<>(capacity);
}
// ArrayDeque
@@ -66,7 +66,7 @@ public final class Queues {
* @since 12.0
*/
public static <E> ArrayDeque<E> newArrayDeque() {
- return new ArrayDeque<E>();
+ return new ArrayDeque<>();
}
/**
@@ -77,9 +77,9 @@ public final class Queues {
*/
public static <E> ArrayDeque<E> newArrayDeque(Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new ArrayDeque<E>((Collection<? extends E>) elements);
+ return new ArrayDeque<>((Collection<? extends E>) elements);
}
- ArrayDeque<E> deque = new ArrayDeque<E>();
+ ArrayDeque<E> deque = new ArrayDeque<>();
Iterables.addAll(deque, elements);
return deque;
}
@@ -90,7 +90,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // ConcurrentLinkedQueue
public static <E> ConcurrentLinkedQueue<E> newConcurrentLinkedQueue() {
- return new ConcurrentLinkedQueue<E>();
+ return new ConcurrentLinkedQueue<>();
}
/**
@@ -102,9 +102,9 @@ public final class Queues {
public static <E> ConcurrentLinkedQueue<E> newConcurrentLinkedQueue(
Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new ConcurrentLinkedQueue<E>((Collection<? extends E>) elements);
+ return new ConcurrentLinkedQueue<>((Collection<? extends E>) elements);
}
- ConcurrentLinkedQueue<E> queue = new ConcurrentLinkedQueue<E>();
+ ConcurrentLinkedQueue<E> queue = new ConcurrentLinkedQueue<>();
Iterables.addAll(queue, elements);
return queue;
}
@@ -119,7 +119,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // LinkedBlockingDeque
public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque() {
- return new LinkedBlockingDeque<E>();
+ return new LinkedBlockingDeque<>();
}
/**
@@ -131,7 +131,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // LinkedBlockingDeque
public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque(int capacity) {
- return new LinkedBlockingDeque<E>(capacity);
+ return new LinkedBlockingDeque<>(capacity);
}
/**
@@ -145,9 +145,9 @@ public final class Queues {
@GwtIncompatible // LinkedBlockingDeque
public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque(Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new LinkedBlockingDeque<E>((Collection<? extends E>) elements);
+ return new LinkedBlockingDeque<>((Collection<? extends E>) elements);
}
- LinkedBlockingDeque<E> deque = new LinkedBlockingDeque<E>();
+ LinkedBlockingDeque<E> deque = new LinkedBlockingDeque<>();
Iterables.addAll(deque, elements);
return deque;
}
@@ -158,7 +158,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // LinkedBlockingQueue
public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue() {
- return new LinkedBlockingQueue<E>();
+ return new LinkedBlockingQueue<>();
}
/**
@@ -169,7 +169,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // LinkedBlockingQueue
public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(int capacity) {
- return new LinkedBlockingQueue<E>(capacity);
+ return new LinkedBlockingQueue<>(capacity);
}
/**
@@ -184,9 +184,9 @@ public final class Queues {
@GwtIncompatible // LinkedBlockingQueue
public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new LinkedBlockingQueue<E>((Collection<? extends E>) elements);
+ return new LinkedBlockingQueue<>((Collection<? extends E>) elements);
}
- LinkedBlockingQueue<E> queue = new LinkedBlockingQueue<E>();
+ LinkedBlockingQueue<E> queue = new LinkedBlockingQueue<>();
Iterables.addAll(queue, elements);
return queue;
}
@@ -206,7 +206,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // PriorityBlockingQueue
public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue() {
- return new PriorityBlockingQueue<E>();
+ return new PriorityBlockingQueue<>();
}
/**
@@ -224,9 +224,9 @@ public final class Queues {
public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue(
Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new PriorityBlockingQueue<E>((Collection<? extends E>) elements);
+ return new PriorityBlockingQueue<>((Collection<? extends E>) elements);
}
- PriorityBlockingQueue<E> queue = new PriorityBlockingQueue<E>();
+ PriorityBlockingQueue<E> queue = new PriorityBlockingQueue<>();
Iterables.addAll(queue, elements);
return queue;
}
@@ -242,7 +242,7 @@ public final class Queues {
*/
@SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
public static <E extends Comparable> PriorityQueue<E> newPriorityQueue() {
- return new PriorityQueue<E>();
+ return new PriorityQueue<>();
}
/**
@@ -258,9 +258,9 @@ public final class Queues {
public static <E extends Comparable> PriorityQueue<E> newPriorityQueue(
Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new PriorityQueue<E>((Collection<? extends E>) elements);
+ return new PriorityQueue<>((Collection<? extends E>) elements);
}
- PriorityQueue<E> queue = new PriorityQueue<E>();
+ PriorityQueue<E> queue = new PriorityQueue<>();
Iterables.addAll(queue, elements);
return queue;
}
@@ -271,7 +271,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // SynchronousQueue
public static <E> SynchronousQueue<E> newSynchronousQueue() {
- return new SynchronousQueue<E>();
+ return new SynchronousQueue<>();
}
/**
diff --git a/android/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java b/android/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java
index d2f99e03b..fe73ca118 100644
--- a/android/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java
+++ b/android/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java
@@ -116,7 +116,7 @@ final class RegularImmutableSortedMultiset<E> extends ImmutableSortedMultiset<E>
return this;
} else {
RegularImmutableSortedSet<E> subElementSet = elementSet.getSubSet(from, to);
- return new RegularImmutableSortedMultiset<E>(
+ return new RegularImmutableSortedMultiset<>(
subElementSet, cumulativeCounts, offset + from, to - from);
}
}
diff --git a/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java b/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java
index d31572cf7..ef3d3ad4a 100644
--- a/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java
+++ b/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java
@@ -287,7 +287,7 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
if (newFromIndex == 0 && newToIndex == size()) {
return this;
} else if (newFromIndex < newToIndex) {
- return new RegularImmutableSortedSet<E>(
+ return new RegularImmutableSortedSet<>(
elements.subList(newFromIndex, newToIndex), comparator);
} else {
return emptySet(comparator);
diff --git a/android/guava/src/com/google/common/collect/Sets.java b/android/guava/src/com/google/common/collect/Sets.java
index 34a71a7cd..5fd70fdce 100644
--- a/android/guava/src/com/google/common/collect/Sets.java
+++ b/android/guava/src/com/google/common/collect/Sets.java
@@ -178,7 +178,7 @@ public final class Sets {
* href="http://goo.gl/iz2Wi">"diamond" syntax</a>.
*/
public static <E extends @Nullable Object> HashSet<E> newHashSet() {
- return new HashSet<E>();
+ return new HashSet<>();
}
/**
@@ -257,7 +257,7 @@ public final class Sets {
*/
public static <E extends @Nullable Object> HashSet<E> newHashSetWithExpectedSize(
int expectedSize) {
- return new HashSet<E>(Maps.capacity(expectedSize));
+ return new HashSet<>(Maps.capacity(expectedSize));
}
/**
@@ -307,7 +307,7 @@ public final class Sets {
* @return a new, empty {@code LinkedHashSet}
*/
public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSet() {
- return new LinkedHashSet<E>();
+ return new LinkedHashSet<>();
}
/**
@@ -328,7 +328,7 @@ public final class Sets {
public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSet(
Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new LinkedHashSet<E>((Collection<? extends E>) elements);
+ return new LinkedHashSet<>((Collection<? extends E>) elements);
}
LinkedHashSet<E> set = newLinkedHashSet();
Iterables.addAll(set, elements);
@@ -349,7 +349,7 @@ public final class Sets {
*/
public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSetWithExpectedSize(
int expectedSize) {
- return new LinkedHashSet<E>(Maps.capacity(expectedSize));
+ return new LinkedHashSet<>(Maps.capacity(expectedSize));
}
// TreeSet
@@ -368,7 +368,7 @@ public final class Sets {
*/
@SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
public static <E extends Comparable> TreeSet<E> newTreeSet() {
- return new TreeSet<E>();
+ return new TreeSet<>();
}
/**
@@ -417,7 +417,7 @@ public final class Sets {
*/
public static <E extends @Nullable Object> TreeSet<E> newTreeSet(
Comparator<? super E> comparator) {
- return new TreeSet<E>(checkNotNull(comparator));
+ return new TreeSet<>(checkNotNull(comparator));
}
/**
@@ -445,7 +445,7 @@ public final class Sets {
@J2ktIncompatible
@GwtIncompatible // CopyOnWriteArraySet
public static <E extends @Nullable Object> CopyOnWriteArraySet<E> newCopyOnWriteArraySet() {
- return new CopyOnWriteArraySet<E>();
+ return new CopyOnWriteArraySet<>();
}
/**
@@ -465,7 +465,7 @@ public final class Sets {
(elements instanceof Collection)
? (Collection<? extends E>) elements
: Lists.newArrayList(elements);
- return new CopyOnWriteArraySet<E>(elementsCollection);
+ return new CopyOnWriteArraySet<>(elementsCollection);
}
/**
@@ -1012,11 +1012,11 @@ public final class Sets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredSet<E> filtered = (FilteredSet<E>) unfiltered;
- Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
- return new FilteredSet<E>((Set<E>) filtered.unfiltered, combinedPredicate);
+ Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
+ return new FilteredSet<>((Set<E>) filtered.unfiltered, combinedPredicate);
}
- return new FilteredSet<E>(checkNotNull(unfiltered), checkNotNull(predicate));
+ return new FilteredSet<>(checkNotNull(unfiltered), checkNotNull(predicate));
}
/**
@@ -1049,11 +1049,11 @@ public final class Sets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredSet<E> filtered = (FilteredSet<E>) unfiltered;
- Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
- return new FilteredSortedSet<E>((SortedSet<E>) filtered.unfiltered, combinedPredicate);
+ Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
+ return new FilteredSortedSet<>((SortedSet<E>) filtered.unfiltered, combinedPredicate);
}
- return new FilteredSortedSet<E>(checkNotNull(unfiltered), checkNotNull(predicate));
+ return new FilteredSortedSet<>(checkNotNull(unfiltered), checkNotNull(predicate));
}
/**
@@ -1087,11 +1087,11 @@ public final class Sets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredSet<E> filtered = (FilteredSet<E>) unfiltered;
- Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
- return new FilteredNavigableSet<E>((NavigableSet<E>) filtered.unfiltered, combinedPredicate);
+ Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
+ return new FilteredNavigableSet<>((NavigableSet<E>) filtered.unfiltered, combinedPredicate);
}
- return new FilteredNavigableSet<E>(checkNotNull(unfiltered), checkNotNull(predicate));
+ return new FilteredNavigableSet<>(checkNotNull(unfiltered), checkNotNull(predicate));
}
private static class FilteredSet<E extends @Nullable Object> extends FilteredCollection<E>
@@ -1126,18 +1126,18 @@ public final class Sets {
@Override
public SortedSet<E> subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) {
- return new FilteredSortedSet<E>(
+ return new FilteredSortedSet<>(
((SortedSet<E>) unfiltered).subSet(fromElement, toElement), predicate);
}
@Override
public SortedSet<E> headSet(@ParametricNullness E toElement) {
- return new FilteredSortedSet<E>(((SortedSet<E>) unfiltered).headSet(toElement), predicate);
+ return new FilteredSortedSet<>(((SortedSet<E>) unfiltered).headSet(toElement), predicate);
}
@Override
public SortedSet<E> tailSet(@ParametricNullness E fromElement) {
- return new FilteredSortedSet<E>(((SortedSet<E>) unfiltered).tailSet(fromElement), predicate);
+ return new FilteredSortedSet<>(((SortedSet<E>) unfiltered).tailSet(fromElement), predicate);
}
@Override
@@ -1567,7 +1567,7 @@ public final class Sets {
return new AbstractIndexedListIterator<Set<E>>(size()) {
@Override
protected Set<E> get(final int setBits) {
- return new SubSet<E>(inputSet, setBits);
+ return new SubSet<>(inputSet, setBits);
}
};
}
@@ -1779,7 +1779,7 @@ public final class Sets {
if (set instanceof ImmutableCollection || set instanceof UnmodifiableNavigableSet) {
return set;
}
- return new UnmodifiableNavigableSet<E>(set);
+ return new UnmodifiableNavigableSet<>(set);
}
static final class UnmodifiableNavigableSet<E extends @Nullable Object>
@@ -1839,7 +1839,7 @@ public final class Sets {
public NavigableSet<E> descendingSet() {
UnmodifiableNavigableSet<E> result = descendingSet;
if (result == null) {
- result = descendingSet = new UnmodifiableNavigableSet<E>(delegate.descendingSet());
+ result = descendingSet = new UnmodifiableNavigableSet<>(delegate.descendingSet());
result.descendingSet = this;
}
return result;
diff --git a/android/guava/src/com/google/common/collect/Synchronized.java b/android/guava/src/com/google/common/collect/Synchronized.java
index 57b7d4966..adb94fd03 100644
--- a/android/guava/src/com/google/common/collect/Synchronized.java
+++ b/android/guava/src/com/google/common/collect/Synchronized.java
@@ -111,7 +111,7 @@ final class Synchronized {
private static <E extends @Nullable Object> Collection<E> collection(
Collection<E> collection, @CheckForNull Object mutex) {
- return new SynchronizedCollection<E>(collection, mutex);
+ return new SynchronizedCollection<>(collection, mutex);
}
@VisibleForTesting
@@ -222,7 +222,7 @@ final class Synchronized {
@VisibleForTesting
static <E extends @Nullable Object> Set<E> set(Set<E> set, @CheckForNull Object mutex) {
- return new SynchronizedSet<E>(set, mutex);
+ return new SynchronizedSet<>(set, mutex);
}
static class SynchronizedSet<E extends @Nullable Object> extends SynchronizedCollection<E>
@@ -259,7 +259,7 @@ final class Synchronized {
private static <E extends @Nullable Object> SortedSet<E> sortedSet(
SortedSet<E> set, @CheckForNull Object mutex) {
- return new SynchronizedSortedSet<E>(set, mutex);
+ return new SynchronizedSortedSet<>(set, mutex);
}
static class SynchronizedSortedSet<E extends @Nullable Object> extends SynchronizedSet<E>
@@ -437,7 +437,7 @@ final class Synchronized {
if (multiset instanceof SynchronizedMultiset || multiset instanceof ImmutableMultiset) {
return multiset;
}
- return new SynchronizedMultiset<E>(multiset, mutex);
+ return new SynchronizedMultiset<>(multiset, mutex);
}
static final class SynchronizedMultiset<E extends @Nullable Object>
@@ -1439,7 +1439,7 @@ final class Synchronized {
@GwtIncompatible // NavigableSet
static <E extends @Nullable Object> NavigableSet<E> navigableSet(
NavigableSet<E> navigableSet, @CheckForNull Object mutex) {
- return new SynchronizedNavigableSet<E>(navigableSet, mutex);
+ return new SynchronizedNavigableSet<>(navigableSet, mutex);
}
@GwtIncompatible // NavigableSet
@@ -1771,7 +1771,7 @@ final class Synchronized {
}
static <E extends @Nullable Object> Deque<E> deque(Deque<E> deque, @CheckForNull Object mutex) {
- return new SynchronizedDeque<E>(deque, mutex);
+ return new SynchronizedDeque<>(deque, mutex);
}
static final class SynchronizedDeque<E extends @Nullable Object> extends SynchronizedQueue<E>
diff --git a/android/guava/src/com/google/common/collect/TopKSelector.java b/android/guava/src/com/google/common/collect/TopKSelector.java
index ad1d8d5b4..9db4d6b96 100644
--- a/android/guava/src/com/google/common/collect/TopKSelector.java
+++ b/android/guava/src/com/google/common/collect/TopKSelector.java
@@ -76,7 +76,7 @@ final class TopKSelector<
*/
public static <T extends @Nullable Object> TopKSelector<T> least(
int k, Comparator<? super T> comparator) {
- return new TopKSelector<T>(comparator, k);
+ return new TopKSelector<>(comparator, k);
}
/**
@@ -98,7 +98,7 @@ final class TopKSelector<
*/
public static <T extends @Nullable Object> TopKSelector<T> greatest(
int k, Comparator<? super T> comparator) {
- return new TopKSelector<T>(Ordering.from(comparator).reverse(), k);
+ return new TopKSelector<>(Ordering.from(comparator).reverse(), k);
}
private final int k;
diff --git a/android/guava/src/com/google/common/collect/TreeMultiset.java b/android/guava/src/com/google/common/collect/TreeMultiset.java
index c5e32ca4c..94e4b9d1a 100644
--- a/android/guava/src/com/google/common/collect/TreeMultiset.java
+++ b/android/guava/src/com/google/common/collect/TreeMultiset.java
@@ -75,7 +75,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
*/
@SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
public static <E extends Comparable> TreeMultiset<E> create() {
- return new TreeMultiset<E>(Ordering.natural());
+ return new TreeMultiset<>(Ordering.natural());
}
/**
@@ -266,7 +266,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
AvlNode<E> root = rootReference.get();
if (root == null) {
int unused = comparator().compare(element, element);
- AvlNode<E> newRoot = new AvlNode<E>(element, occurrences);
+ AvlNode<E> newRoot = new AvlNode<>(element, occurrences);
successor(header, newRoot, header);
rootReference.checkAndSet(root, newRoot);
return 0;
@@ -539,7 +539,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
@Override
public SortedMultiset<E> headMultiset(@ParametricNullness E upperBound, BoundType boundType) {
- return new TreeMultiset<E>(
+ return new TreeMultiset<>(
rootReference,
range.intersect(GeneralRange.upTo(comparator(), upperBound, boundType)),
header);
@@ -547,7 +547,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
@Override
public SortedMultiset<E> tailMultiset(@ParametricNullness E lowerBound, BoundType boundType) {
- return new TreeMultiset<E>(
+ return new TreeMultiset<>(
rootReference,
range.intersect(GeneralRange.downTo(comparator(), lowerBound, boundType)),
header);
@@ -647,7 +647,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
}
private AvlNode<E> addRightChild(@ParametricNullness E e, int count) {
- right = new AvlNode<E>(e, count);
+ right = new AvlNode<>(e, count);
successor(this, right, succ());
height = Math.max(2, height);
distinctElements++;
@@ -656,7 +656,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
}
private AvlNode<E> addLeftChild(@ParametricNullness E e, int count) {
- left = new AvlNode<E>(e, count);
+ left = new AvlNode<>(e, count);
successor(pred(), left, this);
height = Math.max(2, height);
distinctElements++;
diff --git a/android/guava/src/com/google/common/collect/TreeTraverser.java b/android/guava/src/com/google/common/collect/TreeTraverser.java
index 1d017765f..8545be72f 100644
--- a/android/guava/src/com/google/common/collect/TreeTraverser.java
+++ b/android/guava/src/com/google/common/collect/TreeTraverser.java
@@ -215,7 +215,7 @@ public abstract class TreeTraverser<T> {
}
private PostOrderNode<T> expand(T t) {
- return new PostOrderNode<T>(t, children(t).iterator());
+ return new PostOrderNode<>(t, children(t).iterator());
}
}
@@ -245,7 +245,7 @@ public abstract class TreeTraverser<T> {
private final Queue<T> queue;
BreadthFirstIterator(T root) {
- this.queue = new ArrayDeque<T>();
+ this.queue = new ArrayDeque<>();
queue.add(root);
}
diff --git a/android/guava/src/com/google/common/graph/Graphs.java b/android/guava/src/com/google/common/graph/Graphs.java
index 38498f6f6..b3268015b 100644
--- a/android/guava/src/com/google/common/graph/Graphs.java
+++ b/android/guava/src/com/google/common/graph/Graphs.java
@@ -166,7 +166,7 @@ public final class Graphs extends GraphsBridgeMethods {
} else {
// An optimization for the undirected case: for every node B reachable from node A,
// node A and node B have the same reachability set.
- Set<N> visitedNodes = new HashSet<N>();
+ Set<N> visitedNodes = new HashSet<>();
for (N node : graph.nodes()) {
if (!visitedNodes.contains(node)) {
Set<N> reachableNodes = reachableNodes(graph, node);
@@ -218,7 +218,7 @@ public final class Graphs extends GraphsBridgeMethods {
return ((TransposedGraph<N>) graph).graph;
}
- return new TransposedGraph<N>(graph);
+ return new TransposedGraph<>(graph);
}
/**
diff --git a/android/guava/src/com/google/common/hash/BloomFilter.java b/android/guava/src/com/google/common/hash/BloomFilter.java
index 557d05593..3ae6b68c2 100644
--- a/android/guava/src/com/google/common/hash/BloomFilter.java
+++ b/android/guava/src/com/google/common/hash/BloomFilter.java
@@ -138,7 +138,7 @@ public final class BloomFilter<T extends @Nullable Object> implements Predicate<
* @since 12.0
*/
public BloomFilter<T> copy() {
- return new BloomFilter<T>(bits.copy(), numHashFunctions, funnel, strategy);
+ return new BloomFilter<>(bits.copy(), numHashFunctions, funnel, strategy);
}
/**
@@ -369,7 +369,7 @@ public final class BloomFilter<T extends @Nullable Object> implements Predicate<
long numBits = optimalNumOfBits(expectedInsertions, fpp);
int numHashFunctions = optimalNumOfHashFunctions(expectedInsertions, numBits);
try {
- return new BloomFilter<T>(new LockFreeBitArray(numBits), numHashFunctions, funnel, strategy);
+ return new BloomFilter<>(new LockFreeBitArray(numBits), numHashFunctions, funnel, strategy);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Could not create BloomFilter of " + numBits + " bits", e);
}
@@ -554,7 +554,7 @@ public final class BloomFilter<T extends @Nullable Object> implements Predicate<
dataArray.putData(i, din.readLong());
}
- return new BloomFilter<T>(dataArray, numHashFunctions, funnel, strategy);
+ return new BloomFilter<>(dataArray, numHashFunctions, funnel, strategy);
} catch (IOException e) {
throw e;
} catch (Exception e) { // sneaky checked exception
diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java b/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java
index bbd8b7bfc..35ddf8d3a 100644
--- a/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java
+++ b/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java
@@ -860,7 +860,7 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna
}
return false;
}
- SetFuture<V> valueToSet = new SetFuture<V>(this, future);
+ SetFuture<V> valueToSet = new SetFuture<>(this, future);
if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
// the listener is responsible for calling completeWithFuture, directExecutor is appropriate
// since all we are doing is unpacking a completed future which should be fast.
diff --git a/android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java b/android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
index 33f08298c..0c3b5e7d3 100644
--- a/android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
+++ b/android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
@@ -68,7 +68,7 @@ public final class AtomicLongMap<K> implements Serializable {
/** Creates an {@code AtomicLongMap}. */
public static <K> AtomicLongMap<K> create() {
- return new AtomicLongMap<K>(new ConcurrentHashMap<K, AtomicLong>());
+ return new AtomicLongMap<>(new ConcurrentHashMap<>());
}
/** Creates an {@code AtomicLongMap} with the same mappings as the specified {@code Map}. */
diff --git a/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java b/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java
index 2c4d982ef..9635956bc 100644
--- a/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java
+++ b/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java
@@ -406,7 +406,7 @@ public final class ClosingFuture<V extends @Nullable Object> {
* when the pipeline is done, use {@link #submit(ClosingCallable, Executor)} instead.
*/
public static <V extends @Nullable Object> ClosingFuture<V> from(ListenableFuture<V> future) {
- return new ClosingFuture<V>(future);
+ return new ClosingFuture<>(future);
}
/**
diff --git a/android/guava/src/com/google/common/util/concurrent/Futures.java b/android/guava/src/com/google/common/util/concurrent/Futures.java
index 0e174bcae..e8441519b 100644
--- a/android/guava/src/com/google/common/util/concurrent/Futures.java
+++ b/android/guava/src/com/google/common/util/concurrent/Futures.java
@@ -161,7 +161,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
public static <V extends @Nullable Object> ListenableFuture<V> immediateFailedFuture(
Throwable throwable) {
checkNotNull(throwable);
- return new ImmediateFailedFuture<V>(throwable);
+ return new ImmediateFailedFuture<>(throwable);
}
/**
@@ -584,7 +584,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
@SafeVarargs
public static <V extends @Nullable Object> FutureCombiner<V> whenAllComplete(
ListenableFuture<? extends V>... futures) {
- return new FutureCombiner<V>(false, ImmutableList.copyOf(futures));
+ return new FutureCombiner<>(false, ImmutableList.copyOf(futures));
}
/**
@@ -597,7 +597,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
*/
public static <V extends @Nullable Object> FutureCombiner<V> whenAllComplete(
Iterable<? extends ListenableFuture<? extends V>> futures) {
- return new FutureCombiner<V>(false, ImmutableList.copyOf(futures));
+ return new FutureCombiner<>(false, ImmutableList.copyOf(futures));
}
/**
@@ -610,7 +610,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
@SafeVarargs
public static <V extends @Nullable Object> FutureCombiner<V> whenAllSucceed(
ListenableFuture<? extends V>... futures) {
- return new FutureCombiner<V>(true, ImmutableList.copyOf(futures));
+ return new FutureCombiner<>(true, ImmutableList.copyOf(futures));
}
/**
@@ -622,7 +622,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
*/
public static <V extends @Nullable Object> FutureCombiner<V> whenAllSucceed(
Iterable<? extends ListenableFuture<? extends V>> futures) {
- return new FutureCombiner<V>(true, ImmutableList.copyOf(futures));
+ return new FutureCombiner<>(true, ImmutableList.copyOf(futures));
}
/**
@@ -684,7 +684,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
*/
public <C extends @Nullable Object> ListenableFuture<C> callAsync(
AsyncCallable<C> combiner, Executor executor) {
- return new CombinedFuture<C>(futures, allMustSucceed, executor, combiner);
+ return new CombinedFuture<>(futures, allMustSucceed, executor, combiner);
}
/**
@@ -709,7 +709,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
*/
public <C extends @Nullable Object> ListenableFuture<C> call(
Callable<C> combiner, Executor executor) {
- return new CombinedFuture<C>(futures, allMustSucceed, executor, combiner);
+ return new CombinedFuture<>(futures, allMustSucceed, executor, combiner);
}
/**
diff --git a/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java b/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java
index cbf051e72..d8c408910 100644
--- a/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java
+++ b/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java
@@ -610,7 +610,7 @@ public final class MoreExecutors {
Callable<V> callable, long delay, TimeUnit unit) {
TrustedListenableFutureTask<V> task = TrustedListenableFutureTask.create(callable);
ScheduledFuture<?> scheduled = delegate.schedule(task, delay, unit);
- return new ListenableScheduledTask<V>(task, scheduled);
+ return new ListenableScheduledTask<>(task, scheduled);
}
@Override
diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java
index f1cc97372..2ad9676c6 100644
--- a/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java
+++ b/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java
@@ -137,12 +137,14 @@ abstract class AbstractIteratorTester<E extends @Nullable Object, I extends Iter
* The elements to be returned by future calls to {@code next()}, with the first at the top of
* the stack.
*/
- final Stack<E> nextElements = new Stack<E>();
+ final Stack<E> nextElements = new Stack<>();
+
/**
* The elements to be returned by future calls to {@code previous()}, with the first at the top
* of the stack.
*/
- final Stack<E> previousElements = new Stack<E>();
+ final Stack<E> previousElements = new Stack<>();
+
/**
* {@link #nextElements} if {@code next()} was called more recently then {@code previous},
* {@link #previousElements} if the reverse is true, or -- overriding both of these -- {@code
@@ -256,7 +258,7 @@ abstract class AbstractIteratorTester<E extends @Nullable Object, I extends Iter
}
private List<E> getElements() {
- List<E> elements = new ArrayList<E>();
+ List<E> elements = new ArrayList<>();
Helpers.addAll(elements, previousElements);
Helpers.addAll(elements, Helpers.reverse(nextElements));
return elements;
@@ -325,7 +327,7 @@ abstract class AbstractIteratorTester<E extends @Nullable Object, I extends Iter
public void testForEachRemaining() {
for (int i = 0; i < expectedElements.size() - 1; i++) {
- List<E> targetElements = new ArrayList<E>();
+ List<E> targetElements = new ArrayList<>();
Iterator<E> iterator = newTargetIterator();
for (int j = 0; j < i; j++) {
targetElements.add(iterator.next());
diff --git a/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java b/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java
index fed059c39..06ddcf0e9 100644
--- a/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java
+++ b/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java
@@ -587,7 +587,7 @@ public class TestsForMapsInJavaUtil {
}
static <T> Comparator<T> arbitraryNullFriendlyComparator() {
- return new NullFriendlyComparator<T>();
+ return new NullFriendlyComparator<>();
}
private static final class NullFriendlyComparator<T> implements Comparator<T>, Serializable {
diff --git a/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java b/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java
index 0141d8daf..d3aa59ec5 100644
--- a/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java
+++ b/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java
@@ -560,7 +560,7 @@ public class TestsForSetsInJavaUtil {
}
static <T> Comparator<T> arbitraryNullFriendlyComparator() {
- return new NullFriendlyComparator<T>();
+ return new NullFriendlyComparator<>();
}
private static final class NullFriendlyComparator<T> implements Comparator<T>, Serializable {
diff --git a/guava/src/com/google/common/base/Equivalence.java b/guava/src/com/google/common/base/Equivalence.java
index a2b8bb15b..510f29b1a 100644
--- a/guava/src/com/google/common/base/Equivalence.java
+++ b/guava/src/com/google/common/base/Equivalence.java
@@ -287,7 +287,7 @@ public abstract class Equivalence<T> implements BiPredicate<@Nullable T, @Nullab
* @since 10.0
*/
public final Predicate<@Nullable T> equivalentTo(@CheckForNull T target) {
- return new EquivalentToPredicate<T>(this, target);
+ return new EquivalentToPredicate<>(this, target);
}
private static final class EquivalentToPredicate<T>
diff --git a/guava/src/com/google/common/base/Optional.java b/guava/src/com/google/common/base/Optional.java
index 0609906b0..c42171078 100644
--- a/guava/src/com/google/common/base/Optional.java
+++ b/guava/src/com/google/common/base/Optional.java
@@ -105,7 +105,7 @@ public abstract class Optional<T> implements Serializable {
* @throws NullPointerException if {@code reference} is null
*/
public static <T> Optional<T> of(T reference) {
- return new Present<T>(checkNotNull(reference));
+ return new Present<>(checkNotNull(reference));
}
/**
diff --git a/guava/src/com/google/common/base/Suppliers.java b/guava/src/com/google/common/base/Suppliers.java
index 3989e7710..9ef29af08 100644
--- a/guava/src/com/google/common/base/Suppliers.java
+++ b/guava/src/com/google/common/base/Suppliers.java
@@ -265,7 +265,7 @@ public final class Suppliers {
// The alternative of `duration.compareTo(Duration.ZERO) > 0` causes J2ObjC trouble.
checkArgument(
!duration.isNegative() && !duration.isZero(), "duration (%s) must be > 0", duration);
- return new ExpiringMemoizingSupplier<T>(delegate, toNanosSaturated(duration));
+ return new ExpiringMemoizingSupplier<>(delegate, toNanosSaturated(duration));
}
@VisibleForTesting
diff --git a/guava/src/com/google/common/collect/ArrayListMultimap.java b/guava/src/com/google/common/collect/ArrayListMultimap.java
index c0ed5571f..db7226d63 100644
--- a/guava/src/com/google/common/collect/ArrayListMultimap.java
+++ b/guava/src/com/google/common/collect/ArrayListMultimap.java
@@ -133,7 +133,7 @@ public final class ArrayListMultimap<K extends @Nullable Object, V extends @Null
*/
@Override
List<V> createCollection() {
- return new ArrayList<V>(expectedValuesPerKey);
+ return new ArrayList<>(expectedValuesPerKey);
}
/**
diff --git a/guava/src/com/google/common/collect/Collections2.java b/guava/src/com/google/common/collect/Collections2.java
index 9cfc3bc18..4ed189754 100644
--- a/guava/src/com/google/common/collect/Collections2.java
+++ b/guava/src/com/google/common/collect/Collections2.java
@@ -93,7 +93,7 @@ public final class Collections2 {
return ((FilteredCollection<E>) unfiltered).createCombined(predicate);
}
- return new FilteredCollection<E>(checkNotNull(unfiltered), checkNotNull(predicate));
+ return new FilteredCollection<>(checkNotNull(unfiltered), checkNotNull(predicate));
}
/**
@@ -132,8 +132,7 @@ public final class Collections2 {
}
FilteredCollection<E> createCombined(Predicate<? super E> newPredicate) {
- return new FilteredCollection<E>(unfiltered, Predicates.<E>and(predicate, newPredicate));
- // .<E> above needed to compile in JDK 5
+ return new FilteredCollection<>(unfiltered, Predicates.and(predicate, newPredicate));
}
@Override
@@ -639,7 +638,7 @@ public final class Collections2 {
int j;
PermutationIterator(List<E> list) {
- this.list = new ArrayList<E>(list);
+ this.list = new ArrayList<>(list);
int n = list.size();
c = new int[n];
o = new int[n];
diff --git a/guava/src/com/google/common/collect/CompactLinkedHashMap.java b/guava/src/com/google/common/collect/CompactLinkedHashMap.java
index 8a3f93dfc..b23807df4 100644
--- a/guava/src/com/google/common/collect/CompactLinkedHashMap.java
+++ b/guava/src/com/google/common/collect/CompactLinkedHashMap.java
@@ -130,7 +130,7 @@ class CompactLinkedHashMap<K extends @Nullable Object, V extends @Nullable Objec
@Override
Map<K, V> createHashFloodingResistantDelegate(int tableSize) {
- return new LinkedHashMap<K, V>(tableSize, 1.0f, accessOrder);
+ return new LinkedHashMap<>(tableSize, 1.0f, accessOrder);
}
@Override
diff --git a/guava/src/com/google/common/collect/EnumMultiset.java b/guava/src/com/google/common/collect/EnumMultiset.java
index 04126f8aa..5e3b2fb84 100644
--- a/guava/src/com/google/common/collect/EnumMultiset.java
+++ b/guava/src/com/google/common/collect/EnumMultiset.java
@@ -52,7 +52,7 @@ public final class EnumMultiset<E extends Enum<E>> extends AbstractMultiset<E>
implements Serializable {
/** Creates an empty {@code EnumMultiset}. */
public static <E extends Enum<E>> EnumMultiset<E> create(Class<E> type) {
- return new EnumMultiset<E>(type);
+ return new EnumMultiset<>(type);
}
/**
diff --git a/guava/src/com/google/common/collect/HashMultiset.java b/guava/src/com/google/common/collect/HashMultiset.java
index 357dc62c7..699f8a23b 100644
--- a/guava/src/com/google/common/collect/HashMultiset.java
+++ b/guava/src/com/google/common/collect/HashMultiset.java
@@ -38,7 +38,7 @@ public final class HashMultiset<E extends @Nullable Object> extends AbstractMapB
/** Creates a new, empty {@code HashMultiset} using the default initial capacity. */
public static <E extends @Nullable Object> HashMultiset<E> create() {
- return new HashMultiset<E>();
+ return new HashMultiset<>();
}
/**
@@ -49,7 +49,7 @@ public final class HashMultiset<E extends @Nullable Object> extends AbstractMapB
* @throws IllegalArgumentException if {@code distinctElements} is negative
*/
public static <E extends @Nullable Object> HashMultiset<E> create(int distinctElements) {
- return new HashMultiset<E>(distinctElements);
+ return new HashMultiset<>(distinctElements);
}
/**
diff --git a/guava/src/com/google/common/collect/ImmutableCollection.java b/guava/src/com/google/common/collect/ImmutableCollection.java
index ee18f0d9c..80987788c 100644
--- a/guava/src/com/google/common/collect/ImmutableCollection.java
+++ b/guava/src/com/google/common/collect/ImmutableCollection.java
@@ -368,7 +368,7 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
case 1:
return ImmutableList.of(iterator().next());
default:
- return new RegularImmutableAsList<E>(this, toArray());
+ return new RegularImmutableAsList<>(this, toArray());
}
}
diff --git a/guava/src/com/google/common/collect/ImmutableEnumSet.java b/guava/src/com/google/common/collect/ImmutableEnumSet.java
index 5488039af..9d31b43da 100644
--- a/guava/src/com/google/common/collect/ImmutableEnumSet.java
+++ b/guava/src/com/google/common/collect/ImmutableEnumSet.java
@@ -44,7 +44,7 @@ final class ImmutableEnumSet<E extends Enum<E>> extends ImmutableSet<E> {
case 1:
return ImmutableSet.of(Iterables.getOnlyElement(set));
default:
- return new ImmutableEnumSet<E>(set);
+ return new ImmutableEnumSet<>(set);
}
}
diff --git a/guava/src/com/google/common/collect/ImmutableList.java b/guava/src/com/google/common/collect/ImmutableList.java
index 6f00f8362..63f6de654 100644
--- a/guava/src/com/google/common/collect/ImmutableList.java
+++ b/guava/src/com/google/common/collect/ImmutableList.java
@@ -98,7 +98,7 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
* @throws NullPointerException if {@code element} is null
*/
public static <E> ImmutableList<E> of(E element) {
- return new SingletonImmutableList<E>(element);
+ return new SingletonImmutableList<>(element);
}
/**
@@ -387,7 +387,7 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
@SuppressWarnings("nullness")
Object[] elementsWithoutTrailingNulls =
length < elements.length ? Arrays.copyOf(elements, length) : elements;
- return new RegularImmutableList<E>(elementsWithoutTrailingNulls);
+ return new RegularImmutableList<>(elementsWithoutTrailingNulls);
}
}
@@ -759,7 +759,7 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
* Builder} constructor.
*/
public static <E> Builder<E> builder() {
- return new Builder<E>();
+ return new Builder<>();
}
/**
@@ -776,7 +776,7 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
*/
public static <E> Builder<E> builderWithExpectedSize(int expectedSize) {
checkNonnegative(expectedSize, "expectedSize");
- return new ImmutableList.Builder<E>(expectedSize);
+ return new ImmutableList.Builder<>(expectedSize);
}
/**
diff --git a/guava/src/com/google/common/collect/ImmutableMultiset.java b/guava/src/com/google/common/collect/ImmutableMultiset.java
index f0197433f..ed5c52844 100644
--- a/guava/src/com/google/common/collect/ImmutableMultiset.java
+++ b/guava/src/com/google/common/collect/ImmutableMultiset.java
@@ -452,7 +452,7 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa
* Builder} constructor.
*/
public static <E> Builder<E> builder() {
- return new Builder<E>();
+ return new Builder<>();
}
/**
diff --git a/guava/src/com/google/common/collect/ImmutableRangeMap.java b/guava/src/com/google/common/collect/ImmutableRangeMap.java
index 7ceda58d8..0d4d23976 100644
--- a/guava/src/com/google/common/collect/ImmutableRangeMap.java
+++ b/guava/src/com/google/common/collect/ImmutableRangeMap.java
@@ -89,7 +89,7 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
}
Map<Range<K>, ? extends V> map = rangeMap.asMapOfRanges();
ImmutableList.Builder<Range<K>> rangesBuilder = new ImmutableList.Builder<>(map.size());
- ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<V>(map.size());
+ ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<>(map.size());
for (Entry<Range<K>, ? extends V> entry : map.entrySet()) {
rangesBuilder.add(entry.getKey());
valuesBuilder.add(entry.getValue());
@@ -153,7 +153,7 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
public ImmutableRangeMap<K, V> build() {
Collections.sort(entries, Range.<K>rangeLexOrdering().onKeys());
ImmutableList.Builder<Range<K>> rangesBuilder = new ImmutableList.Builder<>(entries.size());
- ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<V>(entries.size());
+ ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<>(entries.size());
for (int i = 0; i < entries.size(); i++) {
Range<K> range = entries.get(i).getKey();
if (i > 0) {
diff --git a/guava/src/com/google/common/collect/ImmutableRangeSet.java b/guava/src/com/google/common/collect/ImmutableRangeSet.java
index 0362f36a6..7ab80c2ec 100644
--- a/guava/src/com/google/common/collect/ImmutableRangeSet.java
+++ b/guava/src/com/google/common/collect/ImmutableRangeSet.java
@@ -93,7 +93,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
} else if (range.equals(Range.all())) {
return all();
} else {
- return new ImmutableRangeSet<C>(ImmutableList.of(range));
+ return new ImmutableRangeSet<>(ImmutableList.of(range));
}
}
@@ -118,7 +118,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
return immutableRangeSet;
}
}
- return new ImmutableRangeSet<C>(ImmutableList.copyOf(rangeSet.asRanges()));
+ return new ImmutableRangeSet<>(ImmutableList.copyOf(rangeSet.asRanges()));
}
/**
@@ -390,7 +390,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
return complement = of();
} else {
ImmutableList<Range<C>> complementRanges = new ComplementRanges();
- result = complement = new ImmutableRangeSet<C>(complementRanges, this);
+ result = complement = new ImmutableRangeSet<>(complementRanges, this);
}
return result;
}
@@ -517,7 +517,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
if (range.encloses(span)) {
return this;
} else if (range.isConnected(span)) {
- return new ImmutableRangeSet<C>(intersectRanges(range));
+ return new ImmutableRangeSet<>(intersectRanges(range));
}
}
return of();
@@ -695,7 +695,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
@Override
ImmutableSortedSet<C> createDescendingSet() {
- return new DescendingImmutableSortedSet<C>(this);
+ return new DescendingImmutableSortedSet<>(this);
}
@Override
@@ -746,7 +746,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
/** Returns a new builder for an immutable range set. */
public static <C extends Comparable<?>> Builder<C> builder() {
- return new Builder<C>();
+ return new Builder<>();
}
/**
@@ -841,7 +841,7 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
&& Iterables.getOnlyElement(mergedRanges).equals(Range.all())) {
return all();
} else {
- return new ImmutableRangeSet<C>(mergedRanges);
+ return new ImmutableRangeSet<>(mergedRanges);
}
}
}
diff --git a/guava/src/com/google/common/collect/ImmutableSet.java b/guava/src/com/google/common/collect/ImmutableSet.java
index 412f34001..d28d9bae3 100644
--- a/guava/src/com/google/common/collect/ImmutableSet.java
+++ b/guava/src/com/google/common/collect/ImmutableSet.java
@@ -89,7 +89,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
* type conveys the immutability guarantee.
*/
public static <E> ImmutableSet<E> of(E element) {
- return new SingletonImmutableSet<E>(element);
+ return new SingletonImmutableSet<>(element);
}
/*
@@ -148,7 +148,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
public static <E> ImmutableSet<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... others) {
checkArgument(
others.length <= Integer.MAX_VALUE - 6, "the total number of elements must fit in an int");
- SetBuilderImpl<E> builder = new RegularSetBuilderImpl<E>(6 + others.length);
+ SetBuilderImpl<E> builder = new RegularSetBuilderImpl<>(6 + others.length);
builder = builder.add(e1).add(e2).add(e3).add(e4).add(e5).add(e6);
for (int i = 0; i < others.length; i++) {
builder = builder.add(others[i]);
@@ -262,7 +262,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
case 1:
return of(elements[0]);
default:
- SetBuilderImpl<E> builder = new RegularSetBuilderImpl<E>(expectedSize);
+ SetBuilderImpl<E> builder = new RegularSetBuilderImpl<>(expectedSize);
for (int i = 0; i < elements.length; i++) {
builder = builder.add(elements[i]);
}
@@ -321,7 +321,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
}
ImmutableList<E> createAsList() {
- return new RegularImmutableAsList<E>(this, toArray());
+ return new RegularImmutableAsList<>(this, toArray());
}
// redeclare to help optimizers with b/310253115
@@ -433,7 +433,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
* Builder} constructor.
*/
public static <E> Builder<E> builder() {
- return new Builder<E>();
+ return new Builder<>();
}
/**
@@ -450,7 +450,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
*/
public static <E> Builder<E> builderWithExpectedSize(int expectedSize) {
checkNonnegative(expectedSize, "expectedSize");
- return new Builder<E>(expectedSize);
+ return new Builder<>(expectedSize);
}
/**
@@ -486,7 +486,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
Builder(int capacity) {
if (capacity > 0) {
- impl = new RegularSetBuilderImpl<E>(capacity);
+ impl = new RegularSetBuilderImpl<>(capacity);
} else {
impl = EmptySetBuilderImpl.instance();
}
@@ -499,7 +499,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
@VisibleForTesting
void forceJdk() {
requireNonNull(impl); // see the comment on the field
- this.impl = new JdkBackedSetBuilderImpl<E>(impl);
+ this.impl = new JdkBackedSetBuilderImpl<>(impl);
}
final void copyIfNecessary() {
@@ -783,7 +783,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
@Override
SetBuilderImpl<E> copy() {
- return new RegularSetBuilderImpl<E>(this);
+ return new RegularSetBuilderImpl<>(this);
}
@Override
@@ -821,7 +821,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
(distinct == dedupedElements.length)
? dedupedElements
: Arrays.copyOf(dedupedElements, distinct);
- return new RegularImmutableSet<E>(
+ return new RegularImmutableSet<>(
elements, hashCode, requireNonNull(hashTable), hashTable.length - 1);
}
}
@@ -980,7 +980,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
*/
return of(requireNonNull(dedupedElements[0]));
default:
- return new JdkBackedImmutableSet<E>(
+ return new JdkBackedImmutableSet<>(
delegate, ImmutableList.asImmutableList(dedupedElements, distinct));
}
}
diff --git a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java
index 2f4e7a87b..bdfad999d 100644
--- a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java
+++ b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java
@@ -118,7 +118,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
RegularImmutableSortedSet<E> elementSet =
(RegularImmutableSortedSet<E>) ImmutableSortedSet.of(element);
long[] cumulativeCounts = {0, 1};
- return new RegularImmutableSortedMultiset<E>(elementSet, cumulativeCounts, 0, 1);
+ return new RegularImmutableSortedMultiset<>(elementSet, cumulativeCounts, 0, 1);
}
/**
@@ -300,7 +300,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
if (entries.isEmpty()) {
return emptyMultiset(comparator);
}
- ImmutableList.Builder<E> elementsBuilder = new ImmutableList.Builder<E>(entries.size());
+ ImmutableList.Builder<E> elementsBuilder = new ImmutableList.Builder<>(entries.size());
long[] cumulativeCounts = new long[entries.size() + 1];
int i = 0;
for (Entry<E> entry : entries) {
@@ -308,7 +308,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
cumulativeCounts[i + 1] = cumulativeCounts[i] + entry.getCount();
i++;
}
- return new RegularImmutableSortedMultiset<E>(
+ return new RegularImmutableSortedMultiset<>(
new RegularImmutableSortedSet<E>(elementsBuilder.build(), comparator),
cumulativeCounts,
0,
@@ -320,7 +320,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
if (Ordering.natural().equals(comparator)) {
return (ImmutableSortedMultiset<E>) RegularImmutableSortedMultiset.NATURAL_EMPTY_MULTISET;
} else {
- return new RegularImmutableSortedMultiset<E>(comparator);
+ return new RegularImmutableSortedMultiset<>(comparator);
}
}
@@ -408,7 +408,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
* @throws NullPointerException if {@code comparator} is null
*/
public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
- return new Builder<E>(comparator);
+ return new Builder<>(comparator);
}
/**
@@ -420,7 +420,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
* href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6468354">bug 6468354</a>.
*/
public static <E extends Comparable<?>> Builder<E> reverseOrder() {
- return new Builder<E>(Ordering.<E>natural().reverse());
+ return new Builder<>(Ordering.<E>natural().reverse());
}
/**
@@ -434,7 +434,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E>
* href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6468354">bug 6468354</a>.
*/
public static <E extends Comparable<?>> Builder<E> naturalOrder() {
- return new Builder<E>(Ordering.natural());
+ return new Builder<>(Ordering.natural());
}
/**
diff --git a/guava/src/com/google/common/collect/ImmutableSortedSet.java b/guava/src/com/google/common/collect/ImmutableSortedSet.java
index 1ec68e352..f8fe43fb5 100644
--- a/guava/src/com/google/common/collect/ImmutableSortedSet.java
+++ b/guava/src/com/google/common/collect/ImmutableSortedSet.java
@@ -90,7 +90,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E
(RegularImmutableSortedSet<E>) RegularImmutableSortedSet.NATURAL_EMPTY_SET;
return result;
} else {
- return new RegularImmutableSortedSet<E>(ImmutableList.<E>of(), comparator);
+ return new RegularImmutableSortedSet<>(ImmutableList.of(), comparator);
}
}
@@ -106,7 +106,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E
/** Returns an immutable sorted set containing a single element. */
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element) {
- return new RegularImmutableSortedSet<E>(ImmutableList.of(element), Ordering.natural());
+ return new RegularImmutableSortedSet<>(ImmutableList.of(element), Ordering.natural());
}
/**
@@ -350,7 +350,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E
if (list.isEmpty()) {
return emptySet(comparator);
} else {
- return new RegularImmutableSortedSet<E>(list, comparator);
+ return new RegularImmutableSortedSet<>(list, comparator);
}
}
@@ -381,7 +381,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E
}
}
Arrays.fill(contents, uniques, n, null);
- return new RegularImmutableSortedSet<E>(
+ return new RegularImmutableSortedSet<>(
ImmutableList.<E>asImmutableList(contents, uniques), comparator);
}
@@ -394,7 +394,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E
* @throws NullPointerException if {@code comparator} is null
*/
public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
- return new Builder<E>(comparator);
+ return new Builder<>(comparator);
}
/**
@@ -402,7 +402,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E
* of their natural ordering.
*/
public static <E extends Comparable<?>> Builder<E> reverseOrder() {
- return new Builder<E>(Collections.reverseOrder());
+ return new Builder<>(Collections.reverseOrder());
}
/**
@@ -412,7 +412,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E
* implement {@link Comparable}.
*/
public static <E extends Comparable<?>> Builder<E> naturalOrder() {
- return new Builder<E>(Ordering.natural());
+ return new Builder<>(Ordering.natural());
}
/**
@@ -580,7 +580,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E
return emptySet(comparator);
} else {
forceCopy = true;
- return new RegularImmutableSortedSet<E>(
+ return new RegularImmutableSortedSet<>(
ImmutableList.asImmutableList(elements, n), comparator);
}
}
diff --git a/guava/src/com/google/common/collect/LinkedHashMultiset.java b/guava/src/com/google/common/collect/LinkedHashMultiset.java
index 21e290467..9fda467ee 100644
--- a/guava/src/com/google/common/collect/LinkedHashMultiset.java
+++ b/guava/src/com/google/common/collect/LinkedHashMultiset.java
@@ -46,7 +46,7 @@ public final class LinkedHashMultiset<E extends @Nullable Object>
/** Creates a new, empty {@code LinkedHashMultiset} using the default initial capacity. */
public static <E extends @Nullable Object> LinkedHashMultiset<E> create() {
- return new LinkedHashMultiset<E>();
+ return new LinkedHashMultiset<>();
}
/**
@@ -57,7 +57,7 @@ public final class LinkedHashMultiset<E extends @Nullable Object>
* @throws IllegalArgumentException if {@code distinctElements} is negative
*/
public static <E extends @Nullable Object> LinkedHashMultiset<E> create(int distinctElements) {
- return new LinkedHashMultiset<E>(distinctElements);
+ return new LinkedHashMultiset<>(distinctElements);
}
/**
diff --git a/guava/src/com/google/common/collect/MapMakerInternalMap.java b/guava/src/com/google/common/collect/MapMakerInternalMap.java
index 159b88a55..ead769e12 100644
--- a/guava/src/com/google/common/collect/MapMakerInternalMap.java
+++ b/guava/src/com/google/common/collect/MapMakerInternalMap.java
@@ -636,7 +636,7 @@ class MapMakerInternalMap<
MapMakerInternalMap<K, Dummy, StrongKeyDummyValueEntry<K>, StrongKeyDummyValueSegment<K>>
map,
int initialCapacity) {
- return new StrongKeyDummyValueSegment<K>(map, initialCapacity);
+ return new StrongKeyDummyValueSegment<>(map, initialCapacity);
}
@Override
@@ -1274,7 +1274,7 @@ class MapMakerInternalMap<
}
AtomicReferenceArray<E> newEntryArray(int size) {
- return new AtomicReferenceArray<E>(size);
+ return new AtomicReferenceArray<>(size);
}
void initTable(AtomicReferenceArray<E> newTable) {
@@ -2066,7 +2066,7 @@ class MapMakerInternalMap<
/** Concrete implementation of {@link Segment} for strong keys and weak values. */
static final class StrongKeyWeakValueSegment<K, V>
extends Segment<K, V, StrongKeyWeakValueEntry<K, V>, StrongKeyWeakValueSegment<K, V>> {
- private final ReferenceQueue<V> queueForValues = new ReferenceQueue<V>();
+ private final ReferenceQueue<V> queueForValues = new ReferenceQueue<>();
StrongKeyWeakValueSegment(
MapMakerInternalMap<K, V, StrongKeyWeakValueEntry<K, V>, StrongKeyWeakValueSegment<K, V>>
@@ -2154,7 +2154,7 @@ class MapMakerInternalMap<
/** Concrete implementation of {@link Segment} for weak keys and strong values. */
static final class WeakKeyStrongValueSegment<K, V>
extends Segment<K, V, WeakKeyStrongValueEntry<K, V>, WeakKeyStrongValueSegment<K, V>> {
- private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<K>();
+ private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<>();
WeakKeyStrongValueSegment(
MapMakerInternalMap<K, V, WeakKeyStrongValueEntry<K, V>, WeakKeyStrongValueSegment<K, V>>
@@ -2193,8 +2193,8 @@ class MapMakerInternalMap<
/** Concrete implementation of {@link Segment} for weak keys and weak values. */
static final class WeakKeyWeakValueSegment<K, V>
extends Segment<K, V, WeakKeyWeakValueEntry<K, V>, WeakKeyWeakValueSegment<K, V>> {
- private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<K>();
- private final ReferenceQueue<V> queueForValues = new ReferenceQueue<V>();
+ private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<>();
+ private final ReferenceQueue<V> queueForValues = new ReferenceQueue<>();
WeakKeyWeakValueSegment(
MapMakerInternalMap<K, V, WeakKeyWeakValueEntry<K, V>, WeakKeyWeakValueSegment<K, V>> map,
@@ -2264,7 +2264,7 @@ class MapMakerInternalMap<
/** Concrete implementation of {@link Segment} for weak keys and {@link Dummy} values. */
static final class WeakKeyDummyValueSegment<K>
extends Segment<K, Dummy, WeakKeyDummyValueEntry<K>, WeakKeyDummyValueSegment<K>> {
- private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<K>();
+ private final ReferenceQueue<K> queueForKeys = new ReferenceQueue<>();
WeakKeyDummyValueSegment(
MapMakerInternalMap<K, Dummy, WeakKeyDummyValueEntry<K>, WeakKeyDummyValueSegment<K>> map,
@@ -2303,7 +2303,7 @@ class MapMakerInternalMap<
final WeakReference<MapMakerInternalMap<?, ?, ?, ?>> mapReference;
public CleanupMapTask(MapMakerInternalMap<?, ?, ?, ?> map) {
- this.mapReference = new WeakReference<MapMakerInternalMap<?, ?, ?, ?>>(map);
+ this.mapReference = new WeakReference<>(map);
}
@Override
diff --git a/guava/src/com/google/common/collect/Maps.java b/guava/src/com/google/common/collect/Maps.java
index 8fa916030..fe0c59403 100644
--- a/guava/src/com/google/common/collect/Maps.java
+++ b/guava/src/com/google/common/collect/Maps.java
@@ -688,7 +688,7 @@ public final class Maps {
static <V extends @Nullable Object> ValueDifference<V> create(
@ParametricNullness V left, @ParametricNullness V right) {
- return new ValueDifferenceImpl<V>(left, right);
+ return new ValueDifferenceImpl<>(left, right);
}
private ValueDifferenceImpl(@ParametricNullness V left, @ParametricNullness V right) {
diff --git a/guava/src/com/google/common/collect/Multimaps.java b/guava/src/com/google/common/collect/Multimaps.java
index c158c6519..58d727010 100644
--- a/guava/src/com/google/common/collect/Multimaps.java
+++ b/guava/src/com/google/common/collect/Multimaps.java
@@ -1223,7 +1223,7 @@ public final class Multimaps {
@Override
public Set<V> removeAll(@CheckForNull Object key) {
- Set<V> values = new HashSet<V>(2);
+ Set<V> values = new HashSet<>(2);
if (!map.containsKey(key)) {
return values;
}
diff --git a/guava/src/com/google/common/collect/Multisets.java b/guava/src/com/google/common/collect/Multisets.java
index 303f5512f..1f73dc83a 100644
--- a/guava/src/com/google/common/collect/Multisets.java
+++ b/guava/src/com/google/common/collect/Multisets.java
@@ -106,7 +106,7 @@ public final class Multisets {
Multiset<E> result = (Multiset<E>) multiset;
return result;
}
- return new UnmodifiableMultiset<E>(checkNotNull(multiset));
+ return new UnmodifiableMultiset<>(checkNotNull(multiset));
}
/**
@@ -237,7 +237,7 @@ public final class Multisets {
public static <E extends @Nullable Object> SortedMultiset<E> unmodifiableSortedMultiset(
SortedMultiset<E> sortedMultiset) {
// it's in its own file so it can be emulated for GWT
- return new UnmodifiableSortedMultiset<E>(checkNotNull(sortedMultiset));
+ return new UnmodifiableSortedMultiset<>(checkNotNull(sortedMultiset));
}
/**
@@ -250,7 +250,7 @@ public final class Multisets {
*/
public static <E extends @Nullable Object> Multiset.Entry<E> immutableEntry(
@ParametricNullness E e, int n) {
- return new ImmutableEntry<E>(e, n);
+ return new ImmutableEntry<>(e, n);
}
static class ImmutableEntry<E extends @Nullable Object> extends AbstractEntry<E>
@@ -314,10 +314,10 @@ public final class Multisets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredMultiset<E> filtered = (FilteredMultiset<E>) unfiltered;
- Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
- return new FilteredMultiset<E>(filtered.unfiltered, combinedPredicate);
+ Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
+ return new FilteredMultiset<>(filtered.unfiltered, combinedPredicate);
}
- return new FilteredMultiset<E>(unfiltered, predicate);
+ return new FilteredMultiset<>(unfiltered, predicate);
}
private static final class FilteredMultiset<E extends @Nullable Object> extends ViewMultiset<E> {
@@ -1065,7 +1065,7 @@ public final class Multisets {
/** An implementation of {@link Multiset#iterator}. */
static <E extends @Nullable Object> Iterator<E> iteratorImpl(Multiset<E> multiset) {
- return new MultisetIteratorImpl<E>(multiset, multiset.entrySet().iterator());
+ return new MultisetIteratorImpl<>(multiset, multiset.entrySet().iterator());
}
static final class MultisetIteratorImpl<E extends @Nullable Object> implements Iterator<E> {
diff --git a/guava/src/com/google/common/collect/MutableClassToInstanceMap.java b/guava/src/com/google/common/collect/MutableClassToInstanceMap.java
index 637749179..1759eb6c3 100644
--- a/guava/src/com/google/common/collect/MutableClassToInstanceMap.java
+++ b/guava/src/com/google/common/collect/MutableClassToInstanceMap.java
@@ -59,7 +59,7 @@ public final class MutableClassToInstanceMap<B extends @Nullable Object>
* default initial capacity and load factor.
*/
public static <B extends @Nullable Object> MutableClassToInstanceMap<B> create() {
- return new MutableClassToInstanceMap<B>(new HashMap<Class<? extends @NonNull B>, B>());
+ return new MutableClassToInstanceMap<>(new HashMap<Class<? extends @NonNull B>, B>());
}
/**
@@ -69,7 +69,7 @@ public final class MutableClassToInstanceMap<B extends @Nullable Object>
*/
public static <B extends @Nullable Object> MutableClassToInstanceMap<B> create(
Map<Class<? extends @NonNull B>, B> backingMap) {
- return new MutableClassToInstanceMap<B>(backingMap);
+ return new MutableClassToInstanceMap<>(backingMap);
}
private final Map<Class<? extends @NonNull B>, B> delegate;
diff --git a/guava/src/com/google/common/collect/Ordering.java b/guava/src/com/google/common/collect/Ordering.java
index f3c0744d5..8568caee5 100644
--- a/guava/src/com/google/common/collect/Ordering.java
+++ b/guava/src/com/google/common/collect/Ordering.java
@@ -224,7 +224,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
// TODO(kevinb): provide replacement
@GwtCompatible(serializable = true)
public static <T> Ordering<T> explicit(List<T> valuesInOrder) {
- return new ExplicitOrdering<T>(valuesInOrder);
+ return new ExplicitOrdering<>(valuesInOrder);
}
/**
@@ -411,7 +411,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
// Ordering<String> o = Ordering.<String>natural().reverse();
@GwtCompatible(serializable = true)
public <S extends T> Ordering<S> reverse() {
- return new ReverseOrdering<S>(this);
+ return new ReverseOrdering<>(this);
}
/**
@@ -484,7 +484,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
*/
@GwtCompatible(serializable = true)
public <U extends T> Ordering<U> compound(Comparator<? super U> secondaryComparator) {
- return new CompoundOrdering<U>(this, checkNotNull(secondaryComparator));
+ return new CompoundOrdering<>(this, checkNotNull(secondaryComparator));
}
/**
@@ -511,7 +511,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
@GwtCompatible(serializable = true)
public static <T extends @Nullable Object> Ordering<T> compound(
Iterable<? extends Comparator<? super T>> comparators) {
- return new CompoundOrdering<T>(comparators);
+ return new CompoundOrdering<>(comparators);
}
/**
diff --git a/guava/src/com/google/common/collect/Queues.java b/guava/src/com/google/common/collect/Queues.java
index b5dbff9b2..0123b531e 100644
--- a/guava/src/com/google/common/collect/Queues.java
+++ b/guava/src/com/google/common/collect/Queues.java
@@ -55,7 +55,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // ArrayBlockingQueue
public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(int capacity) {
- return new ArrayBlockingQueue<E>(capacity);
+ return new ArrayBlockingQueue<>(capacity);
}
// ArrayDeque
@@ -66,7 +66,7 @@ public final class Queues {
* @since 12.0
*/
public static <E> ArrayDeque<E> newArrayDeque() {
- return new ArrayDeque<E>();
+ return new ArrayDeque<>();
}
/**
@@ -77,9 +77,9 @@ public final class Queues {
*/
public static <E> ArrayDeque<E> newArrayDeque(Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new ArrayDeque<E>((Collection<? extends E>) elements);
+ return new ArrayDeque<>((Collection<? extends E>) elements);
}
- ArrayDeque<E> deque = new ArrayDeque<E>();
+ ArrayDeque<E> deque = new ArrayDeque<>();
Iterables.addAll(deque, elements);
return deque;
}
@@ -90,7 +90,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // ConcurrentLinkedQueue
public static <E> ConcurrentLinkedQueue<E> newConcurrentLinkedQueue() {
- return new ConcurrentLinkedQueue<E>();
+ return new ConcurrentLinkedQueue<>();
}
/**
@@ -102,9 +102,9 @@ public final class Queues {
public static <E> ConcurrentLinkedQueue<E> newConcurrentLinkedQueue(
Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new ConcurrentLinkedQueue<E>((Collection<? extends E>) elements);
+ return new ConcurrentLinkedQueue<>((Collection<? extends E>) elements);
}
- ConcurrentLinkedQueue<E> queue = new ConcurrentLinkedQueue<E>();
+ ConcurrentLinkedQueue<E> queue = new ConcurrentLinkedQueue<>();
Iterables.addAll(queue, elements);
return queue;
}
@@ -119,7 +119,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // LinkedBlockingDeque
public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque() {
- return new LinkedBlockingDeque<E>();
+ return new LinkedBlockingDeque<>();
}
/**
@@ -131,7 +131,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // LinkedBlockingDeque
public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque(int capacity) {
- return new LinkedBlockingDeque<E>(capacity);
+ return new LinkedBlockingDeque<>(capacity);
}
/**
@@ -145,9 +145,9 @@ public final class Queues {
@GwtIncompatible // LinkedBlockingDeque
public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque(Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new LinkedBlockingDeque<E>((Collection<? extends E>) elements);
+ return new LinkedBlockingDeque<>((Collection<? extends E>) elements);
}
- LinkedBlockingDeque<E> deque = new LinkedBlockingDeque<E>();
+ LinkedBlockingDeque<E> deque = new LinkedBlockingDeque<>();
Iterables.addAll(deque, elements);
return deque;
}
@@ -158,7 +158,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // LinkedBlockingQueue
public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue() {
- return new LinkedBlockingQueue<E>();
+ return new LinkedBlockingQueue<>();
}
/**
@@ -169,7 +169,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // LinkedBlockingQueue
public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(int capacity) {
- return new LinkedBlockingQueue<E>(capacity);
+ return new LinkedBlockingQueue<>(capacity);
}
/**
@@ -184,9 +184,9 @@ public final class Queues {
@GwtIncompatible // LinkedBlockingQueue
public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new LinkedBlockingQueue<E>((Collection<? extends E>) elements);
+ return new LinkedBlockingQueue<>((Collection<? extends E>) elements);
}
- LinkedBlockingQueue<E> queue = new LinkedBlockingQueue<E>();
+ LinkedBlockingQueue<E> queue = new LinkedBlockingQueue<>();
Iterables.addAll(queue, elements);
return queue;
}
@@ -206,7 +206,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // PriorityBlockingQueue
public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue() {
- return new PriorityBlockingQueue<E>();
+ return new PriorityBlockingQueue<>();
}
/**
@@ -224,9 +224,9 @@ public final class Queues {
public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue(
Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new PriorityBlockingQueue<E>((Collection<? extends E>) elements);
+ return new PriorityBlockingQueue<>((Collection<? extends E>) elements);
}
- PriorityBlockingQueue<E> queue = new PriorityBlockingQueue<E>();
+ PriorityBlockingQueue<E> queue = new PriorityBlockingQueue<>();
Iterables.addAll(queue, elements);
return queue;
}
@@ -242,7 +242,7 @@ public final class Queues {
*/
@SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
public static <E extends Comparable> PriorityQueue<E> newPriorityQueue() {
- return new PriorityQueue<E>();
+ return new PriorityQueue<>();
}
/**
@@ -258,9 +258,9 @@ public final class Queues {
public static <E extends Comparable> PriorityQueue<E> newPriorityQueue(
Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new PriorityQueue<E>((Collection<? extends E>) elements);
+ return new PriorityQueue<>((Collection<? extends E>) elements);
}
- PriorityQueue<E> queue = new PriorityQueue<E>();
+ PriorityQueue<E> queue = new PriorityQueue<>();
Iterables.addAll(queue, elements);
return queue;
}
@@ -271,7 +271,7 @@ public final class Queues {
@J2ktIncompatible
@GwtIncompatible // SynchronousQueue
public static <E> SynchronousQueue<E> newSynchronousQueue() {
- return new SynchronousQueue<E>();
+ return new SynchronousQueue<>();
}
/**
diff --git a/guava/src/com/google/common/collect/RegularImmutableMultiset.java b/guava/src/com/google/common/collect/RegularImmutableMultiset.java
index 8b50345b3..2c88df437 100644
--- a/guava/src/com/google/common/collect/RegularImmutableMultiset.java
+++ b/guava/src/com/google/common/collect/RegularImmutableMultiset.java
@@ -73,7 +73,7 @@ class RegularImmutableMultiset<E> extends ImmutableMultiset<E> {
newEntry =
canReuseEntry ? (ImmutableEntry<E>) entry : new ImmutableEntry<E>(element, count);
} else {
- newEntry = new NonTerminalEntry<E>(element, count, bucketHead);
+ newEntry = new NonTerminalEntry<>(element, count, bucketHead);
}
hashCode += hash ^ count;
entryArray[index++] = newEntry;
@@ -184,7 +184,7 @@ class RegularImmutableMultiset<E> extends ImmutableMultiset<E> {
@Override
public ImmutableSet<E> elementSet() {
ImmutableSet<E> result = elementSet;
- return (result == null) ? elementSet = new ElementSet<E>(Arrays.asList(entries), this) : result;
+ return (result == null) ? elementSet = new ElementSet<>(Arrays.asList(entries), this) : result;
}
@Override
diff --git a/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java b/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java
index ea146b1be..832508e1d 100644
--- a/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java
+++ b/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java
@@ -125,7 +125,7 @@ final class RegularImmutableSortedMultiset<E> extends ImmutableSortedMultiset<E>
return this;
} else {
RegularImmutableSortedSet<E> subElementSet = elementSet.getSubSet(from, to);
- return new RegularImmutableSortedMultiset<E>(
+ return new RegularImmutableSortedMultiset<>(
subElementSet, cumulativeCounts, offset + from, to - from);
}
}
diff --git a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java
index 970e85112..8fb5e6f69 100644
--- a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java
+++ b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java
@@ -297,7 +297,7 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
if (newFromIndex == 0 && newToIndex == size()) {
return this;
} else if (newFromIndex < newToIndex) {
- return new RegularImmutableSortedSet<E>(
+ return new RegularImmutableSortedSet<>(
elements.subList(newFromIndex, newToIndex), comparator);
} else {
return emptySet(comparator);
diff --git a/guava/src/com/google/common/collect/Sets.java b/guava/src/com/google/common/collect/Sets.java
index 3f0aa8d31..386633f97 100644
--- a/guava/src/com/google/common/collect/Sets.java
+++ b/guava/src/com/google/common/collect/Sets.java
@@ -180,7 +180,7 @@ public final class Sets {
* href="http://goo.gl/iz2Wi">"diamond" syntax</a>.
*/
public static <E extends @Nullable Object> HashSet<E> newHashSet() {
- return new HashSet<E>();
+ return new HashSet<>();
}
/**
@@ -259,7 +259,7 @@ public final class Sets {
*/
public static <E extends @Nullable Object> HashSet<E> newHashSetWithExpectedSize(
int expectedSize) {
- return new HashSet<E>(Maps.capacity(expectedSize));
+ return new HashSet<>(Maps.capacity(expectedSize));
}
/**
@@ -309,7 +309,7 @@ public final class Sets {
* @return a new, empty {@code LinkedHashSet}
*/
public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSet() {
- return new LinkedHashSet<E>();
+ return new LinkedHashSet<>();
}
/**
@@ -330,7 +330,7 @@ public final class Sets {
public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSet(
Iterable<? extends E> elements) {
if (elements instanceof Collection) {
- return new LinkedHashSet<E>((Collection<? extends E>) elements);
+ return new LinkedHashSet<>((Collection<? extends E>) elements);
}
LinkedHashSet<E> set = newLinkedHashSet();
Iterables.addAll(set, elements);
@@ -351,7 +351,7 @@ public final class Sets {
*/
public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSetWithExpectedSize(
int expectedSize) {
- return new LinkedHashSet<E>(Maps.capacity(expectedSize));
+ return new LinkedHashSet<>(Maps.capacity(expectedSize));
}
// TreeSet
@@ -370,7 +370,7 @@ public final class Sets {
*/
@SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
public static <E extends Comparable> TreeSet<E> newTreeSet() {
- return new TreeSet<E>();
+ return new TreeSet<>();
}
/**
@@ -419,7 +419,7 @@ public final class Sets {
*/
public static <E extends @Nullable Object> TreeSet<E> newTreeSet(
Comparator<? super E> comparator) {
- return new TreeSet<E>(checkNotNull(comparator));
+ return new TreeSet<>(checkNotNull(comparator));
}
/**
@@ -447,7 +447,7 @@ public final class Sets {
@J2ktIncompatible
@GwtIncompatible // CopyOnWriteArraySet
public static <E extends @Nullable Object> CopyOnWriteArraySet<E> newCopyOnWriteArraySet() {
- return new CopyOnWriteArraySet<E>();
+ return new CopyOnWriteArraySet<>();
}
/**
@@ -467,7 +467,7 @@ public final class Sets {
(elements instanceof Collection)
? (Collection<? extends E>) elements
: Lists.newArrayList(elements);
- return new CopyOnWriteArraySet<E>(elementsCollection);
+ return new CopyOnWriteArraySet<>(elementsCollection);
}
/**
@@ -1058,11 +1058,11 @@ public final class Sets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredSet<E> filtered = (FilteredSet<E>) unfiltered;
- Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
- return new FilteredSet<E>((Set<E>) filtered.unfiltered, combinedPredicate);
+ Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
+ return new FilteredSet<>((Set<E>) filtered.unfiltered, combinedPredicate);
}
- return new FilteredSet<E>(checkNotNull(unfiltered), checkNotNull(predicate));
+ return new FilteredSet<>(checkNotNull(unfiltered), checkNotNull(predicate));
}
/**
@@ -1095,11 +1095,11 @@ public final class Sets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredSet<E> filtered = (FilteredSet<E>) unfiltered;
- Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
- return new FilteredSortedSet<E>((SortedSet<E>) filtered.unfiltered, combinedPredicate);
+ Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
+ return new FilteredSortedSet<>((SortedSet<E>) filtered.unfiltered, combinedPredicate);
}
- return new FilteredSortedSet<E>(checkNotNull(unfiltered), checkNotNull(predicate));
+ return new FilteredSortedSet<>(checkNotNull(unfiltered), checkNotNull(predicate));
}
/**
@@ -1133,11 +1133,11 @@ public final class Sets {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredSet<E> filtered = (FilteredSet<E>) unfiltered;
- Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
- return new FilteredNavigableSet<E>((NavigableSet<E>) filtered.unfiltered, combinedPredicate);
+ Predicate<E> combinedPredicate = Predicates.and(filtered.predicate, predicate);
+ return new FilteredNavigableSet<>((NavigableSet<E>) filtered.unfiltered, combinedPredicate);
}
- return new FilteredNavigableSet<E>(checkNotNull(unfiltered), checkNotNull(predicate));
+ return new FilteredNavigableSet<>(checkNotNull(unfiltered), checkNotNull(predicate));
}
private static class FilteredSet<E extends @Nullable Object> extends FilteredCollection<E>
@@ -1172,18 +1172,18 @@ public final class Sets {
@Override
public SortedSet<E> subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) {
- return new FilteredSortedSet<E>(
+ return new FilteredSortedSet<>(
((SortedSet<E>) unfiltered).subSet(fromElement, toElement), predicate);
}
@Override
public SortedSet<E> headSet(@ParametricNullness E toElement) {
- return new FilteredSortedSet<E>(((SortedSet<E>) unfiltered).headSet(toElement), predicate);
+ return new FilteredSortedSet<>(((SortedSet<E>) unfiltered).headSet(toElement), predicate);
}
@Override
public SortedSet<E> tailSet(@ParametricNullness E fromElement) {
- return new FilteredSortedSet<E>(((SortedSet<E>) unfiltered).tailSet(fromElement), predicate);
+ return new FilteredSortedSet<>(((SortedSet<E>) unfiltered).tailSet(fromElement), predicate);
}
@Override
@@ -1613,7 +1613,7 @@ public final class Sets {
return new AbstractIndexedListIterator<Set<E>>(size()) {
@Override
protected Set<E> get(final int setBits) {
- return new SubSet<E>(inputSet, setBits);
+ return new SubSet<>(inputSet, setBits);
}
};
}
@@ -1825,7 +1825,7 @@ public final class Sets {
if (set instanceof ImmutableCollection || set instanceof UnmodifiableNavigableSet) {
return set;
}
- return new UnmodifiableNavigableSet<E>(set);
+ return new UnmodifiableNavigableSet<>(set);
}
static final class UnmodifiableNavigableSet<E extends @Nullable Object>
@@ -1907,7 +1907,7 @@ public final class Sets {
public NavigableSet<E> descendingSet() {
UnmodifiableNavigableSet<E> result = descendingSet;
if (result == null) {
- result = descendingSet = new UnmodifiableNavigableSet<E>(delegate.descendingSet());
+ result = descendingSet = new UnmodifiableNavigableSet<>(delegate.descendingSet());
result.descendingSet = this;
}
return result;
diff --git a/guava/src/com/google/common/collect/Synchronized.java b/guava/src/com/google/common/collect/Synchronized.java
index a8ad336b0..26fbd034d 100644
--- a/guava/src/com/google/common/collect/Synchronized.java
+++ b/guava/src/com/google/common/collect/Synchronized.java
@@ -120,7 +120,7 @@ final class Synchronized {
private static <E extends @Nullable Object> Collection<E> collection(
Collection<E> collection, @CheckForNull Object mutex) {
- return new SynchronizedCollection<E>(collection, mutex);
+ return new SynchronizedCollection<>(collection, mutex);
}
@VisibleForTesting
@@ -266,7 +266,7 @@ final class Synchronized {
@VisibleForTesting
static <E extends @Nullable Object> Set<E> set(Set<E> set, @CheckForNull Object mutex) {
- return new SynchronizedSet<E>(set, mutex);
+ return new SynchronizedSet<>(set, mutex);
}
static class SynchronizedSet<E extends @Nullable Object> extends SynchronizedCollection<E>
@@ -303,7 +303,7 @@ final class Synchronized {
private static <E extends @Nullable Object> SortedSet<E> sortedSet(
SortedSet<E> set, @CheckForNull Object mutex) {
- return new SynchronizedSortedSet<E>(set, mutex);
+ return new SynchronizedSortedSet<>(set, mutex);
}
static class SynchronizedSortedSet<E extends @Nullable Object> extends SynchronizedSet<E>
@@ -495,7 +495,7 @@ final class Synchronized {
if (multiset instanceof SynchronizedMultiset || multiset instanceof ImmutableMultiset) {
return multiset;
}
- return new SynchronizedMultiset<E>(multiset, mutex);
+ return new SynchronizedMultiset<>(multiset, mutex);
}
static final class SynchronizedMultiset<E extends @Nullable Object>
@@ -1596,7 +1596,7 @@ final class Synchronized {
@GwtIncompatible // NavigableSet
static <E extends @Nullable Object> NavigableSet<E> navigableSet(
NavigableSet<E> navigableSet, @CheckForNull Object mutex) {
- return new SynchronizedNavigableSet<E>(navigableSet, mutex);
+ return new SynchronizedNavigableSet<>(navigableSet, mutex);
}
@GwtIncompatible // NavigableSet
@@ -1928,7 +1928,7 @@ final class Synchronized {
}
static <E extends @Nullable Object> Deque<E> deque(Deque<E> deque, @CheckForNull Object mutex) {
- return new SynchronizedDeque<E>(deque, mutex);
+ return new SynchronizedDeque<>(deque, mutex);
}
static final class SynchronizedDeque<E extends @Nullable Object> extends SynchronizedQueue<E>
diff --git a/guava/src/com/google/common/collect/TopKSelector.java b/guava/src/com/google/common/collect/TopKSelector.java
index 89c5fc51f..24d7679af 100644
--- a/guava/src/com/google/common/collect/TopKSelector.java
+++ b/guava/src/com/google/common/collect/TopKSelector.java
@@ -77,7 +77,7 @@ final class TopKSelector<
*/
public static <T extends @Nullable Object> TopKSelector<T> least(
int k, Comparator<? super T> comparator) {
- return new TopKSelector<T>(comparator, k);
+ return new TopKSelector<>(comparator, k);
}
/**
@@ -99,7 +99,7 @@ final class TopKSelector<
*/
public static <T extends @Nullable Object> TopKSelector<T> greatest(
int k, Comparator<? super T> comparator) {
- return new TopKSelector<T>(Ordering.from(comparator).reverse(), k);
+ return new TopKSelector<>(Ordering.from(comparator).reverse(), k);
}
private final int k;
diff --git a/guava/src/com/google/common/collect/TreeMultiset.java b/guava/src/com/google/common/collect/TreeMultiset.java
index acd7f8fb1..e918cd6cf 100644
--- a/guava/src/com/google/common/collect/TreeMultiset.java
+++ b/guava/src/com/google/common/collect/TreeMultiset.java
@@ -77,7 +77,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
*/
@SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
public static <E extends Comparable> TreeMultiset<E> create() {
- return new TreeMultiset<E>(Ordering.natural());
+ return new TreeMultiset<>(Ordering.natural());
}
/**
@@ -268,7 +268,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
AvlNode<E> root = rootReference.get();
if (root == null) {
int unused = comparator().compare(element, element);
- AvlNode<E> newRoot = new AvlNode<E>(element, occurrences);
+ AvlNode<E> newRoot = new AvlNode<>(element, occurrences);
successor(header, newRoot, header);
rootReference.checkAndSet(root, newRoot);
return 0;
@@ -551,7 +551,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
@Override
public SortedMultiset<E> headMultiset(@ParametricNullness E upperBound, BoundType boundType) {
- return new TreeMultiset<E>(
+ return new TreeMultiset<>(
rootReference,
range.intersect(GeneralRange.upTo(comparator(), upperBound, boundType)),
header);
@@ -559,7 +559,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
@Override
public SortedMultiset<E> tailMultiset(@ParametricNullness E lowerBound, BoundType boundType) {
- return new TreeMultiset<E>(
+ return new TreeMultiset<>(
rootReference,
range.intersect(GeneralRange.downTo(comparator(), lowerBound, boundType)),
header);
@@ -659,7 +659,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
}
private AvlNode<E> addRightChild(@ParametricNullness E e, int count) {
- right = new AvlNode<E>(e, count);
+ right = new AvlNode<>(e, count);
successor(this, right, succ());
height = Math.max(2, height);
distinctElements++;
@@ -668,7 +668,7 @@ public final class TreeMultiset<E extends @Nullable Object> extends AbstractSort
}
private AvlNode<E> addLeftChild(@ParametricNullness E e, int count) {
- left = new AvlNode<E>(e, count);
+ left = new AvlNode<>(e, count);
successor(pred(), left, this);
height = Math.max(2, height);
distinctElements++;
diff --git a/guava/src/com/google/common/collect/TreeTraverser.java b/guava/src/com/google/common/collect/TreeTraverser.java
index c0baeec8c..007e143d4 100644
--- a/guava/src/com/google/common/collect/TreeTraverser.java
+++ b/guava/src/com/google/common/collect/TreeTraverser.java
@@ -240,7 +240,7 @@ public abstract class TreeTraverser<T> {
}
private PostOrderNode<T> expand(T t) {
- return new PostOrderNode<T>(t, children(t).iterator());
+ return new PostOrderNode<>(t, children(t).iterator());
}
}
@@ -270,7 +270,7 @@ public abstract class TreeTraverser<T> {
private final Queue<T> queue;
BreadthFirstIterator(T root) {
- this.queue = new ArrayDeque<T>();
+ this.queue = new ArrayDeque<>();
queue.add(root);
}
diff --git a/guava/src/com/google/common/graph/Graphs.java b/guava/src/com/google/common/graph/Graphs.java
index f998869fe..ae473bedd 100644
--- a/guava/src/com/google/common/graph/Graphs.java
+++ b/guava/src/com/google/common/graph/Graphs.java
@@ -167,7 +167,7 @@ public final class Graphs extends GraphsBridgeMethods {
} else {
// An optimization for the undirected case: for every node B reachable from node A,
// node A and node B have the same reachability set.
- Set<N> visitedNodes = new HashSet<N>();
+ Set<N> visitedNodes = new HashSet<>();
for (N node : graph.nodes()) {
if (!visitedNodes.contains(node)) {
Set<N> reachableNodes = reachableNodes(graph, node);
@@ -219,7 +219,7 @@ public final class Graphs extends GraphsBridgeMethods {
return ((TransposedGraph<N>) graph).graph;
}
- return new TransposedGraph<N>(graph);
+ return new TransposedGraph<>(graph);
}
/**
diff --git a/guava/src/com/google/common/hash/BloomFilter.java b/guava/src/com/google/common/hash/BloomFilter.java
index fb0542f89..d9a1c53be 100644
--- a/guava/src/com/google/common/hash/BloomFilter.java
+++ b/guava/src/com/google/common/hash/BloomFilter.java
@@ -139,7 +139,7 @@ public final class BloomFilter<T extends @Nullable Object> implements Predicate<
* @since 12.0
*/
public BloomFilter<T> copy() {
- return new BloomFilter<T>(bits.copy(), numHashFunctions, funnel, strategy);
+ return new BloomFilter<>(bits.copy(), numHashFunctions, funnel, strategy);
}
/**
@@ -436,7 +436,7 @@ public final class BloomFilter<T extends @Nullable Object> implements Predicate<
long numBits = optimalNumOfBits(expectedInsertions, fpp);
int numHashFunctions = optimalNumOfHashFunctions(expectedInsertions, numBits);
try {
- return new BloomFilter<T>(new LockFreeBitArray(numBits), numHashFunctions, funnel, strategy);
+ return new BloomFilter<>(new LockFreeBitArray(numBits), numHashFunctions, funnel, strategy);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Could not create BloomFilter of " + numBits + " bits", e);
}
@@ -621,7 +621,7 @@ public final class BloomFilter<T extends @Nullable Object> implements Predicate<
dataArray.putData(i, din.readLong());
}
- return new BloomFilter<T>(dataArray, numHashFunctions, funnel, strategy);
+ return new BloomFilter<>(dataArray, numHashFunctions, funnel, strategy);
} catch (IOException e) {
throw e;
} catch (Exception e) { // sneaky checked exception
diff --git a/guava/src/com/google/common/util/concurrent/AbstractFuture.java b/guava/src/com/google/common/util/concurrent/AbstractFuture.java
index 244c1c8f9..96ecda5f5 100644
--- a/guava/src/com/google/common/util/concurrent/AbstractFuture.java
+++ b/guava/src/com/google/common/util/concurrent/AbstractFuture.java
@@ -860,7 +860,7 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna
}
return false;
}
- SetFuture<V> valueToSet = new SetFuture<V>(this, future);
+ SetFuture<V> valueToSet = new SetFuture<>(this, future);
if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
// the listener is responsible for calling completeWithFuture, directExecutor is appropriate
// since all we are doing is unpacking a completed future which should be fast.
diff --git a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
index 4ede5d606..eaed5145e 100644
--- a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
+++ b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
@@ -70,7 +70,7 @@ public final class AtomicLongMap<K> implements Serializable {
/** Creates an {@code AtomicLongMap}. */
public static <K> AtomicLongMap<K> create() {
- return new AtomicLongMap<K>(new ConcurrentHashMap<>());
+ return new AtomicLongMap<>(new ConcurrentHashMap<>());
}
/** Creates an {@code AtomicLongMap} with the same mappings as the specified {@code Map}. */
diff --git a/guava/src/com/google/common/util/concurrent/ClosingFuture.java b/guava/src/com/google/common/util/concurrent/ClosingFuture.java
index 9a32af4ab..9efe79384 100644
--- a/guava/src/com/google/common/util/concurrent/ClosingFuture.java
+++ b/guava/src/com/google/common/util/concurrent/ClosingFuture.java
@@ -410,7 +410,7 @@ public final class ClosingFuture<V extends @Nullable Object> {
* when the pipeline is done, use {@link #submit(ClosingCallable, Executor)} instead.
*/
public static <V extends @Nullable Object> ClosingFuture<V> from(ListenableFuture<V> future) {
- return new ClosingFuture<V>(future);
+ return new ClosingFuture<>(future);
}
/**
diff --git a/guava/src/com/google/common/util/concurrent/Futures.java b/guava/src/com/google/common/util/concurrent/Futures.java
index e4e8afc88..b2040e888 100644
--- a/guava/src/com/google/common/util/concurrent/Futures.java
+++ b/guava/src/com/google/common/util/concurrent/Futures.java
@@ -163,7 +163,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
public static <V extends @Nullable Object> ListenableFuture<V> immediateFailedFuture(
Throwable throwable) {
checkNotNull(throwable);
- return new ImmediateFailedFuture<V>(throwable);
+ return new ImmediateFailedFuture<>(throwable);
}
/**
@@ -619,7 +619,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
@SafeVarargs
public static <V extends @Nullable Object> FutureCombiner<V> whenAllComplete(
ListenableFuture<? extends V>... futures) {
- return new FutureCombiner<V>(false, ImmutableList.copyOf(futures));
+ return new FutureCombiner<>(false, ImmutableList.copyOf(futures));
}
/**
@@ -632,7 +632,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
*/
public static <V extends @Nullable Object> FutureCombiner<V> whenAllComplete(
Iterable<? extends ListenableFuture<? extends V>> futures) {
- return new FutureCombiner<V>(false, ImmutableList.copyOf(futures));
+ return new FutureCombiner<>(false, ImmutableList.copyOf(futures));
}
/**
@@ -645,7 +645,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
@SafeVarargs
public static <V extends @Nullable Object> FutureCombiner<V> whenAllSucceed(
ListenableFuture<? extends V>... futures) {
- return new FutureCombiner<V>(true, ImmutableList.copyOf(futures));
+ return new FutureCombiner<>(true, ImmutableList.copyOf(futures));
}
/**
@@ -657,7 +657,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
*/
public static <V extends @Nullable Object> FutureCombiner<V> whenAllSucceed(
Iterable<? extends ListenableFuture<? extends V>> futures) {
- return new FutureCombiner<V>(true, ImmutableList.copyOf(futures));
+ return new FutureCombiner<>(true, ImmutableList.copyOf(futures));
}
/**
@@ -719,7 +719,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
*/
public <C extends @Nullable Object> ListenableFuture<C> callAsync(
AsyncCallable<C> combiner, Executor executor) {
- return new CombinedFuture<C>(futures, allMustSucceed, executor, combiner);
+ return new CombinedFuture<>(futures, allMustSucceed, executor, combiner);
}
/**
@@ -744,7 +744,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
*/
public <C extends @Nullable Object> ListenableFuture<C> call(
Callable<C> combiner, Executor executor) {
- return new CombinedFuture<C>(futures, allMustSucceed, executor, combiner);
+ return new CombinedFuture<>(futures, allMustSucceed, executor, combiner);
}
/**
diff --git a/guava/src/com/google/common/util/concurrent/MoreExecutors.java b/guava/src/com/google/common/util/concurrent/MoreExecutors.java
index 46536fbe7..c6fc1b199 100644
--- a/guava/src/com/google/common/util/concurrent/MoreExecutors.java
+++ b/guava/src/com/google/common/util/concurrent/MoreExecutors.java
@@ -671,7 +671,7 @@ public final class MoreExecutors {
Callable<V> callable, long delay, TimeUnit unit) {
TrustedListenableFutureTask<V> task = TrustedListenableFutureTask.create(callable);
ScheduledFuture<?> scheduled = delegate.schedule(task, delay, unit);
- return new ListenableScheduledTask<V>(task, scheduled);
+ return new ListenableScheduledTask<>(task, scheduled);
}
@Override