Module org.eclipse.xtext.xbase.lib
Package org.eclipse.xtext.xbase.lib
Class Conversions.WrappedArray<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<T>
org.eclipse.xtext.xbase.lib.Conversions.WrappedArray<T>
- Type Parameters:
T- the type if the list elements.
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>,RandomAccess
- Enclosing class:
- Conversions
public static final class Conversions.WrappedArray<T>
extends AbstractList<T>
implements RandomAccess
A list that is completely backed by an array and that provides access to that array. Only for internal use.
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWrappedArray(T[] array) Internal constructor forConversions.WrappedArray. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Conversions.WrappedArray<T>create(T[] array) Creates a newConversions.WrappedArraythat is backed by the givenarray.get(int index) T[]Returns the underlying array in an unsafe manner.intsize()Object[]toArray()Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, 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, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray
-
Constructor Details
-
WrappedArray
Internal constructor forConversions.WrappedArray.- 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.WrappedArraythat is backed by the givenarray.- Type Parameters:
T- the element type of the created list.- Parameters:
array- the to-be-wrapped array. May benullwhich will cause any method on the result object to fail with aNullPointerException.- Returns:
- the wrapped array. Never
null.
-
get
- Specified by:
getin interfaceList<T>- Specified by:
getin classAbstractList<T>- Throws:
NullPointerException- if the wrapped array wasnull.IndexOutOfBoundsException
-
set
- Specified by:
setin interfaceList<T>- Overrides:
setin classAbstractList<T>- Throws:
NullPointerException- if the wrapped array wasnull.ClassCastExceptionNullPointerExceptionIllegalArgumentExceptionIndexOutOfBoundsException
-
size
public int size()- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceList<T>- Specified by:
sizein classAbstractCollection<T>- Throws:
NullPointerException- if the wrapped array wasnull.
-
toArray
- Specified by:
toArrayin interfaceCollection<T>- Specified by:
toArrayin interfaceList<T>- Overrides:
toArrayin classAbstractCollection<T>
-
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.
-