Package org.eclipse.xtext.xbase.lib
Class Conversions.WrappedShortArray
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<java.lang.Short>
-
- org.eclipse.xtext.xbase.lib.Conversions.WrappedShortArray
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Short>,java.util.Collection<java.lang.Short>,java.util.List<java.lang.Short>,java.util.RandomAccess
- Enclosing class:
- Conversions
public static final class Conversions.WrappedShortArray extends java.util.AbstractList<java.lang.Short> implements java.util.RandomAccessA list that is completely backed by an array of primitives and that provides access to that array. Only for internal use.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedWrappedShortArray(short[] array)Internal constructor forConversions.WrappedShortArray.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(java.lang.Object o)static Conversions.WrappedShortArraycreate(short[] array)Creates a newConversions.WrappedShortArraythat is backed by the given primitivearray.java.lang.Shortget(int index)intindexOf(java.lang.Object o)short[]internalToArray()Returns the underlying array in an unsafe manner.intlastIndexOf(java.lang.Object o)java.lang.Shortset(int index, java.lang.Short element)intsize()-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, iterator, listIterator, listIterator, remove, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
WrappedShortArray
protected WrappedShortArray(short[] array)
Internal constructor forConversions.WrappedShortArray.- Parameters:
array- the to-be-wrapped array. May benullwhich will cause any method on the created object to fail with aNullPointerException.
-
-
Method Detail
-
create
@Pure public static Conversions.WrappedShortArray create(short[] array)
Creates a newConversions.WrappedShortArraythat 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
public java.lang.Short get(int index)
- Specified by:
getin interfacejava.util.List<java.lang.Short>- Specified by:
getin classjava.util.AbstractList<java.lang.Short>- Throws:
java.lang.NullPointerException- if the wrapped array wasnull.java.lang.IndexOutOfBoundsException
-
set
public java.lang.Short set(int index, java.lang.Short element)- Specified by:
setin interfacejava.util.List<java.lang.Short>- Overrides:
setin classjava.util.AbstractList<java.lang.Short>- Throws:
java.lang.NullPointerException- if the wrapped array wasnull.java.lang.ClassCastExceptionjava.lang.NullPointerExceptionjava.lang.IllegalArgumentExceptionjava.lang.IndexOutOfBoundsException
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOfin interfacejava.util.List<java.lang.Short>- Overrides:
indexOfin classjava.util.AbstractList<java.lang.Short>- Throws:
java.lang.NullPointerException- if the wrapped array wasnull.
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOfin interfacejava.util.List<java.lang.Short>- Overrides:
lastIndexOfin classjava.util.AbstractList<java.lang.Short>- Throws:
java.lang.NullPointerException- if the wrapped array wasnull.
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection<java.lang.Short>- Specified by:
containsin interfacejava.util.List<java.lang.Short>- Overrides:
containsin classjava.util.AbstractCollection<java.lang.Short>- Throws:
java.lang.NullPointerException- if the wrapped array wasnull.
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<java.lang.Short>- Specified by:
sizein interfacejava.util.List<java.lang.Short>- Specified by:
sizein classjava.util.AbstractCollection<java.lang.Short>- Throws:
java.lang.NullPointerException- if the wrapped array wasnull.
-
internalToArray
public short[] 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.
-
-