Class TLcdShortArrayList

java.lang.Object
java.util.AbstractCollection<Short>
java.util.AbstractList<Short>
com.luciad.util.collections.TLcdShortArrayList
All Implemented Interfaces:
ILcdShortList, ILcdCloneable, Cloneable, Iterable<Short>, Collection<Short>, List<Short>, SequencedCollection<Short>

public class TLcdShortArrayList extends AbstractList<Short> implements Cloneable, ILcdShortList
Array-based implementation of ILcdShortList.
Since:
9.0
  • Constructor Details

    • TLcdShortArrayList

      public TLcdShortArrayList()
      Creates a new, empty TLcdShortArrayList.
    • TLcdShortArrayList

      public TLcdShortArrayList(int aInitialCapacity)
      Creates a new, empty TLcdShortArrayList with the specified initial capacity.
      Parameters:
      aInitialCapacity - the initial capacity of this list.
  • Method Details

    • size

      public int size()
      Specified by:
      size in interface Collection<Short>
      Specified by:
      size in interface List<Short>
      Specified by:
      size in class AbstractCollection<Short>
    • get

      public Short get(int index)
      Specified by:
      get in interface List<Short>
      Specified by:
      get in class AbstractList<Short>
    • set

      public Short set(int index, Short element)
      Specified by:
      set in interface List<Short>
      Overrides:
      set in class AbstractList<Short>
    • add

      public void add(int index, Short element)
      Specified by:
      add in interface List<Short>
      Overrides:
      add in class AbstractList<Short>
    • addAll

      public boolean addAll(Collection<? extends Short> c)
      Specified by:
      addAll in interface Collection<Short>
      Specified by:
      addAll in interface List<Short>
      Overrides:
      addAll in class AbstractCollection<Short>
    • addAll

      public boolean addAll(int index, Collection<? extends Short> c)
      Specified by:
      addAll in interface List<Short>
      Overrides:
      addAll in class AbstractList<Short>
    • addAll

      public boolean addAll(int aIndex, short[] aValues, int aOffset, int aLength)
      Description copied from interface: ILcdShortList
      Adds aLength boolean values from the given array to this list, starting from the given aOffset
      Specified by:
      addAll in interface ILcdShortList
      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 list
      aOffset - The offset in aValues from where to start copying the boolean values
      aLength - The number of boolean values to copy from aValues to this list.
      Returns:
      Whether this list was modified as a result of this call.
    • remove

      public Short remove(int index)
      Specified by:
      remove in interface List<Short>
      Overrides:
      remove in class AbstractList<Short>
    • getShort

      public short getShort(int aIndex)
      Description copied from interface: ILcdShortList
      Returns the value at the specified position in this list.
      Specified by:
      getShort in interface ILcdShortList
      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: ILcdShortList
      Replaces the value at the specified position in this list with the specified value (optional operation).
      Specified by:
      setShort in interface ILcdShortList
      Parameters:
      aIndex - index of the value to replace
      aValue - 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: ILcdShortList
      Appends the specified value to the end of this list (optional operation).
      Specified by:
      addShort in interface ILcdShortList
      Parameters:
      aValue - value to be appended to this list
      Returns:
      true
    • addShort

      public void addShort(int aIndex, short aValue)
      Description copied from interface: ILcdShortList
      Inserts 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:
      addShort in interface ILcdShortList
      Parameters:
      aIndex - index at which the specified value is to be inserted
      aValue - value to be inserted
    • removeShort

      public boolean removeShort(short aValue)
      Description copied from interface: ILcdShortList
      Removes 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. Returns true if this list contained the specified value (or equivalently, if this list changed as a result of the call).
      Specified by:
      removeShort in interface ILcdShortList
      Parameters:
      aValue - value to be removed from this list, if present
      Returns:
      true if this list contained the specified value
    • removeShort

      public short removeShort(int aIndex)
      Description copied from interface: ILcdShortList
      Removes 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:
      removeShort in interface ILcdShortList
      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: ILcdShortList
      Returns 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:
      toShortArray in interface ILcdShortList
      Returns:
      an array containing all of the values in this list in proper sequence
    • toShortArray

      public short[] toShortArray(short[] anArray)
      Description copied from interface: ILcdShortList
      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. 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:
      toShortArray in interface ILcdShortList
      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:
      clear in interface Collection<Short>
      Specified by:
      clear in interface List<Short>
      Overrides:
      clear in class AbstractList<Short>
    • clone

      public TLcdShortArrayList clone()
      Description copied from interface: ILcdShortList
      Creates and returns a copy of this object.
      Specified by:
      clone in interface ILcdCloneable
      Specified by:
      clone in interface ILcdShortList
      Overrides:
      clone in class Object
      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

      public int indexOf(Object aO)
      Specified by:
      indexOf in interface List<Short>
      Overrides:
      indexOf in class AbstractList<Short>
    • indexOfShort

      public int indexOfShort(short aValue)
      Description copied from interface: ILcdShortList
      Returns 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:
      indexOfShort in interface ILcdShortList
      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

      public int lastIndexOf(Object aO)
      Specified by:
      lastIndexOf in interface List<Short>
      Overrides:
      lastIndexOf in class AbstractList<Short>
    • lastIndexOfShort

      public int lastIndexOfShort(short aValue)
      Description copied from interface: ILcdShortList
      Returns 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:
      lastIndexOfShort in interface ILcdShortList
      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: ILcdShortList
      Returns true if this list contains the specified value.
      Specified by:
      containsShort in interface ILcdShortList
      Parameters:
      aValue - value whose presence in this list is to be tested
      Returns:
      true if this list contains the specified value
    • contains

      public boolean contains(Object aO)
      Specified by:
      contains in interface Collection<Short>
      Specified by:
      contains in interface List<Short>
      Overrides:
      contains in class AbstractCollection<Short>