com.google.common.collect
Class ForwardingSet<E>
java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingCollection<E>
com.google.common.collect.ForwardingSet<E>
- All Implemented Interfaces:
- Serializable, Iterable<E>, Collection<E>, Set<E>
- Direct Known Subclasses:
- ForwardingSortedSet
public abstract class ForwardingSet<E>
- extends ForwardingCollection<E>
- implements Set<E>
A set which forwards all its method calls to another set. Subclasses should
override one or more methods to modify the behavior of the backing set as
desired per the decorator pattern.
- Author:
- Kevin Bourrillion
- See Also:
ForwardingObject,
Serialized Form
|
Constructor Summary |
protected |
ForwardingSet(Set<E> delegate)
Constructs a forwarding set that forwards to the provided delegate. |
| Methods inherited from class com.google.common.collect.ForwardingCollection |
add, addAll, clear, contains, containsAll, containsAllImpl, containsImpl, isEmpty, iterator, remove, removeAll, removeAllImpl, removeImpl, retainAll, retainAllImpl, size, toArray, toArray, toArrayImpl, toArrayImpl, toStringImpl |
| Methods inherited from interface java.util.Set |
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
ForwardingSet
protected ForwardingSet(Set<E> delegate)
- Constructs a forwarding set that forwards to the provided delegate.
delegate
protected Set<E> delegate()
- Description copied from class:
ForwardingObject
- Returns the backing delegate object. This method should be overridden to
specify the correct return type. For example:
@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.
- Overrides:
delegate in class ForwardingCollection<E>
equals
public boolean equals(Object obj)
- Specified by:
equals in interface Collection<E>- Specified by:
equals in interface Set<E>- Overrides:
equals in class Object
hashCode
public int hashCode()
- Specified by:
hashCode in interface Collection<E>- Specified by:
hashCode in interface Set<E>- Overrides:
hashCode in class Object