Skip to content

Instantly share code, notes, and snippets.

@lucastanziano
Last active September 20, 2015 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucastanziano/917cde0f868ec2f97e79 to your computer and use it in GitHub Desktop.
Save lucastanziano/917cde0f868ec2f97e79 to your computer and use it in GitHub Desktop.
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