com.sas.collection
Interface StaticStringListInterface

All Superinterfaces:
java.lang.Cloneable, com.sas.collection.ContentsChangedSource, com.sas.util.Countable, com.sas.util.Enumerable, com.sas.PublicClonable
All Known Subinterfaces:
StringCollectionInterface, StringListInterface
All Known Implementing Classes:
StaticStringList, StringCollection

public interface StaticStringListInterface
extends com.sas.PublicClonable, com.sas.util.Countable, com.sas.util.Enumerable, com.sas.collection.ContentsChangedSource

The StaticStringListInterface interface is a read-only ordered collection of strings. The StringListInterface interface provides the update methods for a collection of Strings, and the StringCollection class provides an implementation.

See Also:
StringCollection

Method Summary
abstract  java.lang.Object clone()
          Clone the object.
abstract  boolean equals(StaticStringListInterface list)
          Compare the current items with those in another StaticStringList and test whether the lists are identical.
abstract  int getIndex(java.lang.String item, int startIndex)
          Returns the index of the first occurrence of the string item.
abstract  int getLastIndex(java.lang.String item, int startIndex)
          Returns the index of the last occurrence of the string item.
abstract  java.lang.String getString(int index)
          Fetch a string at a index.
abstract  java.lang.String[] getStringItems()
          Return the Strings in the list as an array of String.
abstract  StaticStringListInterface getStringItems(int start, int last)
          Extract a sublist of items from the list
 
Methods inherited from interface com.sas.util.Countable
count
 
Methods inherited from interface com.sas.util.Enumerable
getItems
 
Methods inherited from interface com.sas.collection.ContentsChangedSource
addContentsChangedListener, removeContentsChangedListener
 

Method Detail

equals

boolean equals(StaticStringListInterface list)
Compare the current items with those in another StaticStringList and test whether the lists are identical. The equals(Object) method is used to compare the strings in each collection.

Parameters:
list - Another string list to be compared to.
Returns:
true if identical, False otherwise.

getIndex

int getIndex(java.lang.String item,
             int startIndex)
Returns the index of the first occurrence of the string item.

Parameters:
item - item to search for
startIndex - index where search should start
Returns:
the zero-based index corresponding to the list item or -1 if the item is not found
Throws:
java.lang.IndexOutOfBoundsException - if the start index is not in the range [0..count()-1]

getStringItems

java.lang.String[] getStringItems()
Return the Strings in the list as an array of String.

Returns:
java.util.String[]

getStringItems

StaticStringListInterface getStringItems(int start,
                                         int last)
Extract a sublist of items from the list

Parameters:
start - the index of the first item, zero based.
last - the index of the last item, zero based.
Returns:
a list of the selected elements.
Throws:
java.lang.IndexOutOfBoundsException - if start or last are not in the range [0, count()-1].
See Also:
StaticOrderedCollectionInterface.getItems(int, int), String.substring(int, int)

getLastIndex

int getLastIndex(java.lang.String item,
                 int startIndex)
Returns the index of the last occurrence of the string item.

Parameters:
item - item to search for
startIndex - index where search should start
Returns:
the zero-based index corresponding to the list item of -1 if the item is not found
Throws:
java.lang.IndexOutOfBoundsException - if the start index is not in the range [0..count()-1]

getString

java.lang.String getString(int index)
Fetch a string at a index.

Parameters:
index - the position of the item, zero based indexing.
Returns:
the item associated with the index value
Throws:
java.lang.IndexOutOfBoundsException - if index is not in the range [0, count-1].

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone the object.

Specified by:
clone in interface com.sas.PublicClonable
Returns:
a clone of this collection.
Throws:
java.lang.CloneNotSupportedException - if the object could not be cloned.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.