for (i = 0; i < node.getChildCount(); i++) { result.append(toString((TrieNode) node.getChildAt(i)));
for (i = 0; i < node.getChildCount(); i++) { result.append(toString((TrieNode) node.getChildAt(i)));
/** * Removes a suffix from the trie. * * @param suffix the suffix to remove * @return true if this trie changed as a result of the call */ public boolean remove(String suffix) { boolean result; Character c; String newSuffix; TrieNode child; c = suffix.charAt(0); newSuffix = suffix.substring(1); child = m_Children.get(c); if (child == null) { result = false; } else if (newSuffix.length() == 0) { remove(c); result = true; } else { result = child.remove(newSuffix); if (child.getChildCount() == 0) { remove(child.getChar()); } } return result; }
/** * Removes a suffix from the trie. * * @param suffix the suffix to remove * @return true if this trie changed as a result of the call */ public boolean remove(String suffix) { boolean result; Character c; String newSuffix; TrieNode child; c = suffix.charAt(0); newSuffix = suffix.substring(1); child = m_Children.get(c); if (child == null) { result = false; } else if (newSuffix.length() == 0) { remove(c); result = true; } else { result = child.remove(newSuffix); if (child.getChildCount() == 0) { remove(child.getChar()); } } return result; }
/** * Returns true if this collection contains no elements. * * @return true if empty */ @Override public boolean isEmpty() { return (m_Root.getChildCount() == 0); }
/** * Returns true if this collection contains no elements. * * @return true if empty */ @Override public boolean isEmpty() { return (m_Root.getChildCount() == 0); }