org.eclipse.xtext.xbase.lib
Class Conversions.WrappedPrimitiveArray

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<Object>
          extended by org.eclipse.xtext.xbase.lib.Conversions.WrappedPrimitiveArray
All Implemented Interfaces:
Iterable<Object>, Collection<Object>, List<Object>, RandomAccess
Enclosing class:
Conversions

public static class Conversions.WrappedPrimitiveArray
extends AbstractList<Object>
implements RandomAccess

A list that is completely backed by an array of primitives and that provides access to that array. Only for internal use.


Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
protected Conversions.WrappedPrimitiveArray(Object array)
          Internal constructor for Conversions.WrappedPrimitiveArray.
 
Method Summary
static Conversions.WrappedPrimitiveArray create(Object array)
          Creates a new Conversions.WrappedPrimitiveArray that is backed by the given primitive array.
 Object get(int index)
          
 Object internalToArray()
          Returns the underlying array in an unsafe manner.
 Object set(int index, Object element)
          
 int size()
          
 
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, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

Conversions.WrappedPrimitiveArray

protected Conversions.WrappedPrimitiveArray(Object array)
Internal constructor for Conversions.WrappedPrimitiveArray.

Parameters:
array - the to-be-wrapped array. May be null which will cause any method on the created object to fail with a NullPointerException.
Method Detail

create

@Pure
public static Conversions.WrappedPrimitiveArray create(Object array)
Creates a new Conversions.WrappedPrimitiveArray that is backed by the given primitive array.

Parameters:
array - the to-be-wrapped array. May be null which will cause any method on the resulting object to fail.
Returns:
the wrapped array. Never null.

get

public Object get(int index)

Specified by:
get in interface List<Object>
Specified by:
get in class AbstractList<Object>
Throws:
NullPointerException - if the wrapped array was null.
IndexOutOfBoundsException

set

public Object set(int index,
                  Object element)

Specified by:
set in interface List<Object>
Overrides:
set in class AbstractList<Object>
Throws:
NullPointerException - if the wrapped array was null.
ClassCastException
NullPointerException
IllegalArgumentException
IndexOutOfBoundsException

size

public int size()

Specified by:
size in interface Collection<Object>
Specified by:
size in interface List<Object>
Specified by:
size in class AbstractCollection<Object>
Throws:
NullPointerException - if the wrapped array was null.

internalToArray

public Object 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 was created with a null argument.


Copyright © 2013. All Rights Reserved.