aboutsummaryrefslogtreecommitdiffstats
path: root/guava/src/com/google/common/collect/EmptyImmutableSet.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava/src/com/google/common/collect/EmptyImmutableSet.java')
-rw-r--r--guava/src/com/google/common/collect/EmptyImmutableSet.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/guava/src/com/google/common/collect/EmptyImmutableSet.java b/guava/src/com/google/common/collect/EmptyImmutableSet.java
index e70b051..8722bdf 100644
--- a/guava/src/com/google/common/collect/EmptyImmutableSet.java
+++ b/guava/src/com/google/common/collect/EmptyImmutableSet.java
@@ -25,7 +25,7 @@ import javax.annotation.Nullable;
/**
* An empty immutable set.
- *
+ *
* @author Kevin Bourrillion
*/
@GwtCompatible(serializable = true, emulated = true)
@@ -43,14 +43,10 @@ final class EmptyImmutableSet extends ImmutableSet<Object> {
return true;
}
- @Override public boolean contains(@Nullable Object target) {
+ @Override public boolean contains(Object target) {
return false;
}
- @Override public boolean containsAll(Collection<?> targets) {
- return targets.isEmpty();
- }
-
@Override public UnmodifiableIterator<Object> iterator() {
return Iterators.emptyIterator();
}
@@ -59,17 +55,21 @@ final class EmptyImmutableSet extends ImmutableSet<Object> {
return false;
}
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+
@Override public Object[] toArray() {
- return ObjectArrays.EMPTY_ARRAY;
+ return EMPTY_ARRAY;
}
@Override public <T> T[] toArray(T[] a) {
- return asList().toArray(a);
+ if (a.length > 0) {
+ a[0] = null;
+ }
+ return a;
}
- @Override
- public ImmutableList<Object> asList() {
- return ImmutableList.of();
+ @Override public boolean containsAll(Collection<?> targets) {
+ return targets.isEmpty();
}
@Override public boolean equals(@Nullable Object object) {