Module org.eclipse.xtext.xbase.lib
Package org.eclipse.xtext.xbase.lib
Class Conversions.WrappedCharacterArray
- All Implemented Interfaces:
Iterable<Character>,Collection<Character>,List<Character>,RandomAccess
- Enclosing class:
- Conversions
public static final class Conversions.WrappedCharacterArray
extends AbstractList<Character>
implements RandomAccess
A list that is completely backed by an array of primitives and that provides access to that array. Only for
internal use.
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWrappedCharacterArray(char[] array) Internal constructor forConversions.WrappedCharacterArray. -
Method Summary
Modifier and TypeMethodDescriptionbooleancreate(char[] array) Creates a newConversions.WrappedCharacterArraythat is backed by the given primitivearray.get(int index) intchar[]Returns the underlying array in an unsafe manner.intintsize()Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, iterator, listIterator, listIterator, remove, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Constructor Details
-
WrappedCharacterArray
protected WrappedCharacterArray(char[] array) Internal constructor forConversions.WrappedCharacterArray.- Parameters:
array- the to-be-wrapped array. May benullwhich will cause any method on the created object to fail with aNullPointerException.
-
-
Method Details
-
create
Creates a newConversions.WrappedCharacterArraythat is backed by the given primitivearray.- Parameters:
array- the to-be-wrapped array. May benullwhich will cause any method on the resulting object to fail.- Returns:
- the wrapped array. Never
null.
-
get
- Specified by:
getin interfaceList<Character>- Specified by:
getin classAbstractList<Character>- Throws:
NullPointerException- if the wrapped array wasnull.IndexOutOfBoundsException
-
set
- Specified by:
setin interfaceList<Character>- Overrides:
setin classAbstractList<Character>- Throws:
NullPointerException- if the wrapped array wasnull.ClassCastExceptionNullPointerExceptionIllegalArgumentExceptionIndexOutOfBoundsException
-
indexOf
- Specified by:
indexOfin interfaceList<Character>- Overrides:
indexOfin classAbstractList<Character>- Throws:
NullPointerException- if the wrapped array wasnull.
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<Character>- Overrides:
lastIndexOfin classAbstractList<Character>- Throws:
NullPointerException- if the wrapped array wasnull.
-
contains
- Specified by:
containsin interfaceCollection<Character>- Specified by:
containsin interfaceList<Character>- Overrides:
containsin classAbstractCollection<Character>- Throws:
NullPointerException- if the wrapped array wasnull.
-
size
public int size()- Specified by:
sizein interfaceCollection<Character>- Specified by:
sizein interfaceList<Character>- Specified by:
sizein classAbstractCollection<Character>- Throws:
NullPointerException- if the wrapped array wasnull.
-
internalToArray
public char[] internalToArray()Returns the underlying array in an unsafe manner. That is, modification of the array will be reflected by this list and vice versa.- Returns:
- the underlying array. May be
nullif the list wascreatedwith a null argument.
-