Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.impl.xs.util

public final Class StringListImpl

extends AbstractList<String>
implements StringList
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.xerces.internal.xs.StringList, java.util.List, java.util.SequencedCollection, java.util.Collection, java.lang.Iterable
Annotations
@SuppressWarnings:unchecked
Imports
com.sun.org.apache.xerces.internal.xs.StringList, java.lang.reflect.Array, java.util.AbstractList, .List

Containts a list of Object's.
Author
Sandy Gao, IBM

Field Summary

Modifier and TypeField and Description
public static final StringListImpl
EMPTY_LIST

An immutable empty list.

private final String[]
private final int
private final List<String>
Inherited from java.util.AbstractList:
modCount

Constructor Summary

AccessConstructor and Description
public
public
StringListImpl(String[]
the data array
array
,
int
the number of elements
length
)

Construct an XSObjectList implementation

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True if this list contains the GenericString item.
contains
(String
GenericString whose presence in this list is to be tested.
item
)

Implements com.sun.org.apache.xerces.internal.xs.StringList.contains.

Checks if the GenericString item is a member of this list.

public String
get(int
index of the element to return
index
)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.

public int
getLength()

Implements com.sun.org.apache.xerces.internal.xs.StringList.getLength.

The number of Objects in the list.

public String
item(int
index into the collection.
index
)

Implements com.sun.org.apache.xerces.internal.xs.StringList.item.

Returns the indexth item in the collection or null if index is greater than or equal to the number of objects in the list.

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Returns the number of elements in this list.

public Object[]
toArray()

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

public Object[]
toArray(Object[]
the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
a
)

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

private void
Inherited from java.util.AbstractList:
addaddaddAllclearequalshashCodeindexOfiteratorlastIndexOflistIteratorlistIteratorremoveremoveRangesetsubList

Field Detail

EMPTY_LISTback to summary
public static final StringListImpl EMPTY_LIST

An immutable empty list.

fArrayback to summary
private final String[] fArray
fLengthback to summary
private final int fLength
fVectorback to summary
private final List<String> fVector

Constructor Detail

StringListImplback to summary
public StringListImpl(List<String> v)
StringListImplback to summary
public StringListImpl(String[] array, int length)

Construct an XSObjectList implementation

Parameters
array:String[]

the data array

length:int

the number of elements

Method Detail

containsback to summary
public boolean contains(String item)

Implements com.sun.org.apache.xerces.internal.xs.StringList.contains.

Checks if the GenericString item is a member of this list.

Parameters
item:String

GenericString whose presence in this list is to be tested.

Returns:boolean

True if this list contains the GenericString item.

getback to summary
public String get(int index)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Doc from java.util.List.get.

Returns the element at the specified position in this list.

Parameters
index:int

index of the element to return

Returns:String

the element at the specified position in this list

getLengthback to summary
public int getLength()

Implements com.sun.org.apache.xerces.internal.xs.StringList.getLength.

The number of Objects in the list. The range of valid child node indices is 0 to length-1 inclusive.

itemback to summary
public String item(int index)

Implements com.sun.org.apache.xerces.internal.xs.StringList.item.

Doc from com.sun.org.apache.xerces.internal.xs.StringList.item.

Returns the indexth item in the collection or null if index is greater than or equal to the number of objects in the list. The index starts at 0.

Parameters
index:int

index into the collection.

Returns:String

The GenericString at the indexth position in the StringList, or null if the index specified is not valid.

sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Doc from java.util.List.size.

Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this list

toArrayback to summary
public Object[] toArray()

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Doc from java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array even if this list is backed by an array). The caller is thus free to modify the returned array.

This method acts as bridge between array-based and collection-based APIs.

Returns:Object[]

an array containing all of the elements in this list in proper sequence

toArrayback to summary
public Object[] toArray(Object[] a)

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Doc from java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.

If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the list is set to null. (This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.)

Like the toArray() method, this method acts as bridge between array-based and collection-based APIs. Further, this method allows precise control over the runtime type of the output array, and may, under certain circumstances, be used to save allocation costs.

Suppose x is a list known to contain only strings. The following code can be used to dump the list into a newly allocated array of String:

String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to toArray().
Parameters
a:Object[]

the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.

Returns:Object[]

an array containing the elements of this list

toArray0back to summary
private void toArray0(Object[] a)