<commit_before>#summary Example Usage for Concurrent Radix Tree

Example Usage for Concurrent Radix Tree.
<wiki:toc max_depth="2" />

== General Usage ==
  * Create a concurrent radix tree
  * Insert keys "TEST", "TOAST", "TEAM", associate with integer values 1, 2, 3
  * Graphically print the structure of the tree
  * Find values for keys exactly matching "TEST", "TOAST"
  * Find keys starting with "T", "TE"
  * Find values for keys starting with "TE"
  * Find key-value pairs for keys starting with "TE"

=== Code ===
{{{
public static void main(String[] args) {
    RadixTree<Integer> tree = new ConcurrentRadixTree<Integer>(new DefaultCharArrayNodeFactory());

    tree.put("TEST", 1);
    tree.put("TOAST", 2);
    tree.put("TEAM", 3);

    System.out.println("Tree structure:");
    // PrettyPrintable is a non-public API for testing, prints semi-graphical representations of trees...
    PrettyPrintUtil.prettyPrint((PrettyPrintable)tree, System.out);

    System.out.println();
    System.out.println("Value for 'TEST' (exact match): " + tree.getValueForExactKey("TEST"));
    System.out.println("Value for 'TOAST' (exact match): " + tree.getValueForExactKey("TOAST"));
    System.out.println();
    System.out.println("Keys starting with 'T': " + tree.getKeysStartingWith("T"));
    System.out.println("Keys starting with 'TE': " + tree.getKeysStartingWith("TE"));
    System.out.println();
    System.out.println("Values for keys starting with 'TE': " + tree.getValuesForKeysStartingWith("TE"));
    System.out.println("Key-Value pairs for keys starting with 'TE': " + tree.getKeyValuePairsForKeysStartingWith("TE"));
}
}}}

=== Output ===
{{{
Tree structure:
○
└── ○ T
    ├── ○ E
    │   ├── ○ AM (3)
    │   └── ○ ST (1)
    └── ○ OAST (2)

Value for 'TEST' (exact match): 1
Value for 'TOAST' (exact match): 2

Keys starting with 'T': [TEAM, TEST, TOAST]
Keys starting with 'TE': [TEAM, TEST]

Values for keys starting with 'TE': [3, 1]
Key-Value pairs for keys starting with 'TE': [(TEAM, 3), (TEST, 1)]
}}}

== Adding Keys without Values ==
{{{
tree.put("FOO", VoidValue.SINGLETON);
}}}
Supplying [http://concurrent-trees.googlecode.com/svn/concurrent-trees/javadoc/apidocs/com/googlecode/concurrenttrees/radix/node/concrete/voidvalue/VoidValue.html VoidValue] as above, stores the key in the tree without associating it with any value.
<commit_msg>Updated example for lazy iteration-based APIs in 2.0.<commit_after>#summary Example Usage for Concurrent Radix Tree

Example Usage for Concurrent Radix Tree.
<wiki:toc max_depth="2" />

== General Usage ==
  * Create a concurrent radix tree
  * Insert keys "TEST", "TOAST", "TEAM", associate with integer values 1, 2, 3
  * Graphically print the structure of the tree
  * Find values for keys exactly matching "TEST", "TOAST"
  * Find keys starting with "T", "TE"
  * Find values for keys starting with "TE"
  * Find key-value pairs for keys starting with "TE"

=== Code ===
{{{
public static void main(String[] args) {
    RadixTree<Integer> tree = new ConcurrentRadixTree<Integer>(new DefaultCharArrayNodeFactory());

    tree.put("TEST", 1);
    tree.put("TOAST", 2);
    tree.put("TEAM", 3);

    System.out.println("Tree structure:");
    // PrettyPrintable is a non-public API for testing, prints semi-graphical representations of trees...
    PrettyPrintUtil.prettyPrint((PrettyPrintable)tree, System.out);

    System.out.println();
    System.out.println("Value for 'TEST' (exact match): " + tree.getValueForExactKey("TEST"));
    System.out.println("Value for 'TOAST' (exact match): " + tree.getValueForExactKey("TOAST"));
    System.out.println();
    System.out.println("Keys starting with 'T': " + Iterables.toString(tree.getKeysStartingWith("T")));
    System.out.println("Keys starting with 'TE': " + Iterables.toString(tree.getKeysStartingWith("TE")));
    System.out.println();
    System.out.println("Values for keys starting with 'TE': " + Iterables.toString(tree.getValuesForKeysStartingWith("TE")));
    System.out.println("Key-Value pairs for keys starting with 'TE': " + Iterables.toString(tree.getKeyValuePairsForKeysStartingWith("TE")));
}
}}}

=== Output ===
{{{
Tree structure:
○
└── ○ T
    ├── ○ E
    │   ├── ○ AM (3)
    │   └── ○ ST (1)
    └── ○ OAST (2)

Value for 'TEST' (exact match): 1
Value for 'TOAST' (exact match): 2

Keys starting with 'T': [TEAM, TEST, TOAST]
Keys starting with 'TE': [TEAM, TEST]

Values for keys starting with 'TE': [3, 1]
Key-Value pairs for keys starting with 'TE': [(TEAM, 3), (TEST, 1)]
}}}

== Adding Keys without Values ==
{{{
tree.put("FOO", VoidValue.SINGLETON);
}}}
Supplying [http://concurrent-trees.googlecode.com/svn/concurrent-trees/javadoc/apidocs/com/googlecode/concurrenttrees/radix/node/concrete/voidvalue/VoidValue.html VoidValue] as above, stores the key in the tree without associating it with any value.

{'fraction_non_alphanumeric': 0.1530696332921302, 'fraction_numerical': 0.007004532344458179, 'mean_word_length': 4.352811466372657, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4022142', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1539, 'n_words': 475}