
javadoc.com.google.common.collect.ImmutableCollection.html Maven / Gradle / Ivy
The newest version!
ImmutableCollection (Guava: Google Core Libraries for Java 11.0.1 API)
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
com.google.common.collect
Class ImmutableCollection<E>
java.lang.Object
com.google.common.collect.ImmutableCollection<E>
- All Implemented Interfaces:
- Serializable, Iterable<E>, Collection<E>
- Direct Known Subclasses:
- ImmutableList, ImmutableMultiset, ImmutableSet
@GwtCompatible(emulated=true)
public abstract class ImmutableCollection<E>
- extends Object
- implements Collection<E>, Serializable
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.
- Since:
- 2.0 (imported from Google Collections Library)
- Author:
- Jesse Wilson
- See Also:
- Serialized Form
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 |
---|
iterator
public abstract UnmodifiableIterator<E> iterator()
- Returns an unmodifiable iterator across the elements in this collection.
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<E>
toArray
public <T> T[] toArray(T[] other)
- Specified by:
toArray
in interfaceCollection<E>
contains
public boolean contains(@Nullable Object object)
- Specified by:
contains
in interfaceCollection<E>
containsAll
public boolean containsAll(Collection<?> targets)
- Specified by:
containsAll
in interfaceCollection<E>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<E>
toString
public String toString()
add
public final boolean add(E e)
- Guaranteed to throw an exception and leave the collection unmodified.
- Specified by:
add
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- always
remove
public final boolean remove(Object object)
- Guaranteed to throw an exception and leave the collection unmodified.
- Specified by:
remove
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- always
addAll
public final boolean addAll(Collection<? extends E> newElements)
- Guaranteed to throw an exception and leave the collection unmodified.
- Specified by:
addAll
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- always
removeAll
public final boolean removeAll(Collection<?> oldElements)
- Guaranteed to throw an exception and leave the collection unmodified.
- Specified by:
removeAll
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- always
retainAll
public final boolean retainAll(Collection<?> elementsToKeep)
- Guaranteed to throw an exception and leave the collection unmodified.
- Specified by:
retainAll
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- always
clear
public final void clear()
- Guaranteed to throw an exception and leave the collection unmodified.
- Specified by:
clear
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- always
asList
public ImmutableList<E> asList()
- Returns a list view of the collection.
- Since:
- 2.0
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010-2012. All Rights Reserved.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy