Packages

case class Trie(valid: Boolean = false, children: Map[String, Trie] = Map()) extends Product with Serializable

Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Trie
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Trie(valid: Boolean = false, children: Map[String, Trie] = Map())

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def add(word: String, trie: Trie = this): Trie

    Add a word to a Trie.

    Add a word to a Trie.

    word

    - The word to add to the Trie.

    trie

    - The Trie where the word is being added.

    returns

    A Trie with the additional word added.

  5. def addMany(words: Seq[String], trie: Trie = this): Trie

    Add multiple words to a given Trie.

    Add multiple words to a given Trie.

    words

    - Sequence of words to add to the Trie.

    trie

    - The Trie where the words will be added.

    returns

    A Trie with the additional words added.

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. val children: Map[String, Trie]
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. def getSuffixes(trie: Trie = this): Seq[String]

    DFS from a given Trie node to create a list of all suffixes that form valid words.

    DFS from a given Trie node to create a list of all suffixes that form valid words. Running this function from the root node of a Trie will yield all valid words in that Trie.

    trie

    - The current node to find all suffixes.

    returns

    List of all suffixes that form valid words for a given Trie.

  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. def productElementNames: Iterator[String]
    Definition Classes
    Product
  17. def remove(word: String, trie: Trie = this): (Boolean, Trie)

    Remove a given word from a Trie.

    Remove a given word from a Trie. If the word does not exist in the Trie, return the original Trie.

    word

    - The word to be removed from the Trie.

    trie

    - The Trie from which the word will be deleted.

    returns

    Boolean and Trie pair. If the boolean is false, the word does not exist in the Trie. If the boolean is true, the word was removed from the Trie.

  18. def removeMany(words: Seq[String], trie: Trie = this): (Seq[String], Trie)

    Remove multiple words from a Trie.

    Remove multiple words from a Trie. Return the updated Trie with words removed, along with a list of words that did not exist in the Trie.

    words

    - List of words to be removed from the Trie.

    trie

    - The Trie where words will be removed.

    returns

    List of words that were not removed from the Trie, and the updated Trie.

  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def traverse(prefix: String, trie: Trie = this): Option[Trie]

    Traverse a string, returning the Trie node of the last character in the string, if it exists in the Trie.

    Traverse a string, returning the Trie node of the last character in the string, if it exists in the Trie.

    prefix

    - The string to traverse.

    trie

    - The current node to search.

    returns

    The Trie node of the last character in the string, if it exists.

  21. val valid: Boolean
  22. def validPrefix(prefix: String, trie: Trie = this): Boolean

    Traverse a string, returning false if the string does not exist in the Trie.

    Traverse a string, returning false if the string does not exist in the Trie.

    prefix

    - The string to traverse.

    trie

    - The current node to begin the prefix search.

    returns

    True if the prefix exists in the Trie, false otherwise.

  23. def validWord(prefix: String, trie: Trie = this): Boolean

    Traverse a string, returning false if the string is not a valid word in the Trie.

    Traverse a string, returning false if the string is not a valid word in the Trie.

    prefix

    - The string to traverse.

    trie

    - The current node to begin the search.

    returns

    True if the prefix is a valid word, false otherwise.

  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped