Package org.apache.xml.utils
Class StringVector
java.lang.Object
org.apache.xml.utils.StringVector
- All Implemented Interfaces:
Serializable
A very simple table that stores a list of strings, optimized
for small lists.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.StringVector
(int blocksize) Construct a StringVector, using the given block size. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addElement
(String value) Append a string onto the vector.final boolean
Tell if the table contains the given string.final boolean
Tell if the table contains the given string.final String
elementAt
(int i) Get the nth element.int
Get the length of the list.final String
peek()
Get the string at the tail of this vector without popping.final String
pop()
Pop the tail of this vector.final void
Tell if the table contains the given string.final int
size()
Get the length of the list.
-
Constructor Details
-
StringVector
public StringVector()Default constructor. Note that the default block size is very small, for small lists. -
StringVector
public StringVector(int blocksize) Construct a StringVector, using the given block size.- Parameters:
blocksize
- Size of the blocks to allocate
-
-
Method Details
-
getLength
public int getLength()Get the length of the list.- Returns:
- Number of strings in the list
-
size
public final int size()Get the length of the list.- Returns:
- Number of strings in the list
-
addElement
Append a string onto the vector.- Parameters:
value
- Sting to add to the vector
-
elementAt
Get the nth element.- Parameters:
i
- Index of string to find- Returns:
- String at given index
-
contains
Tell if the table contains the given string.- Parameters:
s
- String to look for- Returns:
- True if the string is in this table
-
containsIgnoreCase
Tell if the table contains the given string. Ignore case.- Parameters:
s
- String to find- Returns:
- True if the String is in this vector
-
push
Tell if the table contains the given string.- Parameters:
s
- String to push into the vector
-
pop
Pop the tail of this vector.- Returns:
- The String last added to this vector or null not found. The string is removed from the vector.
-
peek
Get the string at the tail of this vector without popping.- Returns:
- The string at the tail of this vector.
-