Last active
September 20, 2015 09:09
-
-
Save lucastanziano/917cde0f868ec2f97e79 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
public class InstrumentedSet<E> extends ForwardingSet<E> { | |
private int addCount = 0; | |
public InstrumentedSet(Set<E> s) { | |
super(s); | |
} | |
@Override | |
public boolean add(E e) { | |
addCount++; | |
return super.add(e); | |
} | |
@Override | |
public boolean addAll(Collection<? extends E> c) { | |
addCount += c.size(); | |
return super.addAll(c); | |
} | |
public int getAddCount() { | |
return addCount; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment