DynamicSizeTrieURLPatternMapper extends BaseTrieURLPatternMapper<T> { @Override protected void put(String urlPattern, T value, boolean wildcard) { TrieNode previousTrieNode = null; if (wildcard) { previousTrieNode = _wildCardTrieNode; } else { previousTrieNode = _extensionTrieNode; } TrieNode currentTrieNode = null; for (int i = 0; i < urlPattern.length(); ++i) { int index = i; if (!wildcard) { index = urlPattern.length() - 1 - i; } currentTrieNode = previousTrieNode.getNextTrieNode( urlPattern.charAt(index)); if (Objects.isNull(currentTrieNode)) { TrieNode nextTrieNode = _trieNodeHeap.nextAvailableTrieNode(); currentTrieNode = previousTrieNode.setNextTrieNode( urlPattern.charAt(index), nextTrieNode); } previousTrieNode = currentTrieNode; } currentTrieNode.setValue(value); } DynamicSizeTrieURLPatternMapper(Map<String, T> values);   }
@Test public void testConstructor() { Map<String, String> map = new HashMap<>(); for (int i = 0; i < 1024; i++) { map.put("*.key" + i, "value" + i); } URLPatternMapper<String> urlPatternMapper = createURLPatternMapper(map); for (int i = 0; i < 1024; i++) { Assert.assertEquals( "value" + i, urlPatternMapper.getValue("*.key" + i)); } }