diff options
Diffstat (limited to 'guava-gwt/src-super/com/google/common/collect')
5 files changed, 13 insertions, 9 deletions
diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java index ee93d9b1f..93fc4bd24 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java @@ -22,9 +22,9 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.io.Serializable; import java.util.AbstractCollection; import java.util.Collection; -import java.util.Collections; import java.util.Iterator; import java.util.Spliterator; +import java.util.function.Predicate; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,9 +37,6 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple static final int SPLITERATOR_CHARACTERISTICS = Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED; - static final ImmutableCollection<Object> EMPTY_IMMUTABLE_COLLECTION = - new ForwardingImmutableCollection<Object>(Collections.emptyList()); - ImmutableCollection() {} public abstract UnmodifiableIterator<E> iterator(); @@ -64,6 +61,10 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple throw new UnsupportedOperationException(); } + public final boolean removeIf(Predicate<? super E> predicate) { + throw new UnsupportedOperationException(); + } + public final boolean retainAll(Collection<?> elementsToKeep) { throw new UnsupportedOperationException(); } diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java index 6fddbedc9..e9d8705ff 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java @@ -40,8 +40,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; @SuppressWarnings("serial") // we're overriding default serialization public abstract class ImmutableList<E> extends ImmutableCollection<E> implements List<E>, RandomAccess { - static final ImmutableList<Object> EMPTY = - new RegularImmutableList<Object>(Collections.emptyList()); ImmutableList() {} @@ -52,7 +50,7 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E> // Casting to any type is safe because the list will never hold any elements. @SuppressWarnings("unchecked") public static <E> ImmutableList<E> of() { - return (ImmutableList<E>) EMPTY; + return (ImmutableList<E>) RegularImmutableList.EMPTY; } public static <E> ImmutableList<E> of(E element) { diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java index 24063ac87..685e8ae17 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java @@ -50,7 +50,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Hayward Chan */ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { - static final ImmutableMap<Object, Object> EMPTY = new RegularImmutableMap<Object, Object>(); abstract static class IteratorBasedImmutableMap<K, V> extends ImmutableMap<K, V> { abstract UnmodifiableIterator<Entry<K, V>> entryIterator(); @@ -92,7 +91,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } public static <K, V> ImmutableMap<K, V> of() { - return (ImmutableMap<K, V>) EMPTY; + return (ImmutableMap<K, V>) RegularImmutableMap.EMPTY; } public static <K, V> ImmutableMap<K, V> of(K k1, V v1) { diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableList.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableList.java index cf00b78bb..f547d469b 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableList.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableList.java @@ -16,6 +16,7 @@ package com.google.common.collect; +import static java.util.Collections.emptyList; import static java.util.Collections.unmodifiableList; import java.util.List; @@ -26,6 +27,9 @@ import java.util.List; * @author Hayward Chan */ class RegularImmutableList<E> extends ForwardingImmutableList<E> { + + static final ImmutableList<Object> EMPTY = new RegularImmutableList<Object>(emptyList()); + private final List<E> delegate; E forSerialization; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java index 988537114..e00ee4133 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java @@ -25,6 +25,8 @@ import java.util.Map; */ final class RegularImmutableMap<K, V> extends ForwardingImmutableMap<K, V> { + static final ImmutableMap<Object, Object> EMPTY = new RegularImmutableMap<Object, Object>(); + RegularImmutableMap(Map<? extends K, ? extends V> delegate) { super(delegate); } |