Package org.eclipse.xtext.xbase.lib
Class Conversions.WrappedBooleanArray
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<java.lang.Boolean>
-
- org.eclipse.xtext.xbase.lib.Conversions.WrappedBooleanArray
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Boolean>
,java.util.Collection<java.lang.Boolean>
,java.util.List<java.lang.Boolean>
,java.util.RandomAccess
- Enclosing class:
- Conversions
public static final class Conversions.WrappedBooleanArray extends java.util.AbstractList<java.lang.Boolean> 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
WrappedBooleanArray(boolean[] array)
Internal constructor forConversions.WrappedBooleanArray
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(java.lang.Object o)
static Conversions.WrappedBooleanArray
create(boolean[] array)
Creates a newConversions.WrappedBooleanArray
that is backed by the given primitivearray
.java.lang.Boolean
get(int index)
int
indexOf(java.lang.Object o)
boolean[]
internalToArray()
Returns the underlying array in an unsafe manner.int
lastIndexOf(java.lang.Object o)
java.lang.Boolean
set(int index, java.lang.Boolean 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
-
WrappedBooleanArray
protected WrappedBooleanArray(boolean[] array)
Internal constructor forConversions.WrappedBooleanArray
.- 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.WrappedBooleanArray create(boolean[] array)
Creates a newConversions.WrappedBooleanArray
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.Boolean get(int index)
- Specified by:
get
in interfacejava.util.List<java.lang.Boolean>
- Specified by:
get
in classjava.util.AbstractList<java.lang.Boolean>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.java.lang.IndexOutOfBoundsException
-
set
public java.lang.Boolean set(int index, java.lang.Boolean element)
- Specified by:
set
in interfacejava.util.List<java.lang.Boolean>
- Overrides:
set
in classjava.util.AbstractList<java.lang.Boolean>
- 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.Boolean>
- Overrides:
indexOf
in classjava.util.AbstractList<java.lang.Boolean>
- 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.Boolean>
- Overrides:
lastIndexOf
in classjava.util.AbstractList<java.lang.Boolean>
- 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.Boolean>
- Specified by:
contains
in interfacejava.util.List<java.lang.Boolean>
- Overrides:
contains
in classjava.util.AbstractCollection<java.lang.Boolean>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<java.lang.Boolean>
- Specified by:
size
in interfacejava.util.List<java.lang.Boolean>
- Specified by:
size
in classjava.util.AbstractCollection<java.lang.Boolean>
- Throws:
java.lang.NullPointerException
- if the wrapped array wasnull
.
-
internalToArray
public boolean[] 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.
-
-