APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.javafx

public Class UnmodifiableArrayList<T>

extends AbstractList<T>
implements RandomAccess
Class Inheritance
All Implemented Interfaces
java.util.RandomAccess
Imports
java.util.AbstractList, .List, .Objects, .RandomAccess

An unmodifiable array-based List implementation. This is essentially like the package private UnmodifiableRandomAccessList of the JDK, and helps us to avoid having to do a lot of conversion work when we want to pass an array into an unmodifiable list implementation (otherwise we would have to create a temporary list that is then passed to Collections.unmodifiableList).

Field Summary

Modifier and TypeField and Description
private T[]
private final int
Inherited from java.util.AbstractList:
modCount

Constructor Summary

AccessConstructor and Description
public
UnmodifiableArrayList(T[]
The elements to use.
elements
,
int
The size must be <= the length of the elements array
size
)

The given elements are used directly (a defensive copy is not made), and the given size is used as the size of this list.

Method Summary

Modifier and TypeMethod and Description
public static <
the type of elements in the list
T
>
UnmodifiableArrayList<T>

Returns:

an unmodifiable list that does not contain null values
copyOfNullFiltered
(List<T>
the list, not null
list
)

Converts the specified list into an unmodifiable list that does not contain null values.

public static <
the type of elements in the array
T
>
UnmodifiableArrayList<T>

Returns:

an unmodifiable list that does not contain null values
copyOfNullFiltered
(T[]
the array, not null
elements
)

Converts the specified array into an unmodifiable list that does not contain null values.

public T
get(int index)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Returns the number of elements in this list.

Inherited from java.util.AbstractList:
addaddaddAllclearequalshashCodeindexOfiteratorlastIndexOflistIteratorlistIteratorremoveremoveRangesetsubList

Field Detail

elementsback to summary
private T[] elements
sizeback to summary
private final int size

Constructor Detail

UnmodifiableArrayListback to summary
public UnmodifiableArrayList(T[] elements, int size)

The given elements are used directly (a defensive copy is not made), and the given size is used as the size of this list. It is the callers responsibility to make sure the size is accurate.

Parameters
elements:T[]

The elements to use.

size:int

The size must be <= the length of the elements array

Method Detail

copyOfNullFilteredback to summary
public static <T> UnmodifiableArrayList<T> copyOfNullFiltered(List<T> list)

Converts the specified list into an unmodifiable list that does not contain null values. The returned list is a copy of, and not a wrapper around the specified list.

Parameters
<T>
the type of elements in the list
list:List<T>

the list, not null

Returns:UnmodifiableArrayList<T>

an unmodifiable list that does not contain null values

copyOfNullFilteredback to summary
public static <T> UnmodifiableArrayList<T> copyOfNullFiltered(T[] elements)

Converts the specified array into an unmodifiable list that does not contain null values. The returned list is a copy of, and not a wrapper around the specified array.

Parameters
<T>
the type of elements in the array
elements:T[]

the array, not null

Returns:UnmodifiableArrayList<T>

an unmodifiable list that does not contain null values

getback to summary
public T get(int index)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Doc from java.util.AbstractList.get.

Returns the element at the specified position in this list.

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Doc from java.util.List.size.

Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Annotations
@Override