Package org.eclipse.xtext.xbase.lib
Class Conversions.WrappedLongArray
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<java.lang.Long>
-
- org.eclipse.xtext.xbase.lib.Conversions.WrappedLongArray
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Long>
,java.util.Collection<java.lang.Long>
,java.util.List<java.lang.Long>
,java.util.RandomAccess
- Enclosing class:
- Conversions
public static final class Conversions.WrappedLongArray extends java.util.AbstractList<java.lang.Long> implements java.util.RandomAccess
A 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 protected
WrappedLongArray(long[] array)
Internal constructor forConversions.WrappedLongArray
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(java.lang.Object o)
static Conversions.WrappedLongArray
create(long[] array)
Creates a newConversions.WrappedLongArray
that is backed by the given primitivearray
.java.lang.Long
get(int index)
int
indexOf(java.lang.Object o)
long[]
internalToArray()
Returns the underlying array in an unsafe manner.int
lastIndexOf(java.lang.Object o)
java.lang.Long
set(int index, java.lang.Long element)
int
size()
-
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
-
WrappedLongArray
protected WrappedLongArray(long[] array)
Internal constructor forConversions.WrappedLongArray
.- 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
@Pure public static Conversions.WrappedLongArray create(long[] array)
Creates a newConversions.WrappedLongArray
that is backed by the given primitivearray
.- Parameters:
array
- the to-be-wrapped array. May benull
which will cause any method on the resulting object to fail.- Returns:
- the wrapped array. Never
null
.
-
get
public java.lang.Long get(int index)
- Specified by:
get
in interfacejava.util.List<java.lang.Long>
- Specified by:
get
in classjava.util.AbstractList<java.lang.Long>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.java.lang.IndexOutOfBoundsException
-
set
public java.lang.Long set(int index, java.lang.Long element)
- Specified by:
set
in interfacejava.util.List<java.lang.Long>
- Overrides:
set
in classjava.util.AbstractList<java.lang.Long>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.java.lang.ClassCastException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interfacejava.util.List<java.lang.Long>
- Overrides:
indexOf
in classjava.util.AbstractList<java.lang.Long>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<java.lang.Long>
- Overrides:
lastIndexOf
in classjava.util.AbstractList<java.lang.Long>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in interfacejava.util.Collection<java.lang.Long>
- Specified by:
contains
in interfacejava.util.List<java.lang.Long>
- Overrides:
contains
in classjava.util.AbstractCollection<java.lang.Long>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<java.lang.Long>
- Specified by:
size
in interfacejava.util.List<java.lang.Long>
- Specified by:
size
in classjava.util.AbstractCollection<java.lang.Long>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.
-
internalToArray
public long[] 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
null
if the list wascreated
with a null argument.
-
-