|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingCollection<E>
public abstract class ForwardingCollection<E>
A collection which forwards all its method calls to another collection. Subclasses should override one or more methods to modify the behavior of the backing collection as desired per the decorator pattern.
ForwardingObject
,
Serialized FormConstructor Summary | |
---|---|
protected |
ForwardingCollection(Collection<E> delegate)
Constructs a forwarding collection that forwards to the provided delegate. |
Method Summary | ||
---|---|---|
boolean |
add(E element)
|
|
boolean |
addAll(Collection<? extends E> collection)
|
|
void |
clear()
|
|
boolean |
contains(Object object)
|
|
boolean |
containsAll(Collection<?> collection)
|
|
protected static boolean |
containsAllImpl(Collection<?> c,
Collection<?> d)
Returns true if the specified collection c contains all of the
elements in the specified collection d . |
|
protected static boolean |
containsImpl(Collection<?> c,
Object o)
Returns true if the specified collection c contains the element
o . |
|
protected Collection<E> |
delegate()
Returns the backing delegate object. |
|
boolean |
isEmpty()
|
|
Iterator<E> |
iterator()
|
|
boolean |
remove(Object object)
|
|
boolean |
removeAll(Collection<?> collection)
|
|
protected static boolean |
removeAllImpl(Collection<?> c,
Collection<?> d)
Removes from the specified collection c all of its elements that
are contained in the specified collection d (optional operation). |
|
protected static boolean |
removeImpl(Collection<?> c,
Object o)
Removes from the specified collection c the specified element
o (optional operation). |
|
boolean |
retainAll(Collection<?> c)
|
|
protected static boolean |
retainAllImpl(Collection<?> c,
Collection<?> d)
Retains only the elements in the specified collection c that are
contained in the specified collection d (optional operation). |
|
int |
size()
|
|
Object[] |
toArray()
|
|
|
toArray(T[] array)
|
|
protected static Object[] |
toArrayImpl(Collection<?> c)
Returns an array containing all of the elements in the specified collection. |
|
protected static
|
toArrayImpl(Collection<?> c,
T[] array)
Returns an array containing all of the elements in the specified collection; the runtime type of the returned array is that of the specified array. |
|
protected static String |
toStringImpl(Collection<?> c)
Returns a string representation of the specified collection. |
Methods inherited from class com.google.common.collect.ForwardingObject |
---|
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 |
Constructor Detail |
---|
protected ForwardingCollection(Collection<E> delegate)
Method Detail |
---|
protected Collection<E> delegate()
ForwardingObject
@SuppressWarnings("unchecked") @Override protected Foo delegate() { return (Foo) super.delegate(); }This method should always return the same delegate instance that was passed to the constructor.
delegate
in class ForwardingObject
public Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
public int size()
size
in interface Collection<E>
public boolean removeAll(Collection<?> collection)
removeAll
in interface Collection<E>
public boolean isEmpty()
isEmpty
in interface Collection<E>
public boolean contains(Object object)
contains
in interface Collection<E>
public Object[] toArray()
toArray
in interface Collection<E>
public <T> T[] toArray(T[] array)
toArray
in interface Collection<E>
public boolean add(E element)
add
in interface Collection<E>
public boolean remove(Object object)
remove
in interface Collection<E>
public boolean containsAll(Collection<?> collection)
containsAll
in interface Collection<E>
public boolean addAll(Collection<? extends E> collection)
addAll
in interface Collection<E>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<E>
public void clear()
clear
in interface Collection<E>
protected static Object[] toArrayImpl(Collection<?> c)
c
- the collection for which to return an array of elementsAbstractCollection.toArray()
protected static <T> T[] toArrayImpl(Collection<?> c, T[] array)
If the collection fits in the specified array with room to spare (i.e., the array has more elements than the collection), the element in the array immediately following the end of the collection is set to null. This is useful in determining the length of the collection only if the caller knows that the collection does not contain any null elements.
This method returns the elements in the order they are returned by the collection's iterator.
c
- the collection for which to return an array of elementsarray
- the array into which elements of the collection are to be
stored, if it is big enough; otherwise a new array of the same runtime type
is allocated for this purpose
ArrayStoreException
- if the runtime type of the specified array is
not a supertype of the runtime type of every element in the specified
collectionAbstractCollection.toArray(Object[])
protected static String toStringImpl(Collection<?> c)
String.valueOf(Object)
.
c
- the collection for which to return a string representationAbstractCollection.toString()
protected static boolean containsImpl(Collection<?> c, @Nullable Object o)
c
contains the element
o
.
This method iterates over the specified collection c
, checking
each element returned by the iterator in turn to see if it equals the
provided object o
. If any element is equal, true is returned,
otherwise false is returned.
c
- a collection which might contain the element.o
- an element that might be contained by c
protected static boolean containsAllImpl(Collection<?> c, Collection<?> d)
c
contains all of the
elements in the specified collection d
.
This method iterates over the specified collection d
, checking
each element returned by the iterator in turn to see if it is contained in
the specified collection c
. If all elements are so contained, true
is returned, otherwise false.
c
- a collection which might contain all elements in d
d
- a collection whose elements might be contained by c
AbstractCollection.containsAll(Collection)
protected static boolean removeImpl(Collection<?> c, @Nullable Object o)
c
the specified element
o
(optional operation).
This method iterates over the collection c
, checking each
element returned by the iterator in turn to see if it equal to the provided
element o
. If they are equal, it is removed from the collection
c
with the iterator's remove
method
c
- the collection from which to removeo
- an element to remove from the collectoin
c
changed as a result
UnsupportedOperationException
- if c
's iterator does not
support the remove
method and c
contains one or more
elements in common with d
protected static boolean removeAllImpl(Collection<?> c, Collection<?> d)
c
all of its elements that
are contained in the specified collection d
(optional operation).
This method iterates over the collection c
, checking each
element returned by the iterator in turn to see if it is contained in the
collection d
. If it is so contained, it is removed from the
collection c
with the iterator's remove
method.
c
- the collection from which to removed
- a collection of elements to remove from collection c
c
changed as a result
UnsupportedOperationException
- if c
's iterator does not
support the remove
method and c
contains one or more
elements in common with d
AbstractCollection.removeAll(Collection)
protected static boolean retainAllImpl(Collection<?> c, Collection<?> d)
c
that are
contained in the specified collection d
(optional operation). In
other words, removes from the collection c
all of its elements that
are not contained in the collection d
.
This implementation iterates over the collection c
, checking
each element returned by the iterator in turn to see if it is contained in
the collection d
. If it is not so contained, it is removed from the
collection c
with the iterator's remove
method.
c
- the collection from which to removed
- a collection of elements to retain in collection c
c
changed as a result
UnsupportedOperationException
- if c
's iterator does not
support the remove
method and c
contains one or more
elements not present in the d
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |