public T getElement(final T key) {
    // validate key
    if (key == null) {
      throw new IllegalArgumentException("Null element is not supported.");
    }
    // find element
    final int hashCode = key.hashCode();
    final int index = getIndex(hashCode);
    return getContainedElem(index, key, hashCode);
  }
@Test
  public void testGetElement() {
    LightWeightHashSet<TestObject> objSet = new LightWeightHashSet<TestObject>();
    TestObject objA = new TestObject("object A");
    TestObject equalToObjA = new TestObject("object A");
    TestObject objB = new TestObject("object B");
    objSet.add(objA);
    objSet.add(objB);
    
    assertSame(objA, objSet.getElement(objA));
    assertSame(objA, objSet.getElement(equalToObjA));
    assertSame(objB, objSet.getElement(objB));
    assertNull(objSet.getElement(new TestObject("not in set")));
  }