Class AbstractShortList

    • Method Detail

      • addAll

        public boolean addAll​(int index,
                              Collection<? extends Short> c)
        Adds all of the elements in the specified collection to this list (optional operation).
        Specified by:
        addAll in interface List<Short>
      • indexOf

        public int indexOf​(short k)
        Description copied from interface: ShortList
        Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
        Specified by:
        indexOf in interface ShortList
        See Also:
        List.indexOf(Object)
      • lastIndexOf

        public int lastIndexOf​(short k)
        Description copied from interface: ShortList
        Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
        Specified by:
        lastIndexOf in interface ShortList
        See Also:
        List.lastIndexOf(Object)
      • size

        public void size​(int size)
        Description copied from interface: ShortList
        Sets the size of this list.

        If the specified size is smaller than the current size, the last elements are discarded. Otherwise, they are filled with 0/null/false.

        Specified by:
        size in interface ShortList
        Parameters:
        size - the new size.
      • removeElements

        public void removeElements​(int from,
                                   int to)
        Removes (hopefully quickly) elements of this type-specific list.

        This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.

        Specified by:
        removeElements in interface ShortList
        Parameters:
        from - the start index (inclusive).
        to - the end index (exclusive).
      • addElements

        public void addElements​(int index,
                                short[] a,
                                int offset,
                                int length)
        Add (hopefully quickly) elements to this type-specific list.

        This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.

        Specified by:
        addElements in interface ShortList
        Parameters:
        index - the index at which to add elements.
        a - the array containing the elements.
        offset - the offset of the first element to add.
        length - the number of elements to add.
      • addElements

        public void addElements​(int index,
                                short[] a)
        Add (hopefully quickly) elements to this type-specific list.

        This implementation delegates to the analogous method for array fragments.

        Specified by:
        addElements in interface ShortList
        Parameters:
        index - the index at which to add elements.
        a - the array containing the elements.
      • getElements

        public void getElements​(int from,
                                short[] a,
                                int offset,
                                int length)
        Copies (hopefully quickly) elements of this type-specific list into the given array.

        This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.

        Specified by:
        getElements in interface ShortList
        Parameters:
        from - the start index (inclusive).
        a - the destination array.
        offset - the offset into the destination array where to store the first element copied.
        length - the number of elements to be copied.
      • compareTo

        public int compareTo​(List<? extends Short> l)
        Compares this list to another object. If the argument is a List, this method performs a lexicographical comparison; otherwise, it throws a ClassCastException.
        Specified by:
        compareTo in interface Comparable<List<? extends Short>>
        Parameters:
        l - a list.
        Returns:
        if the argument is a List, a negative integer, zero, or a positive integer as this list is lexicographically less than, equal to, or greater than the argument.
        Throws:
        ClassCastException - if the argument is not a list.
      • push

        public void push​(short o)
        Description copied from interface: ShortStack
        Pushes the given object on the stack.
        Specified by:
        push in interface ShortStack
        Parameters:
        o - the object to push on the stack.
        See Also:
        Stack.push(Object)
      • popShort

        public short popShort()
        Description copied from interface: ShortStack
        Pops the top off the stack.
        Specified by:
        popShort in interface ShortStack
        Returns:
        the top of the stack.
        See Also:
        Stack.pop()
      • topShort

        public short topShort()
        Description copied from interface: ShortStack
        Peeks at the top of the stack (optional operation).
        Specified by:
        topShort in interface ShortStack
        Returns:
        the top of the stack.
        See Also:
        Stack.top()
      • peekShort

        public short peekShort​(int i)
        Description copied from interface: ShortStack
        Peeks at an element on the stack (optional operation).
        Specified by:
        peekShort in interface ShortStack
        Parameters:
        i - an index from the stop of the stack (0 represents the top).
        Returns:
        the i-th element on the stack.
        See Also:
        Stack.peek(int)
      • rem

        public boolean rem​(short k)
        Removes a single instance of the specified element from this collection, if it is present (optional operation).

        This implementation delegates to indexOf().

        Specified by:
        rem in interface ShortCollection
        Overrides:
        rem in class AbstractShortCollection
        See Also:
        List.remove(Object)
      • addAll

        public boolean addAll​(int index,
                              ShortList l)
        Inserts all of the elements in the specified type-specific list into this type-specific list at the specified position (optional operation).

        This implementation delegates to the type-specific version of List.addAll(int, Collection).

        Specified by:
        addAll in interface ShortList
        See Also:
        List.add(int,Object)