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:
java.lang.Iterable<T>,java.util.Collection<T>,java.util.List<T>,java.util.RandomAccess
- Enclosing class:
- Conversions
public static final class Conversions.WrappedArray<T> extends java.util.AbstractList<T> implements java.util.RandomAccessA list that is completely backed by an array and that provides access to that array. Only for internal use.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedWrappedArray(T[] array)Internal constructor forConversions.WrappedArray.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Conversions.WrappedArray<T>create(T[] array)Creates a newConversions.WrappedArraythat is backed by the givenarray.Tget(int index)T[]internalToArray()Returns the underlying array in an unsafe manner.Tset(int index, T element)intsize()java.lang.Object[]toArray()-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toString
-
-
-
-
Constructor Detail
-
WrappedArray
protected WrappedArray(T[] array)
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 Detail
-
create
public static <T> Conversions.WrappedArray<T> create(T[] array)
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
public T get(int index)
-
set
public T set(int index, T element)
- Specified by:
setin interfacejava.util.List<T>- Overrides:
setin classjava.util.AbstractList<T>- Throws:
java.lang.NullPointerException- if the wrapped array wasnull.java.lang.ClassCastExceptionjava.lang.NullPointerExceptionjava.lang.IllegalArgumentExceptionjava.lang.IndexOutOfBoundsException
-
size
public int size()
-
toArray
public java.lang.Object[] toArray()
-
-