Package opennlp.tools.util
Class StringList
- java.lang.Object
-
- opennlp.tools.util.StringList
-
-
Constructor Summary
Constructors Constructor Description StringList(String singleToken)Initializes aStringListinstance.StringList(String... tokens)Initializes aStringListinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompareToIgnoreCase(StringList tokens)Compares totoken listand ignores the case of the tokens.booleanequals(Object obj)StringgetToken(int index)inthashCode()Iterator<String>iterator()intsize()StringtoString()-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
StringList
public StringList(String singleToken)
Initializes aStringListinstance.Note:
Token String will be replaced by identical internal String object.- Parameters:
singleToken- One single token
-
StringList
public StringList(String... tokens)
Initializes aStringListinstance.Note:
Token Strings will be replaced by identical internal String object.- Parameters:
tokens- The string parts of the newStringList. Must not be an empty tokens array ornull.- Throws:
IllegalArgumentException- Thrown if parameters were invalid.
-
-
Method Detail
-
getToken
public String getToken(int index)
- Parameters:
index- The index to get a token from.- Returns:
- Retrieves a token from the given
index.
-
size
public int size()
- Returns:
- Retrieves the number of tokens inside this list.
-
compareToIgnoreCase
public boolean compareToIgnoreCase(StringList tokens)
Compares totoken listand ignores the case of the tokens. Note: This can cause problems with some locales.- Parameters:
tokens- Thetokensused for comparison.- Returns:
trueif identically with ignore the case,falseotherwise.
-
-