Class RegularImmutableList<E>

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

    @GwtCompatible(serializable=true,
                   emulated=true)
    class RegularImmutableList<E>
    extends ImmutableList<E>
    Implementation of ImmutableList backed by a simple array.
    • Field Detail

      • array

        final transient java.lang.Object[] array
    • Constructor Detail

      • RegularImmutableList

        RegularImmutableList​(java.lang.Object[] array)
    • 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>
      • 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>
      • copyIntoArray

        int copyIntoArray​(java.lang.Object[] dst,
                          int dstOff)
        Description copied from class: ImmutableCollection
        Copies the contents of this immutable collection into the specified array at the specified offset. Returns offset + size().
        Overrides:
        copyIntoArray in class ImmutableList<E>
      • get

        public E get​(int index)
      • spliterator

        public java.util.Spliterator<E> spliterator()
        Specified by:
        spliterator in interface java.util.Collection<E>
        Specified by:
        spliterator in interface java.lang.Iterable<E>
        Specified by:
        spliterator in interface java.util.List<E>
        Overrides:
        spliterator in class ImmutableList<E>