|
||||||||||
| 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.StringBufferCharList
public class StringBufferCharList
CharList implementation that uses a StringBuffer internally.
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 StringBuffer |
stringBuffer
The String being wrapped |
| Constructor Summary | |
|---|---|
|
StringBufferCharList()
Constructor that uses an empty string as the datasource. |
|
StringBufferCharList(CharList list)
Constructor that copies the specified list. |
|
StringBufferCharList(String str)
Constructor that copies the specified string. |
protected |
StringBufferCharList(StringBuffer buf)
Constructor that decorates the specified string buffer. |
| Method Summary | |
|---|---|
boolean |
add(char value)
Adds a primitive value to this collection. |
boolean |
add(int index,
char value)
Adds a primitive value to this list at an index. |
boolean |
addAll(char[] values)
Adds an array of primitive values to this list at an index. |
boolean |
addAll(int index,
char[] values)
Adds an array of primitive values to this list at an index. |
protected void |
arrayCopy(int fromIndex,
char[] dest,
int destIndex,
int size)
Copies data from this collection into the specified array. |
static StringBufferCharList |
decorate(StringBuffer buf)
Decorates the specified string buffer with a StringBufferCharList. |
char |
getChar(int index)
Gets the character at the specified index. |
protected boolean |
isAddModifiable()
Are the add methods supported. |
boolean |
isModifiable()
Is the collection modifiable in any way. |
protected boolean |
isRemoveModifiable()
Are the remove methods supported. |
protected boolean |
isSetModifiable()
Are the set methods supported. |
char |
removeIndex(int index)
Removes a primitive value by index from the list. |
boolean |
removeRange(int fromIndexInclusive,
int toIndexExclusive)
Removes a range of values from the list. |
char |
set(int index,
char value)
Sets the primitive value at a specified index. |
int |
size()
Gets the size of the list, which is the string length. |
String |
toStringContents()
Gets the String underlying the list. |
| Methods inherited from class org.joda.primitives.list.impl.AbstractCharList |
|---|
add, add, addAll, checkIndex, checkIndexExists, checkRange, checkSetModifiable, clear, contains, equals, first, firstChar, get, hashCode, indexOf, indexOf, indexOf, indexOf, iterator, last, lastChar, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeChar, removeCharAt, set, subList, 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, isToPrimitivePossible, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, retainAll, toArray, toArray, toCharArray, 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, 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 StringBuffer stringBuffer
| Constructor Detail |
|---|
public StringBufferCharList()
public StringBufferCharList(CharList list)
list - the list to copy, must not be null
IllegalArgumentException - if the list is nullpublic StringBufferCharList(String str)
str - the string to copy, must not be null
IllegalArgumentException - if the string is nullprotected StringBufferCharList(StringBuffer buf)
buf - the string buffer to decorate, must not be null
IllegalArgumentException - if the string is null| Method Detail |
|---|
public static StringBufferCharList decorate(StringBuffer buf)
The specified buffer is used as the datasource, so changes to one will affect the other.
buf - the string buffer to decorate, must not be null
IllegalArgumentException - if the string is nullpublic char getChar(int index)
index - the index to retrieve
public int size()
public boolean add(int index,
char value)
add in interface CharListadd in class AbstractCharListindex - the index to add atvalue - the value to add to this collection
true if this list was modified by this method call
IndexOutOfBoundsException - if the index is invalidpublic char removeIndex(int index)
index - the index to remove from
IndexOutOfBoundsException - if the index is invalid
public char set(int index,
char value)
This implementation throws UnsupportedOperationException.
set in interface CharListset in class AbstractCharListindex - the index to setvalue - the value to store
IndexOutOfBoundsException - if the index is invalidprotected boolean isAddModifiable()
isAddModifiable in class AbstractCharCollectionprotected boolean isRemoveModifiable()
isRemoveModifiable in class AbstractCharCollectionprotected boolean isSetModifiable()
isSetModifiable in class AbstractCharListpublic boolean isModifiable()
isModifiable in interface PrimitiveCollectable<Character>isModifiable in class AbstractCharListpublic boolean add(char value)
add in interface CharCollectionadd in class AbstractCharListvalue - the value to add to this collection
true if this collection was modified by this method callpublic boolean addAll(char[] values)
addAll in interface CharCollectionaddAll in class AbstractCharListvalues - the values to add to this collection, null treated as empty array
true if this list was modified by this method call
IndexOutOfBoundsException - if the index is invalid
public boolean addAll(int index,
char[] values)
addAll in interface CharListaddAll in class AbstractCharListindex - the index to add atvalues - the values to add to this collection, null treated as empty array
true if this list was modified by this method call
IndexOutOfBoundsException - if the index is invalid
public boolean removeRange(int fromIndexInclusive,
int toIndexExclusive)
removeRange in interface PrimitiveList<Character>removeRange in class AbstractCharListfromIndexInclusive - the start of the range to remove, inclusivetoIndexExclusive - the end of the range to remove, exclusive
true if the collection was modifiedpublic String toStringContents()
toStringContents in interface CharListtoStringContents in class AbstractCharList
protected void arrayCopy(int fromIndex,
char[] dest,
int destIndex,
int size)
arrayCopy in class AbstractCharListfromIndex - the index to start fromdest - the destination arraydestIndex - the destination start indexsize - the number of items to copy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||