name.panitz.eliza
Class ListUtil

java.lang.Object
  extended by name.panitz.eliza.ListUtil

public class ListUtil
extends java.lang.Object

Collection of static methods handling special kinds of lists.


Constructor Summary
ListUtil()
           
 
Method Summary
static boolean isPrefixIgnoreCaseOf(Li<java.lang.String> pref, Li<java.lang.String> other)
          Tests if first list of Strings is a prefix of the other list of Strings.
static Li<java.lang.String> words(java.lang.String s)
          Produces a list of the words within a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListUtil

public ListUtil()
Method Detail

words

public static Li<java.lang.String> words(java.lang.String s)
Produces a list of the words within a String. The String is splitted at whitespace characters. The words in the result list will not contain any whitespace characters. Example: words("this is a test") produces the list: ("this","is","a","test")

Parameters:
s - the string, which is to be splitted into words
Returns:
a list of Strings, which are the words of the input.

isPrefixIgnoreCaseOf

public static boolean isPrefixIgnoreCaseOf(Li<java.lang.String> pref,
                                           Li<java.lang.String> other)
Tests if first list of Strings is a prefix of the other list of Strings. The lists are supposed to be list of strings. The test is to be made case insensetive. example: ("tHIs","is") is prefix of ("this","iS","a","test") if cases are ignored.

Parameters:
pref - the prefix List of Strings
other - the List of Strings, which is tested ,if it extends pref List of Strings.
Returns:
true, if pref list prefixes the other list.