Class IHashQueue<T extends IWord>


  • public class IHashQueue<T extends IWord>
    extends Object

    A normal queue base one single link but with hash index, so, it is fast for searching

    Currently build to replace the LinkList work pool of class org.lionsoul.jcseg.ASegment

    AT+Note: Not thread safe
    Author:
    chenxin
    • Constructor Detail

      • IHashQueue

        public IHashQueue()
    • Method Detail

      • add

        public boolean add​(T word)
        append a item from the tail
        Parameters:
        word -
        Returns:
        boolean
      • contains

        public boolean contains​(T word)
        check the specifield T is aleady exists in the queue or not
        Parameters:
        word -
        Returns:
        boolean
      • remove

        public T remove()
        remove the node from the head and you should make sure the size is larger than 0 by calling size() before you invoke the method or you will just get null.
      • size

        public int size()
        get the size of the queue
        Returns:
        int