### Question:
LookupSet extends HashBase<T> implements Iterable<T> { public T getOrAdd(T key) { if (key == null) { throw new IllegalArgumentException("Key cannot be null."); } if (keyCount + removeCount == threshold) { expand(); } int loc = locate(key); if (loc >= 0) { return keys[loc]; } else { loc = -loc - 1; keys[loc] = key; keyCount++; return key; } } LookupSet();  LookupSet(int size); T set(T key); @SafeVarargs final void addAll(T... t); void addAll(Iterable<T> it); boolean add(T key); T getOrAdd(T key);  }### Answer:
@Test public void getOrAddTest() { Foo f1 = new Foo("abc", 1); Foo f2 = new Foo("abc", 2); LookupSet<Foo> fooSet = new LookupSet<>(); Assert.assertEquals(1, fooSet.getOrAdd(f1).b); Assert.assertEquals(1, fooSet.getOrAdd(f2).b); }
@Test public void removeTest() { Foo f1 = new Foo("abc", 1); Foo f2 = new Foo("abc", 2); LookupSet<Foo> fooSet = new LookupSet<>(); Assert.assertEquals(1, fooSet.getOrAdd(f1).b); Assert.assertEquals(1, fooSet.getOrAdd(f2).b); Assert.assertEquals(1, fooSet.remove(f2).b); Assert.assertEquals(2, fooSet.getOrAdd(f2).b); }