public class SetDecorator<T> extends Object implements Set<T>, Serializable
Set
implementation that allows
subclasses to modify or extend the functionality of am existing Set
instance by overriding some of its methods. For example, a subclass could
enforce a size capacity on an existing set by overriding add
and
addAll
to not add elements beyond a certain number.
Instances of this class support all the optional operations supported by their contained set. All methods calls are passed through to the original set.
Subclasses must override methods of this class to change existing functionality.
Constructor and Description |
---|
SetDecorator(Set<T> set) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T e) |
boolean |
addAll(Collection<? extends T> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<E> E[] |
toArray(E[] a) |
String |
toString() |
public boolean add(T e)
public boolean addAll(Collection<? extends T> c)
public void clear()
public boolean contains(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<T>
containsAll
in interface Set<T>
public boolean equals(Object o)
public int hashCode()
public boolean isEmpty()
public boolean remove(Object o)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public int size()
public Object[] toArray()
public <E> E[] toArray(E[] a)
Copyright © 2012. All Rights Reserved.