Class AbstractByteList.ByteSubList

All Implemented Interfaces:
ByteCollection, ByteIterable, ByteList, ByteStack, Stack<Byte>, Serializable, Comparable<List<? extends Byte>>, Iterable<Byte>, Collection<Byte>, List<Byte>, SequencedCollection<Byte>
Direct Known Subclasses:
AbstractByteList.ByteRandomAccessSubList
Enclosing class:
AbstractByteList

public static class AbstractByteList.ByteSubList extends AbstractByteList implements Serializable
A class implementing a sublist view.
See Also:
  • Constructor Details

    • ByteSubList

      public ByteSubList(ByteList l, int from, int to)
  • Method Details

    • add

      public boolean add(byte k)
      Description copied from class: AbstractByteList
      Ensures that this collection contains the specified element (optional operation).
      Specified by:
      add in interface ByteCollection
      Specified by:
      add in interface ByteList
      Overrides:
      add in class AbstractByteList
      See Also:
    • add

      public void add(int index, byte k)
      Description copied from class: AbstractByteList
      Inserts the specified element at the specified position in this list (optional operation).
      Specified by:
      add in interface ByteList
      Overrides:
      add in class AbstractByteList
      See Also:
    • addAll

      public boolean addAll(int index, Collection<? extends Byte> c)
      Description copied from class: AbstractByteList
      Adds all of the elements in the specified collection to this list (optional operation).
      Specified by:
      addAll in interface List<Byte>
      Overrides:
      addAll in class AbstractByteList
    • getByte

      public byte getByte(int index)
      Description copied from interface: ByteList
      Returns the element at the specified position in this list.
      Specified by:
      getByte in interface ByteList
      See Also:
    • removeByte

      public byte removeByte(int index)
      Description copied from class: AbstractByteList
      Removes the element at the specified position in this list (optional operation).
      Specified by:
      removeByte in interface ByteList
      Overrides:
      removeByte in class AbstractByteList
      See Also:
    • set

      public byte set(int index, byte k)
      Description copied from class: AbstractByteList
      Replaces the element at the specified position in this list with the specified element (optional operation).
      Specified by:
      set in interface ByteList
      Overrides:
      set in class AbstractByteList
      See Also:
    • size

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

      public void getElements(int from, byte[] a, int offset, int length)
      Description copied from class: AbstractByteList
      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 ByteList
      Overrides:
      getElements in class AbstractByteList
      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.
    • removeElements

      public void removeElements(int from, int to)
      Description copied from class: AbstractByteList
      Removes (hopefully quickly) elements of this type-specific list.

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

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

      public void addElements(int index, byte[] a, int offset, int length)
      Description copied from class: AbstractByteList
      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 ByteList
      Overrides:
      addElements in class AbstractByteList
      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.
    • setElements

      public void setElements(int index, byte[] a, int offset, int length)
      Description copied from interface: ByteList
      Set (hopefully quickly) elements to match the array given. Sets each in this list to the corresponding elements in the array, as if by
       ListIterator iter = listIterator(index);
       int i = 0;
       while (i < length) {
              iter.next();
              iter.set(a[offset + i++]);
       }
       
      However, the exact implementation may be more efficient, taking into account whether random access is faster or not, or at the discretion of subclasses, abuse internals.
      Specified by:
      setElements in interface ByteList
      Overrides:
      setElements in class AbstractByteList
      Parameters:
      index - the index at which to start setting elements.
      a - the array containing the elements
      offset - the offset of the first element to add.
      length - the number of elements to add.
    • listIterator

      public ByteListIterator listIterator(int index)
      Description copied from class: AbstractByteList
      Returns a type-specific list iterator on the list starting at a given index.
      Specified by:
      listIterator in interface ByteList
      Specified by:
      listIterator in interface List<Byte>
      Overrides:
      listIterator in class AbstractByteList
      See Also:
    • spliterator

      public ByteSpliterator spliterator()
      Description copied from interface: ByteCollection
      Returns a type-specific spliterator on the elements of this collection.

      See Collection.spliterator() for more documentation on the requirements of the returned spliterator.

      Specified by:
      spliterator in interface ByteCollection
      Specified by:
      spliterator in interface ByteIterable
      Specified by:
      spliterator in interface ByteList
      Specified by:
      spliterator in interface Collection<Byte>
      Specified by:
      spliterator in interface Iterable<Byte>
      Specified by:
      spliterator in interface List<Byte>
      Returns:
      a type-specific spliterator on the elements of this collection.
    • subList

      public ByteList subList(int from, int to)
      Description copied from interface: ByteList
      Returns a type-specific view of the portion of this list from the index from, inclusive, to the index to, exclusive.
      Specified by:
      subList in interface ByteList
      Specified by:
      subList in interface List<Byte>
      Overrides:
      subList in class AbstractByteList
      See Also:
    • rem

      public boolean rem(byte k)
      Description copied from class: AbstractByteList
      Removes a single instance of the specified element from this collection, if it is present (optional operation).
      Specified by:
      rem in interface ByteCollection
      Overrides:
      rem in class AbstractByteList
      See Also:
    • addAll

      public boolean addAll(int index, ByteCollection c)
      Description copied from interface: ByteList
      Inserts all of the elements in the specified type-specific collection into this type-specific list at the specified position (optional operation).
      Specified by:
      addAll in interface ByteList
      Overrides:
      addAll in class AbstractByteList
      See Also:
    • addAll

      public boolean addAll(int index, ByteList l)
      Description copied from interface: ByteList
      Inserts all of the elements in the specified type-specific list into this type-specific list at the specified position (optional operation).
      Specified by:
      addAll in interface ByteList
      See Also: