Package com.mckoi.util
Class StringListBucket
java.lang.Object
com.mckoi.util.StringListBucket
A utility container class for holding a list of strings. This method
provides a convenient way of exporting and importing the list as a string
itself. This is useful if we need to represent a variable array of
strings.
- Author:
- Tobias Downer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a string to the end of the list.voidAdds a string to the given index of the list.voidclear()Clears the list of all string elements.booleanReturns true if the list contains the given element string.voidfromString(String list) Imports from a String into this bucket.get(int index) Returns the string at the given index of the list.intindexOfVar(String element) Returns the index of the given string in the bucket, or -1 if not found.voidremove(int index) Removes the string at the given index of the list.intsize()Returns the number of string elements in the list.toString()Returns the bucket as a StringBuffer.
-
Constructor Details
-
StringListBucket
public StringListBucket()Constructs the bucket. -
StringListBucket
-
-
Method Details
-
size
public int size()Returns the number of string elements in the list. -
clear
public void clear()Clears the list of all string elements. -
add
Adds a string to the end of the list. -
add
Adds a string to the given index of the list. -
get
Returns the string at the given index of the list. -
remove
public void remove(int index) Removes the string at the given index of the list. -
contains
Returns true if the list contains the given element string. -
indexOfVar
Returns the index of the given string in the bucket, or -1 if not found. -
toStringBuffer
Returns the bucket as a StringBuffer. This can be exported to a file or to a database, etc. -
toString
-
fromString
Imports from a String into this bucket. This is used to transform a previously exported bucket via 'toStringBuffer()'.
-