Class SimpleWordList

    • Constructor Detail

      • SimpleWordList

        public SimpleWordList​(@NonNull
                              @NonNull Collection<String> words)
        Instantiates a new Simple word list.
        Parameters:
        words - the words
    • Method Detail

      • read

        public static WordList read​(Resource resource)
                             throws IOException

        Reads the word list from the given resource where each term is on its own line and "#" represents comments.

        Note that convention states that if the first line of a word list is a comment stating "case-insensitive" then loading of that word list will result in all words being lower-cased.

        Parameters:
        resource - the resource
        Returns:
        the word list
        Throws:
        IOException - the io exception
      • contains

        public boolean contains​(String string)
        Description copied from interface: WordList
        Is the String contained in the WordList
        Specified by:
        contains in interface WordList
        Parameters:
        string - the string to lookup
        Returns:
        True if the string is in the WordList, False otherwise
      • size

        public int size()
        Description copied from interface: WordList
        Number of words in the list
        Specified by:
        size in interface WordList
        Returns:
        the number of words in the list