com.endeca.navigation
Class StringList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by com.endeca.navigation.StringList
All Implemented Interfaces:
Serializable, Iterable, Collection, List

public class StringList
extends AbstractList
implements Serializable, List

A StringList object contains a list of Strings. It is used to store a list of synonyms of a DimVal object.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
StringList()
          Default constructor that will contain an empty list.
StringList(Collection c)
          Constructor that takes a Collection of Strings.
 
Method Summary
 void add(String str)
          Adds a String to the StringList list.
 Object get(int index)
          Gets the element at position index.
 String getString(int index)
          Gets a String from the StringList object.
 Object remove(int index)
          Removes the element at the specified position in this list.
 int size()
          Returns the number of elements in this list.
 String toString()
          Generates the string-based representation of the list by returning a space-delimited sequence of Strings.
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Constructor Detail

StringList

public StringList()
Default constructor that will contain an empty list.


StringList

public StringList(Collection c)
Constructor that takes a Collection of Strings.

Parameters:
c - A Collection object from which the Strings will be extracted.
Method Detail

add

public void add(String str)
Adds a String to the StringList list.

Parameters:
str - A String to add to the list.

getString

public String getString(int index)
Gets a String from the StringList object.

Returns:
The String at position index.

remove

public Object remove(int index)
Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.

Specified by:
remove in interface List
Overrides:
remove in class AbstractList
Parameters:
index - The offset of the element in the list.
Returns:
element previously at position index.
Throws:
IndexOutOfBoundsException - If the index is out of range.

get

public Object get(int index)
Gets the element at position index. Object returned is of type String. Use of this method is not recommended as object returned is of type String. Interface present for List interface.

Specified by:
get in interface List
Specified by:
get in class AbstractList
Parameters:
index - Offset of element.
Returns:
element at position index.
Throws:
IndexOutOfBoundsException - If the index is out of range.

size

public int size()
Returns the number of elements in this list.

Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in class AbstractCollection
Returns:
Number of elements in list.

toString

public String toString()
Generates the string-based representation of the list by returning a space-delimited sequence of Strings.

Overrides:
toString in class AbstractCollection
Returns:
a space-delimited sequence of Strings.


© 2003, 2012 Oracle and/or its affiliates. All rights reserved.
Oracle and/or its affiliates Confidential