|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.collect.ImmutableCollection<E>
@GwtCompatible(emulated=true) public abstract class ImmutableCollection<E>
An immutable collection. Does not permit null elements.
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.
Nested Class Summary | |
---|---|
static class |
ImmutableCollection.Builder<E>
Abstract base class for builders of ImmutableCollection types. |
Method Summary | ||
---|---|---|
boolean |
add(E e)
Guaranteed to throw an exception and leave the collection unmodified. |
|
boolean |
addAll(Collection<? extends E> newElements)
Guaranteed to throw an exception and leave the collection unmodified. |
|
ImmutableList<E> |
asList()
Returns a list view of the collection. |
|
void |
clear()
Guaranteed to throw an exception and leave the collection unmodified. |
|
boolean |
contains(Object object)
|
|
boolean |
containsAll(Collection<?> targets)
|
|
boolean |
isEmpty()
|
|
abstract UnmodifiableIterator<E> |
iterator()
Returns an unmodifiable iterator across the elements in this collection. |
|
boolean |
remove(Object object)
Guaranteed to throw an exception and leave the collection unmodified. |
|
boolean |
removeAll(Collection<?> oldElements)
Guaranteed to throw an exception and leave the collection unmodified. |
|
boolean |
retainAll(Collection<?> elementsToKeep)
Guaranteed to throw an exception and leave the collection unmodified. |
|
Object[] |
toArray()
|
|
|
toArray(T[] other)
|
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode, size |
Method Detail |
---|
public abstract UnmodifiableIterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
public Object[] toArray()
toArray
in interface Collection<E>
public <T> T[] toArray(T[] other)
toArray
in interface Collection<E>
public boolean contains(@Nullable Object object)
contains
in interface Collection<E>
public boolean containsAll(Collection<?> targets)
containsAll
in interface Collection<E>
public boolean isEmpty()
isEmpty
in interface Collection<E>
public String toString()
toString
in class Object
public final boolean add(E e)
add
in interface Collection<E>
UnsupportedOperationException
- alwayspublic final boolean remove(Object object)
remove
in interface Collection<E>
UnsupportedOperationException
- alwayspublic final boolean addAll(Collection<? extends E> newElements)
addAll
in interface Collection<E>
UnsupportedOperationException
- alwayspublic final boolean removeAll(Collection<?> oldElements)
removeAll
in interface Collection<E>
UnsupportedOperationException
- alwayspublic final boolean retainAll(Collection<?> elementsToKeep)
retainAll
in interface Collection<E>
UnsupportedOperationException
- alwayspublic final void clear()
clear
in interface Collection<E>
UnsupportedOperationException
- alwayspublic ImmutableList<E> asList()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |