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 TypeMethodDescriptionvoid
Adds a string to the end of the list.void
Adds a string to the given index of the list.void
clear()
Clears the list of all string elements.boolean
Returns true if the list contains the given element string.void
fromString
(String list) Imports from a String into this bucket.get
(int index) Returns the string at the given index of the list.int
indexOfVar
(String element) Returns the index of the given string in the bucket, or -1 if not found.void
remove
(int index) Removes the string at the given index of the list.int
size()
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()'.
-