Package opennlp.tools.util
Class StringList
- java.lang.Object
 - 
- opennlp.tools.util.StringList
 
 
- 
- All Implemented Interfaces:
 java.lang.Iterable<java.lang.String>
public class StringList extends java.lang.Object implements java.lang.Iterable<java.lang.String>TheStringListis an immutable list ofStrings. 
- 
- 
Constructor Summary
Constructors Constructor Description StringList(java.lang.String singleToken)Initializes the current instance.StringList(java.lang.String... tokens)Initializes the current instance. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompareToIgnoreCase(StringList tokens)Compares to tokens list and ignores the case of the tokens.booleanequals(java.lang.Object obj)java.lang.StringgetToken(int index)Retrieves a token from the given index.inthashCode()java.util.Iterator<java.lang.String>iterator()Retrieves anIteratorover all tokens.intsize()Retrieves the number of tokens inside this list.java.lang.StringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
StringList
public StringList(java.lang.String singleToken)
Initializes the current instance. Note:
Token String will be replaced by identical internal String object.- Parameters:
 singleToken- one single token
 
- 
StringList
public StringList(java.lang.String... tokens)
Initializes the current instance. Note:
Token Strings will be replaced by identical internal String object.- Parameters:
 tokens- the string parts of the newStringList, an empty tokens array or null is not permitted.
 
 - 
 
- 
Method Detail
- 
getToken
public java.lang.String getToken(int index)
Retrieves a token from the given index.- Parameters:
 index-- Returns:
 - token at the given index
 
 
- 
size
public int size()
Retrieves the number of tokens inside this list.- Returns:
 - number of tokens
 
 
- 
iterator
public java.util.Iterator<java.lang.String> iterator()
Retrieves anIteratorover all tokens.- Specified by:
 iteratorin interfacejava.lang.Iterable<java.lang.String>- Returns:
 - iterator over tokens
 
 
- 
compareToIgnoreCase
public boolean compareToIgnoreCase(StringList tokens)
Compares to tokens list and ignores the case of the tokens. Note: This can cause problems with some locals.- Parameters:
 tokens-- Returns:
 - true if identically with ignore the case otherwise false
 
 
- 
hashCode
public int hashCode()
- Overrides:
 hashCodein classjava.lang.Object
 
- 
equals
public boolean equals(java.lang.Object obj)
- Overrides:
 equalsin classjava.lang.Object
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -