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.RandomAccess
A 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 protected
WrappedArray(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.WrappedArray
that is backed by the givenarray
.T
get(int index)
T[]
internalToArray()
Returns the underlying array in an unsafe manner.T
set(int index, T element)
int
size()
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 benull
which 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.WrappedArray
that is backed by the givenarray
.- Type Parameters:
T
- the element type of the created list.- Parameters:
array
- the to-be-wrapped array. May benull
which 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:
set
in interfacejava.util.List<T>
- Overrides:
set
in classjava.util.AbstractList<T>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.java.lang.ClassCastException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
-
size
public int size()
-
toArray
public java.lang.Object[] toArray()
-
-