Package org.epics.util.array
Class ArrayUShort
- java.lang.Object
-
- org.epics.util.array.ListUShort
-
- org.epics.util.array.ArrayUShort
-
- All Implemented Interfaces:
Serializable
,CollectionNumber
,CollectionUShort
,ListNumber
public final class ArrayUShort extends ListUShort implements Serializable
Non-resizableListUShort
implementation backed by ashort[]
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ArrayUShort(CollectionNumber coll)
Constructs a list containing the values provided by the specified collection in the order returned by its iterator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
short
getShort(int index)
Returns the element at the specified position in this list casted to a short.IteratorUShort
iterator()
Returns an iterator over the elements of the collection.static ArrayUShort
of(short... values)
Returns an unmodifiableArrayUShort
wrapper for the givenshort
array.void
setAll(int index, ListNumber list)
Changes the elements starting at the specified position, taking them based on the internal representation.void
setShort(int index, short value)
Changes the element at the specified position, casting to the internal representation.int
size()
Returns the number of elements in the collection.ArrayUShort
subList(int fromIndex, int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.<T> T
toArray(T array)
-
-
-
Constructor Detail
-
ArrayUShort
public ArrayUShort(CollectionNumber coll)
Constructs a list containing the values provided by the specified collection in the order returned by its iterator.- Parameters:
coll
- the collection whose values will be placed in this list
-
-
Method Detail
-
iterator
public final IteratorUShort iterator()
Description copied from interface:CollectionNumber
Returns an iterator over the elements of the collection.- Specified by:
iterator
in interfaceCollectionNumber
- Specified by:
iterator
in interfaceCollectionUShort
- Overrides:
iterator
in classListUShort
- Returns:
- a new iterator
-
size
public final int size()
Description copied from interface:CollectionNumber
Returns the number of elements in the collection.- Specified by:
size
in interfaceCollectionNumber
- Returns:
- the number of elements in the collection
-
getShort
public short getShort(int index)
Description copied from interface:ListNumber
Returns the element at the specified position in this list casted to a short.- Specified by:
getShort
in interfaceListNumber
- Parameters:
index
- position of the element to return- Returns:
- the element at the specified position in this list
-
setShort
public void setShort(int index, short value)
Description copied from interface:ListNumber
Changes the element at the specified position, casting to the internal representation.- Specified by:
setShort
in interfaceListNumber
- Overrides:
setShort
in classListUShort
- Parameters:
index
- position of the element to changevalue
- the new value
-
subList
public ArrayUShort subList(int fromIndex, int toIndex)
Description copied from interface:ListNumber
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.- Specified by:
subList
in interfaceListNumber
- Overrides:
subList
in classListUShort
- Parameters:
fromIndex
- low endpoint (inclusive) of the subListtoIndex
- high endpoint (exclusive) of the subList- Returns:
- a view of the specified range within this list
-
setAll
public void setAll(int index, ListNumber list)
Description copied from interface:ListNumber
Changes the elements starting at the specified position, taking them based on the internal representation.- Specified by:
setAll
in interfaceListNumber
- Overrides:
setAll
in classListUShort
- Parameters:
index
- position of the first element to changelist
- the new values
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classListUShort
-
toArray
public <T> T toArray(T array)
- Specified by:
toArray
in interfaceCollectionNumber
- Type Parameters:
T
- the type of the array- Parameters:
array
- the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.- Returns:
- an array containing the elements
-
of
public static ArrayUShort of(short... values)
Returns an unmodifiableArrayUShort
wrapper for the givenshort
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
-