Class StringSetTrie

Object
StringSetTrie

public class StringSetTrie extends Object
A Trie / Prefix Tree that stores Strings efficiently.
Author:
Owen Feehan
  • Constructor Details

    • StringSetTrie

      public StringSetTrie()
      Create with no elements.
    • StringSetTrie

      public StringSetTrie(Collection<String> collection)
      Create from existing collection.
      Parameters:
      collection - the collection to create from.
    • StringSetTrie

      public StringSetTrie(Stream<String> stream)
      Create from existing collection.
      Parameters:
      stream - the stream to create from.
  • Method Details

    • add

      public void add(String stringToAdd)
      Adds an string to the set.
      Parameters:
      stringToAdd - the string to add.
    • contains

      public boolean contains(String string)
      Does the set contain a particular string?
      Parameters:
      string - the string to check.
      Returns:
      true iff it is contained within the set.
    • isEmpty

      public boolean isEmpty()
      Does the set contain no elements?
      Returns:
      if the set contains zero elements.
    • values

      public Set<String> values()
      A view over the values in the set.
      Returns:
      the values, avoiding creating a new object via caching.