Class ImmutableList.SubList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess
    Enclosing class:
    ImmutableList<E>

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

      • offset

        final transient int offset
      • length

        final transient int length
    • Constructor Detail

      • SubList

        SubList​(int offset,
                int length)
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E>
        Specified by:
        size in interface java.util.List<E>
        Specified by:
        size in class java.util.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 java.util.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>