void () { final TreeBasedMap<String> map = new TreeBasedMap<>(Interner.createStringInterner(), '/'); map.put("", "ValueEmpty"); map.put("aaa/bbb/ccc", "ValueAAABBBCCC"); map.put("aaa/bbb/ddd", "ValueAAABBBDDD"); map.put("aaa/bbb", "ValueAAABBB"); map.put("aaa/bb/cc", "ValueAAABBCC"); map.put("aaa/bb/dd", "ValueAAABBDD"); map.put("aaa/b/c", "ValueAAABC"); final Iterator<String> iterator = map.getKeysIterator(); Map<String, String> checkMap = new HashMap<>(); while (iterator.hasNext()) { final String key = iterator.next(); checkMap.put(key, map.get(key)); } assertEquals(7, checkMap.size()); final Set<String> checkMapKeys = checkMap.keySet(); assertTrue(checkMapKeys.contains("")); assertTrue(checkMapKeys.contains("aaa/bbb/ccc")); assertTrue(checkMapKeys.contains("aaa/bbb/ddd")); assertTrue(checkMapKeys.contains("aaa/bbb")); assertTrue(checkMapKeys.contains("aaa/bb/cc")); assertTrue(checkMapKeys.contains("aaa/bb/dd")); assertTrue(checkMapKeys.contains("aaa/b/c")); assertFalse(checkMapKeys.contains("aaa/B/c")); assertFalse(checkMapKeys.contains("aa/b/c")); assertEquals("ValueEmpty", checkMap.get("")); assertEquals("ValueAAABBBCCC", checkMap.get("aaa/bbb/ccc")); assertEquals("ValueAAABBBDDD", checkMap.get("aaa/bbb/ddd")); assertEquals("ValueAAABBB", checkMap.get("aaa/bbb")); assertEquals("ValueAAABBCC", checkMap.get("aaa/bb/cc")); assertEquals("ValueAAABBDD", checkMap.get("aaa/bb/dd")); assertEquals("ValueAAABC", checkMap.get("aaa/b/c")); }