Package com.luciad.util.collections
Class TLcdShortArrayList
- All Implemented Interfaces:
ILcdShortList,ILcdCloneable,Cloneable,Iterable<Short>,Collection<Short>,List<Short>,SequencedCollection<Short>
Array-based implementation of
ILcdShortList.- Since:
- 9.0
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new, emptyTLcdShortArrayList.TLcdShortArrayList(int aInitialCapacity) Creates a new, emptyTLcdShortArrayListwith the specified initial capacity. -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanaddAll(int aIndex, short[] aValues, int aOffset, int aLength) AddsaLengthboolean values from the given array to this list, starting from the givenaOffsetbooleanaddAll(int index, Collection<? extends Short> c) booleanaddAll(Collection<? extends Short> c) voidaddShort(int aIndex, short aValue) Inserts the specified value at the specified position in this list (optional operation).booleanaddShort(short aValue) Appends the specified value to the end of this list (optional operation).voidclear()clone()Creates and returns a copy of this object.booleanbooleancontainsShort(short aValue) Returnstrueif this list contains the specified value.voidensureCapacity(int minCapacity) Increases the capacity of this list to the specified capacity.get(int index) shortgetShort(int aIndex) Returns the value at the specified position in this list.intintindexOfShort(short aValue) Returns the index of the first occurrence of the specified value in this list, or -1 if this list does not contain the value.intlastIndexOf(Object aO) intlastIndexOfShort(short aValue) Returns the index of the last occurrence of the specified value in this list, or -1 if this list does not contain the value.remove(int index) shortremoveShort(int aIndex) Removes the value at the specified position in this list (optional operation).booleanremoveShort(short aValue) Removes the first occurrence of the specified value from this list, if it is present (optional operation).shortsetShort(int aIndex, short aValue) Replaces the value at the specified position in this list with the specified value (optional operation).intsize()short[]Returns an array containing all of the values in this list in proper sequence (from first to last value).short[]toShortArray(short[] anArray) Returns an array containing all of the values in this list in proper sequence (from first to last value); If the list fits in the specified array, t is returned therein.voidTrims the internal data array of this list to match the size of this list.Methods inherited from class java.util.AbstractList
add, equals, hashCode, iterator, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface com.luciad.util.collections.ILcdShortList
addAll, addAll, addAllMethods inherited from interface java.util.List
add, addFirst, addLast, containsAll, equals, getFirst, getLast, hashCode, isEmpty, iterator, listIterator, listIterator, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
TLcdShortArrayList
public TLcdShortArrayList()Creates a new, emptyTLcdShortArrayList. -
TLcdShortArrayList
public TLcdShortArrayList(int aInitialCapacity) Creates a new, emptyTLcdShortArrayListwith the specified initial capacity.- Parameters:
aInitialCapacity- the initial capacity of this list.
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<Short>- Specified by:
sizein interfaceList<Short>- Specified by:
sizein classAbstractCollection<Short>
-
get
-
set
-
add
-
addAll
- Specified by:
addAllin interfaceCollection<Short>- Specified by:
addAllin interfaceList<Short>- Overrides:
addAllin classAbstractCollection<Short>
-
addAll
-
addAll
public boolean addAll(int aIndex, short[] aValues, int aOffset, int aLength) Description copied from interface:ILcdShortListAddsaLengthboolean values from the given array to this list, starting from the givenaOffset- Specified by:
addAllin interfaceILcdShortList- Parameters:
aIndex- The position in this list where to start inserting the given boolean values.aValues- The array containing the boolean values to add to this listaOffset- The offset inaValuesfrom where to start copying the boolean valuesaLength- The number of boolean values to copy fromaValuesto this list.- Returns:
- Whether this list was modified as a result of this call.
-
remove
-
getShort
public short getShort(int aIndex) Description copied from interface:ILcdShortListReturns the value at the specified position in this list.- Specified by:
getShortin interfaceILcdShortList- Parameters:
aIndex- index of the value to return- Returns:
- the value at the specified position in this list
-
setShort
public short setShort(int aIndex, short aValue) Description copied from interface:ILcdShortListReplaces the value at the specified position in this list with the specified value (optional operation).- Specified by:
setShortin interfaceILcdShortList- Parameters:
aIndex- index of the value to replaceaValue- value to be stored at the specified position- Returns:
- the value previously at the specified position
-
addShort
public boolean addShort(short aValue) Description copied from interface:ILcdShortListAppends the specified value to the end of this list (optional operation).- Specified by:
addShortin interfaceILcdShortList- Parameters:
aValue- value to be appended to this list- Returns:
true
-
addShort
public void addShort(int aIndex, short aValue) Description copied from interface:ILcdShortListInserts the specified value at the specified position in this list (optional operation). Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices).- Specified by:
addShortin interfaceILcdShortList- Parameters:
aIndex- index at which the specified value is to be insertedaValue- value to be inserted
-
removeShort
public boolean removeShort(short aValue) Description copied from interface:ILcdShortListRemoves the first occurrence of the specified value from this list, if it is present (optional operation). If this list does not contain the value, it is unchanged. Returnstrueif this list contained the specified value (or equivalently, if this list changed as a result of the call).- Specified by:
removeShortin interfaceILcdShortList- Parameters:
aValue- value to be removed from this list, if present- Returns:
trueif this list contained the specified value
-
removeShort
public short removeShort(int aIndex) Description copied from interface:ILcdShortListRemoves the value at the specified position in this list (optional operation). Shifts any subsequent values to the left (subtracts one from their indices). Returns the value that was removed from the list.- Specified by:
removeShortin interfaceILcdShortList- Parameters:
aIndex- the index of the value to be removed- Returns:
- the value previously at the specified position
-
toShortArray
public short[] toShortArray()Description copied from interface:ILcdShortListReturns an array containing all of the values in this list in proper sequence (from first to last value). The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array even if this list is backed by an array). The caller is thus free to modify the returned array.- Specified by:
toShortArrayin interfaceILcdShortList- Returns:
- an array containing all of the values in this list in proper sequence
-
toShortArray
public short[] toShortArray(short[] anArray) Description copied from interface:ILcdShortListReturns an array containing all of the values in this list in proper sequence (from first to last value); If the list fits in the specified array, t is returned therein. Otherwise, a new array is allocated with the size of this list. If the list fits in the specified array with room to spare (i.e., the array has more values than the list), the value in the array immediately following the end of the list is set to 0. (This is useful in determining the length of the list only if the caller knows that the list does not contain any 0 values.)- Specified by:
toShortArrayin interfaceILcdShortList- Parameters:
anArray- the array into which the values of this list are to be stored, if it is big enough; otherwise, a new array is allocated for this purpose.- Returns:
- an array containing the values of this list
-
clear
public void clear()- Specified by:
clearin interfaceCollection<Short>- Specified by:
clearin interfaceList<Short>- Overrides:
clearin classAbstractList<Short>
-
clone
Description copied from interface:ILcdShortListCreates and returns a copy of this object.- Specified by:
clonein interfaceILcdCloneable- Specified by:
clonein interfaceILcdShortList- Overrides:
clonein classObject- Returns:
- a copy of this object.
- See Also:
-
ensureCapacity
public void ensureCapacity(int minCapacity) Increases the capacity of this list to the specified capacity. This method has no effect if the specified capacity is smaller than the current capacity.- Parameters:
minCapacity- the new capacity for this list.
-
trimToSize
public void trimToSize()Trims the internal data array of this list to match the size of this list. -
indexOf
-
indexOfShort
public int indexOfShort(short aValue) Description copied from interface:ILcdShortListReturns the index of the first occurrence of the specified value in this list, or -1 if this list does not contain the value.- Specified by:
indexOfShortin interfaceILcdShortList- Parameters:
aValue- value to search for- Returns:
- the index of the first occurrence of the specified value in this list, or -1 if this list does not contain the value
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<Short>- Overrides:
lastIndexOfin classAbstractList<Short>
-
lastIndexOfShort
public int lastIndexOfShort(short aValue) Description copied from interface:ILcdShortListReturns the index of the last occurrence of the specified value in this list, or -1 if this list does not contain the value.- Specified by:
lastIndexOfShortin interfaceILcdShortList- Parameters:
aValue- value to search for- Returns:
- the index of the last occurrence of the specified value in this list, or -1 if this list does not contain the value
-
containsShort
public boolean containsShort(short aValue) Description copied from interface:ILcdShortListReturnstrueif this list contains the specified value.- Specified by:
containsShortin interfaceILcdShortList- Parameters:
aValue- value whose presence in this list is to be tested- Returns:
trueif this list contains the specified value
-
contains
- Specified by:
containsin interfaceCollection<Short>- Specified by:
containsin interfaceList<Short>- Overrides:
containsin classAbstractCollection<Short>
-