Package adams.core

Class Trie.TrieIterator

  • All Implemented Interfaces:
    Iterator<String>
    Enclosing class:
    Trie

    public static class Trie.TrieIterator
    extends Object
    implements Iterator<String>
    Represents an iterator over a trie
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • m_LastLeaf

        protected Trie.TrieNode m_LastLeaf
        the last leaf for this root node
      • m_CurrentLeaf

        protected Trie.TrieNode m_CurrentLeaf
        the current leaf node
    • Constructor Detail

      • TrieIterator

        public TrieIterator​(Trie.TrieNode node)
        initializes the iterator
        Parameters:
        node - the node to use as root
    • Method Detail

      • hasNext

        public boolean hasNext()
        Returns true if the iteration has more elements.
        Specified by:
        hasNext in interface Iterator<String>
        Returns:
        true if there is at least one more element
      • next

        public String next()
        Returns the next element in the iteration.
        Specified by:
        next in interface Iterator<String>
        Returns:
        the next element