aboutsummaryrefslogtreecommitdiff
path: root/android/guava/src/com/google/common/collect/Sets.java
diff options
context:
space:
mode:
Diffstat (limited to 'android/guava/src/com/google/common/collect/Sets.java')
-rw-r--r--android/guava/src/com/google/common/collect/Sets.java48
1 files changed, 24 insertions, 24 deletions
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;