|
||||||||||
| 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 Form| Constructor Summary | |
|---|---|
protected |
ForwardingCollection(java.util.Collection<E> delegate)
Constructs a forwarding collection that forwards to the provided delegate. |
| Method Summary | ||
|---|---|---|
boolean |
add(E element)
|
|
boolean |
addAll(java.util.Collection<? extends E> collection)
|
|
void |
clear()
|
|
boolean |
contains(java.lang.Object object)
|
|
boolean |
containsAll(java.util.Collection<?> collection)
|
|
protected static boolean |
containsAllImpl(java.util.Collection<?> c,
java.util.Collection<?> d)
Returns true if the specified collection c contains all of the
elements in the specified collection d. |
|
protected static boolean |
containsImpl(java.util.Collection<?> c,
java.lang.Object o)
Returns true if the specified collection c contains the element
o. |
|
protected java.util.Collection<E> |
delegate()
Returns the backing delegate object. |
|
boolean |
isEmpty()
|
|
java.util.Iterator<E> |
iterator()
|
|
boolean |
remove(java.lang.Object object)
|
|
boolean |
removeAll(java.util.Collection<?> collection)
|
|
protected static boolean |
removeAllImpl(java.util.Collection<?> c,
java.util.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(java.util.Collection<?> c,
java.lang.Object o)
Removes from the specified collection c the specified element
o (optional operation). |
|
boolean |
retainAll(java.util.Collection<?> c)
|
|
protected static boolean |
retainAllImpl(java.util.Collection<?> c,
java.util.Collection<?> d)
Retains only the elements in the specified collection c that are
contained in the specified collection d (optional operation). |
|
int |
size()
|
|
java.lang.Object[] |
toArray()
|
|
|
toArray(T[] array)
|
|
protected static java.lang.Object[] |
toArrayImpl(java.util.Collection<?> c)
Returns an array containing all of the elements in the specified collection. |
|
protected static
|
toArrayImpl(java.util.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 java.lang.String |
toStringImpl(java.util.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(java.util.Collection<E> delegate)
| Method Detail |
|---|
protected java.util.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 ForwardingObjectpublic java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in interface java.util.Collection<E>public int size()
size in interface java.util.Collection<E>public boolean removeAll(java.util.Collection<?> collection)
removeAll in interface java.util.Collection<E>public boolean isEmpty()
isEmpty in interface java.util.Collection<E>public boolean contains(java.lang.Object object)
contains in interface java.util.Collection<E>public java.lang.Object[] toArray()
toArray in interface java.util.Collection<E>public <T> T[] toArray(T[] array)
toArray in interface java.util.Collection<E>public boolean add(E element)
add in interface java.util.Collection<E>public boolean remove(java.lang.Object object)
remove in interface java.util.Collection<E>public boolean containsAll(java.util.Collection<?> collection)
containsAll in interface java.util.Collection<E>public boolean addAll(java.util.Collection<? extends E> collection)
addAll in interface java.util.Collection<E>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<E>public void clear()
clear in interface java.util.Collection<E>protected static java.lang.Object[] toArrayImpl(java.util.Collection<?> c)
c - the collection for which to return an array of elementsAbstractCollection.toArray()
protected static <T> T[] toArrayImpl(java.util.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
java.lang.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 java.lang.String toStringImpl(java.util.Collection<?> c)
String.valueOf(Object).
c - the collection for which to return a string representationAbstractCollection.toString()
protected static boolean containsImpl(java.util.Collection<?> c,
@Nullable
java.lang.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(java.util.Collection<?> c,
java.util.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 dd - a collection whose elements might be contained by cAbstractCollection.containsAll(Collection)
protected static boolean removeImpl(java.util.Collection<?> c,
@Nullable
java.lang.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
java.lang.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(java.util.Collection<?> c,
java.util.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
java.lang.UnsupportedOperationException - if c's iterator does not
support the remove method and c contains one or more
elements in common with dAbstractCollection.removeAll(Collection)
protected static boolean retainAllImpl(java.util.Collection<?> c,
java.util.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
java.lang.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 | |||||||||