DefaultLeveledEmbededSet implements LeveledEmbededSet<T> { @Override public void remove(T t) { Lock lock = readWriteLock.writeLock(); try { lock.lock(); if(!this.localHoldings.remove(t) && getSubSet() != null) { getSubSet().remove(t); } } catch (Exception e) { logger.error("[remove]", e); } finally { lock.unlock(); } }  @Override LeveledEmbededSet<T> getSuperSet(); @Override LeveledEmbededSet<T> getSubSet(); @Override LeveledEmbededSet<T> getThrough(int level); @Override Set<T> getCurrentSet(); @Override void add(T t); @Override void remove(T t); @Override void resume(T t, int level); DefaultLeveledEmbededSet<T> setSuperSet(DefaultLeveledEmbededSet<T> superSet); DefaultLeveledEmbededSet<T> setSubSet(DefaultLeveledEmbededSet<T> subSet);  }
@Test public void remove() { root.add("hello"); Assert.assertEquals(Sets.newHashSet("hello"), root.getCurrentSet()); root.remove("hello"); Assert.assertEquals(Sets.newHashSet(), root.getCurrentSet()); root.getThrough(10).add("hello, world"); Assert.assertEquals(Sets.newHashSet("hello, world"), root.getCurrentSet()); for(int i = 0; i < 10; i++) { Assert.assertEquals(Sets.newHashSet("hello, world"), root.getThrough(i).getCurrentSet()); } root.getThrough(1).remove("hello, world"); Assert.assertEquals(Sets.newHashSet(), root.getCurrentSet()); }