Class ImmutableList.SubList

All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, List<E>, RandomAccess, SequencedCollection<E>
Enclosing class:
ImmutableList<E>

class ImmutableList.SubList extends ImmutableList<E>
  • Field Details

    • offset

      final transient int offset
    • length

      final transient int length
  • Constructor Details

    • SubList

      SubList(int offset, int length)
  • Method Details

    • size

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

      public E get(int index)
    • subList

      public ImmutableList<E> subList(int fromIndex, int toIndex)
      Description copied from class: ImmutableList
      Returns an immutable list of the elements between the specified fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the empty immutable list is returned.)
      Specified by:
      subList in interface List<E>
      Overrides:
      subList in class ImmutableList<E>
    • isPartialView

      boolean isPartialView()
      Description copied from class: ImmutableCollection
      Returns true if this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods. This is generally used to determine whether copyOf implementations should make an explicit copy to avoid memory leaks.
      Specified by:
      isPartialView in class ImmutableCollection<E>