@GwtCompatible(emulated=true) public abstract class ImmutableCollection<E> extends AbstractCollection<E> implements Serializable
In addition to the Collection methods, this class has an asList() method, which returns a list view of the collection's elements.
Note: Although this class is not final, it cannot be subclassed outside of this package as it has no public or protected constructors. Thus, instances of this type are guaranteed to be immutable.
| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableCollection.Builder<E>
Abstract base class for builders of
ImmutableCollection types. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Deprecated.
Unsupported operation.
|
boolean |
addAll(Collection<? extends E> newElements)
Deprecated.
Unsupported operation.
|
ImmutableList<E> |
asList()
Returns a list view of the collection.
|
void |
clear()
Deprecated.
Unsupported operation.
|
boolean |
contains(Object object) |
abstract UnmodifiableIterator<E> |
iterator()
Returns an unmodifiable iterator across the elements in this collection.
|
boolean |
remove(Object object)
Deprecated.
Unsupported operation.
|
boolean |
removeAll(Collection<?> oldElements)
Deprecated.
Unsupported operation.
|
boolean |
retainAll(Collection<?> elementsToKeep)
Deprecated.
Unsupported operation.
|
Object[] |
toArray() |
<T> T[] |
toArray(T[] other) |
containsAll, isEmpty, size, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCodepublic abstract UnmodifiableIterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in class AbstractCollection<E>public final Object[] toArray()
toArray in interface Collection<E>toArray in class AbstractCollection<E>public final <T> T[] toArray(T[] other)
toArray in interface Collection<E>toArray in class AbstractCollection<E>public boolean contains(@Nullable Object object)
contains in interface Collection<E>contains in class AbstractCollection<E>@Deprecated public final boolean add(E e)
add in interface Collection<E>add in class AbstractCollection<E>UnsupportedOperationException - always@Deprecated public final boolean remove(Object object)
remove in interface Collection<E>remove in class AbstractCollection<E>UnsupportedOperationException - always@Deprecated public final boolean addAll(Collection<? extends E> newElements)
addAll in interface Collection<E>addAll in class AbstractCollection<E>UnsupportedOperationException - always@Deprecated public final boolean removeAll(Collection<?> oldElements)
removeAll in interface Collection<E>removeAll in class AbstractCollection<E>UnsupportedOperationException - always@Deprecated public final boolean retainAll(Collection<?> elementsToKeep)
retainAll in interface Collection<E>retainAll in class AbstractCollection<E>UnsupportedOperationException - always@Deprecated public final void clear()
clear in interface Collection<E>clear in class AbstractCollection<E>UnsupportedOperationException - alwayspublic ImmutableList<E> asList()
Copyright © 2010-2013. All Rights Reserved.