@Test public void testGet() throws Exception { Assert.assertNull(tree.get(null)); Assert.assertNull(tree.get(new ArrayList<String>())); Assert.assertEquals("key1", tree.get(key1)); Assert.assertEquals(null, tree.get(key2)); Assert.assertEquals("key3", tree.get(key3)); Assert.assertEquals(null, tree.get(key4)); Assert.assertEquals("key5", tree.get(key5)); Assert.assertEquals(null, tree.get(key6)); Assert.assertEquals("key7", tree.get(key7)); Assert.assertEquals(null, tree.get(key8)); }
public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); }
SearchTree { public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); } }
SearchTree { public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); }  }
SearchTree { public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); }  V getValue(); void setValue(V value); V getDefaultChildrenValue(); void setDefaultChildrenValue(V defaultChildrenValue); V get(List<K> cascadingFactors); V first(List<K> cascadingFactors); void add(List<K> cascadingFactors, V value); void put(K childKey, SearchTree<K, V> searchTree); }
SearchTree { public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); }  V getValue(); void setValue(V value); V getDefaultChildrenValue(); void setDefaultChildrenValue(V defaultChildrenValue); V get(List<K> cascadingFactors); V first(List<K> cascadingFactors); void add(List<K> cascadingFactors, V value); void put(K childKey, SearchTree<K, V> searchTree);  }