DefaultLeveledEmbededSet implements LeveledEmbededSet<T> { @Override public Set<T> getCurrentSet() { Set<T> result = Sets.newHashSet(); Lock lock = readWriteLock.readLock(); try { lock.lock(); if(getSubSet() != null) { result.addAll(getSubSet().getCurrentSet()); } result.addAll(localHoldings); } catch (Exception e) { logger.error("[getCurrentSet]", e); } finally { lock.unlock(); } return result; }  @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 getCurrentSet() { root.add("hello"); root.getThrough(1).getThrough(2).add("world"); Assert.assertEquals(Sets.newHashSet("hello", "world"), root.getCurrentSet()); Assert.assertEquals(Sets.newHashSet("world"), root.getSubSet().getCurrentSet()); Assert.assertEquals(Sets.newHashSet("world"), root.getSubSet().getSubSet().getCurrentSet()); }