Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import java.util.*;
public class ForwardingSet<T> implements Set<T> {
private final Set<T> set;
ForwardingSet(Set<T> set) {
this.set = set;
public void clear() { set.clear();}
public boolean contains(Object o) { return set.contains(o); }
public int size() { return set.size(); }
public Iterator<T> iterator() { return set.iterator(); }
public boolean add(T t) { return set.add(t); }
public boolean addAll(Collection<? extends T> c){ return set.addAll(c); }
public boolean remove(Object o) { return set.remove(o); }
public boolean containsAll(Collection<?> c) { return set.containsAll(c); }
public boolean removeAll(Collection<?> c) { return set.removeAll(c); }
public boolean retainAll(Collection<?> c) { return set.retainAll(c); }
public Object[] toArray() { return set.toArray(); }
public <T> T[] toArray(T[] a) { return set.toArray(a); }
public boolean isEmpty() {return set.isEmpty();}
@Override public boolean equals(Object o) { return set.equals(o);}
@Override public int hashCode() { return set.hashCode(); }
@Override public String toString() { return set.toString(); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment