Class UnmodifiableList<E>

  • Type Parameters:
    E - The list item type.
    All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess

    @Immutable
    public class UnmodifiableList<E>
    extends UnmodifiableCollection<E>
    implements java.util.List<E>, java.util.RandomAccess
    Simple unmodifiable list implementation backed by an object array.
    • Method Detail

      • copyOf

        @Nonnull
        public static <E> UnmodifiableList<E> copyOf​(E[] array)
      • copyOf

        @Nonnull
        public static <E> UnmodifiableList<E> copyOf​(java.lang.Iterable<? extends E> iterable)
      • copyOf

        @Nonnull
        public static <E> UnmodifiableList<E> copyOf​(java.util.Iterator<? extends E> iterator)
      • copyOf

        @Nonnull
        public static <E> UnmodifiableList<E> copyOf​(java.util.Enumeration<? extends E> enumeration)
      • copyOf

        @Nonnull
        public static <E> UnmodifiableList<E> copyOf​(java.util.Collection<? extends E> collection)
      • listOf

        @Nonnull
        public static <E> UnmodifiableList<E> listOf​(E e1,
                                                     E e2)
      • listOf

        @Nonnull
        public static <E> UnmodifiableList<E> listOf​(E e1,
                                                     E e2,
                                                     E e3)
      • listOf

        @Nonnull
        public static <E> UnmodifiableList<E> listOf​(E e1,
                                                     E e2,
                                                     E e3,
                                                     E e4)
      • listOf

        @Nonnull
        public static <E> UnmodifiableList<E> listOf​(E e1,
                                                     E e2,
                                                     E e3,
                                                     E e4,
                                                     E e5)
      • listOf

        @Nonnull
        public static <E> UnmodifiableList<E> listOf​(E e1,
                                                     E e2,
                                                     E e3,
                                                     E e4,
                                                     E e5,
                                                     E e6)
      • listOf

        @Nonnull
        public static <E> UnmodifiableList<E> listOf​(E e1,
                                                     E e2,
                                                     E e3,
                                                     E e4,
                                                     E e5,
                                                     E e6,
                                                     E e7)
      • listOf

        @Nonnull
        public static <E> UnmodifiableList<E> listOf​(E e1,
                                                     E e2,
                                                     E e3,
                                                     E e4,
                                                     E e5,
                                                     E e6,
                                                     E e7,
                                                     E e8)
      • listOf

        @Nonnull
        public static <E> UnmodifiableList<E> listOf​(E e1,
                                                     E e2,
                                                     E e3,
                                                     E e4,
                                                     E e5,
                                                     E e6,
                                                     E e7,
                                                     E e8,
                                                     E e9)
      • listOf

        @Nonnull
        @SafeVarargs
        public static <E> UnmodifiableList<E> listOf​(E e1,
                                                     E e2,
                                                     E e3,
                                                     E e4,
                                                     E e5,
                                                     E e6,
                                                     E e7,
                                                     E e8,
                                                     E e9,
                                                     E e10,
                                                     E... more)
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<E>
        Specified by:
        hashCode in interface java.util.List<E>
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface java.util.Collection<E>
        Specified by:
        equals in interface java.util.List<E>
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • addAll

        public boolean addAll​(int i,
                              @Nonnull
                              java.util.Collection<? extends E> collection)
        Specified by:
        addAll in interface java.util.List<E>
      • get

        public E get​(int i)
        Specified by:
        get in interface java.util.List<E>
      • set

        public E set​(int i,
                     E e)
        Specified by:
        set in interface java.util.List<E>
      • add

        public void add​(int i,
                        E e)
        Specified by:
        add in interface java.util.List<E>
      • remove

        public E remove​(int i)
        Specified by:
        remove in interface java.util.List<E>
      • indexOf

        public int indexOf​(java.lang.Object o)
        Specified by:
        indexOf in interface java.util.List<E>
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object o)
        Specified by:
        lastIndexOf in interface java.util.List<E>
      • listIterator

        @Nonnull
        public java.util.ListIterator<E> listIterator()
        Specified by:
        listIterator in interface java.util.List<E>
      • listIterator

        @Nonnull
        public java.util.ListIterator<E> listIterator​(int i)
        Specified by:
        listIterator in interface java.util.List<E>
      • subList

        @Nonnull
        public java.util.List<E> subList​(int start,
                                         int end)
        Specified by:
        subList in interface java.util.List<E>