SparseSet implements Set<String> { @Override public boolean add(String item) { if (contains(item)) { return true; } else { setPattern(getPattern() + " +" + item); return false; } } SparseSet(String pattern);  SparseSet(); String getPattern(); void setPattern(String pattern); @Override boolean add(String item); @Override boolean addAll(Collection<? extends String> collection); @Override void clear(); @Override boolean contains(Object item); @Override boolean containsAll(Collection<?> collection); @Override boolean isEmpty(); @Override Iterator<String> iterator(); @Override boolean remove(Object item); @Override boolean removeAll(Collection<?> collection); @Override boolean retainAll(Collection<?> collection); @Override int size(); @Override Object[] toArray(); @Override T[] toArray(T[] array); @Override boolean equals(Object object); @Override int hashCode(); @Override String toString();  }
@Test public void add_contains_returns() { assertEquals(true, (new SparseSet("+a -a/b")).add("a")); }
@Test public void add_nocontains_returns() { assertEquals(false, (new SparseSet("+a")).add("b")); }