|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.joda.primitives.collection.impl.AbstractPrimitiveCollectable<Character>
org.joda.primitives.collection.impl.AbstractCharCollection
org.joda.primitives.list.impl.AbstractCharList
org.joda.primitives.list.impl.StringCharList
public class StringCharList
Unmodifiable CharList wrapped around a String.
This class implements List
allowing
seamless integration with other APIs.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.joda.primitives.list.impl.AbstractCharList |
---|
AbstractCharList.PListIterator |
Field Summary | |
---|---|
protected String |
string
The String being wrapped |
Constructor Summary | |
---|---|
StringCharList()
Constructor that uses an empty string as the datasource. |
|
StringCharList(CharList list)
Constructor that copies the specified list. |
|
StringCharList(String str)
Constructor that uses the specified string as the datasource. |
Method Summary | |
---|---|
boolean |
contains(char value)
Checks whether this collection contains a specified primitive value. |
char |
getChar(int index)
Gets the character at the specified index. |
int |
indexOf(char value)
Gets the first index of the specified primitive value. |
int |
indexOf(char value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index. |
int |
lastIndexOf(char value)
Gets the last index of the specified primitive value. |
int |
lastIndexOf(char value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index. |
int |
size()
Gets the size of the list, which is the string length. |
CharList |
subList(int fromIndexInclusive,
int toIndexExclusive)
Gets a range view of part of this list. |
char[] |
toCharArray()
Gets the elements of this collection as an array. |
String |
toStringContents()
Gets the String underlying the list. |
Methods inherited from class org.joda.primitives.list.impl.AbstractCharList |
---|
add, add, add, add, addAll, addAll, addAll, arrayCopy, checkIndex, checkIndexExists, checkRange, checkSetModifiable, clear, equals, first, firstChar, get, hashCode, indexOf, indexOf, isModifiable, isSetModifiable, iterator, last, lastChar, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeChar, removeCharAt, removeRange, set, set, toCharArray |
Methods inherited from class org.joda.primitives.collection.impl.AbstractCharCollection |
---|
addAll, addAll, addAll, checkAddModifiable, checkRemoveModifiable, contains, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, containsAny, isAddModifiable, isRemoveModifiable, isToPrimitivePossible, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, retainAll, toArray, toArray, toCharArray, toObject, toPrimitive, toPrimitiveArray, toString |
Methods inherited from class org.joda.primitives.collection.impl.AbstractPrimitiveCollectable |
---|
clone, isEmpty, optimize |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection |
---|
containsAny |
Methods inherited from interface org.joda.primitives.PrimitiveCollectable |
---|
clone, isEmpty, optimize |
Methods inherited from interface java.util.List |
---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Methods inherited from interface org.joda.primitives.collection.CharCollection |
---|
addAll, addAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, toCharArray |
Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection |
---|
containsAny |
Methods inherited from interface org.joda.primitives.PrimitiveCollectable |
---|
clone, isEmpty, optimize |
Field Detail |
---|
protected final String string
Constructor Detail |
---|
public StringCharList()
public StringCharList(CharList list)
list
- the list to copy, must not be null
IllegalArgumentException
- if the list is nullpublic StringCharList(String str)
str
- the string to wrap in a list, must not be null
IllegalArgumentException
- if the string is nullMethod Detail |
---|
public char getChar(int index)
getChar
in interface CharList
index
- the index to retrieve
public int size()
size
in interface Collection<Character>
size
in interface List<Character>
size
in interface PrimitiveCollectable<Character>
public boolean contains(char value)
This implementation uses String.indexOf(char)
.
contains
in interface CharCollection
contains
in class AbstractCharList
value
- the value to search for
true
if the value is foundpublic int indexOf(char value)
This implementation uses String.indexOf(char)
.
indexOf
in interface CharList
indexOf
in class AbstractCharList
value
- the value to search for
-1
if not foundpublic int indexOf(char value, int fromIndexInclusive)
This method follows the conventions of String
in that a
negative index is treated as zero, and an index greater than the list
size will simply return -1
.
This implementation uses String.indexOf(char, int)
.
indexOf
in interface CharList
indexOf
in class AbstractCharList
value
- the value to search forfromIndexInclusive
- the index to start searching from, inclusive
-1
if not foundpublic int lastIndexOf(char value)
This implementation uses String.lastIndexOf(char)
.
lastIndexOf
in interface CharList
lastIndexOf
in class AbstractCharList
value
- the value to search for
-1
if not foundpublic int lastIndexOf(char value, int fromIndexInclusive)
This method follows the conventions of String
in that an
index greater than the list size will start searching at the list size,
and a negative index simply returns -1
.
This implementation uses String.lastIndexOf(char, int)
.
lastIndexOf
in interface CharList
lastIndexOf
in class AbstractCharList
value
- the value to search forfromIndexInclusive
- the index to start searching from, inclusive
-1
if not foundpublic String toStringContents()
toStringContents
in interface CharList
toStringContents
in class AbstractCharList
public char[] toCharArray()
This implementation uses String.toCharArray()
.
toCharArray
in interface CharCollection
toCharArray
in class AbstractCharCollection
public CharList subList(int fromIndexInclusive, int toIndexExclusive)
This method allows operations to work on a range within the greater list. StringCharList is unmodifiable, thus so is the view.
subList
in interface List<Character>
subList
in interface CharList
subList
in class AbstractCharList
fromIndexInclusive
- the index to start from, inclusivetoIndexExclusive
- the index to end at, exclusive
IndexOutOfBoundsException
- if either index is invalid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |