public class StringBufferCharList extends AbstractCharList
This class implements List allowing
seamless integration with other APIs.
AbstractCharList.PListIterator| Modifier and Type | Field and Description |
|---|---|
protected java.lang.StringBuffer |
stringBuffer
The String being wrapped
|
| Modifier | Constructor and Description |
|---|---|
|
StringBufferCharList()
Constructor that uses an empty string as the datasource.
|
|
StringBufferCharList(CharList list)
Constructor that copies the specified list.
|
|
StringBufferCharList(java.lang.String str)
Constructor that copies the specified string.
|
protected |
StringBufferCharList(java.lang.StringBuffer buf)
Constructor that decorates the specified string buffer.
|
| Modifier and Type | Method and Description |
|---|---|
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(java.lang.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.
|
java.lang.String |
toStringContents()
Gets the String underlying the list.
|
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, toCharArrayaddAll, 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, toStringclone, isEmpty, optimizefinalize, getClass, notify, notifyAll, wait, wait, waitaddAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayaddAll, addAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, toCharArray, toCharArraycontainsAnyclone, isEmpty, optimizeprotected final java.lang.StringBuffer stringBuffer
public StringBufferCharList()
public StringBufferCharList(CharList list)
list - the list to copy, must not be nulljava.lang.IllegalArgumentException - if the list is nullpublic StringBufferCharList(java.lang.String str)
str - the string to copy, must not be nulljava.lang.IllegalArgumentException - if the string is nullprotected StringBufferCharList(java.lang.StringBuffer buf)
buf - the string buffer to decorate, must not be nulljava.lang.IllegalArgumentException - if the string is nullpublic static StringBufferCharList decorate(java.lang.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 nulljava.lang.IllegalArgumentException - if the string is nullpublic char getChar(int index)
index - the index to retrievepublic 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 collectiontrue if this list was modified by this method calljava.lang.IndexOutOfBoundsException - if the index is invalidpublic char removeIndex(int index)
index - the index to remove fromjava.lang.IndexOutOfBoundsException - if the index is invalidpublic char set(int index,
char value)
This implementation throws UnsupportedOperationException.
set in interface CharListset in class AbstractCharListindex - the index to setvalue - the value to storejava.lang.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<java.lang.Character>isModifiable in class AbstractCharListpublic boolean add(char value)
add in interface CharCollectionadd in class AbstractCharListvalue - the value to add to this collectiontrue 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 arraytrue if this list was modified by this method calljava.lang.IndexOutOfBoundsException - if the index is invalidpublic 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 arraytrue if this list was modified by this method calljava.lang.IndexOutOfBoundsException - if the index is invalidpublic boolean removeRange(int fromIndexInclusive,
int toIndexExclusive)
removeRange in interface PrimitiveList<java.lang.Character>removeRange in class AbstractCharListfromIndexInclusive - the start of the range to remove, inclusivetoIndexExclusive - the end of the range to remove, exclusivetrue if the collection was modifiedpublic java.lang.String toStringContents()
toStringContents in interface CharListtoStringContents in class AbstractCharListprotected 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 copyCopyright © 2005–2018 Joda.org. All rights reserved.