Package opennlp.tools.util
Class StringList
java.lang.Object
opennlp.tools.util.StringList
A
StringList
is an immutable list of String
s.-
Constructor Summary
ConstructorDescriptionStringList
(String singleToken) Initializes aStringList
instance.StringList
(String... tokens) Initializes aStringList
instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
compareToIgnoreCase
(StringList tokens) Compares totoken list
and ignores the case of the tokens.boolean
getToken
(int index) int
hashCode()
iterator()
int
size()
toString()
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
StringList
Initializes aStringList
instance.Note:
Token String will be replaced by identical internal String object.- Parameters:
singleToken
- One single token
-
StringList
Initializes aStringList
instance.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 Details
-
getToken
- 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.
-
iterator
-
compareToIgnoreCase
Compares totoken list
and ignores the case of the tokens. Note: This can cause problems with some locales.- Parameters:
tokens
- Thetokens
used for comparison.- Returns:
true
if identically with ignore the case,false
otherwise.
-
hashCode
public int hashCode() -
equals
-
toString
-