Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: Remove Dead Code from PathTrie #33280

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions server/src/main/java/org/elasticsearch/common/path/PathTrie.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,12 @@ public void updateKeyWithNamedWildcard(String key) {
namedWildcard = key.substring(key.indexOf('{') + 1, key.indexOf('}'));
}

public boolean isWildcard() {
return isWildcard;
}

public synchronized void addChild(TrieNode child) {
addInnerChild(child.key, child);
}

private void addInnerChild(String key, TrieNode child) {
Map<String, TrieNode> newChildren = new HashMap<>(children);
newChildren.put(key, child);
children = unmodifiableMap(newChildren);
}

public TrieNode getChild(String key) {
return children.get(key);
}

public synchronized void insert(String[] path, int index, T value) {
if (index >= path.length)
return;
Expand Down Expand Up @@ -302,7 +290,7 @@ public void insert(String path, T value) {
}
int index = 0;
// Supports initial delimiter.
if (strings.length > 0 && strings[0].isEmpty()) {
if (strings[0].isEmpty()) {
index = 1;
}
root.insert(strings, index, value);
Expand All @@ -327,7 +315,7 @@ public void insertOrUpdate(String path, T value, BiFunction<T, T, T> updater) {
}
int index = 0;
// Supports initial delimiter.
if (strings.length > 0 && strings[0].isEmpty()) {
if (strings[0].isEmpty()) {
index = 1;
}
root.insertOrUpdate(strings, index, value, updater);
Expand All @@ -352,7 +340,7 @@ public T retrieve(String path, Map<String, String> params, TrieMatchingMode trie
int index = 0;

// Supports initial delimiter.
if (strings.length > 0 && strings[0].isEmpty()) {
if (strings[0].isEmpty()) {
index = 1;
}

Expand Down