Created
December 18, 2019 10:00
-
-
Save ayushprashar/ff7b3d52170c317779be528b7fc3f522 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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