Package net.morimekta.util.collect
Class UnmodifiableList<E>
- java.lang.Object
-
- net.morimekta.util.collect.UnmodifiableCollection<E>
-
- net.morimekta.util.collect.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UnmodifiableList.Builder<E>
-
Field Summary
-
Fields inherited from class net.morimekta.util.collect.UnmodifiableCollection
array, length, offset
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int i, E e)
boolean
addAll(int i, java.util.Collection<? extends E> collection)
UnmodifiableList<E>
asList()
Get the collection as an unmodifiable random access list.static <E> UnmodifiableList.Builder<E>
builder()
static <E> UnmodifiableList.Builder<E>
builder(int initialCapacity)
static <E> UnmodifiableList<E>
copyOf(E[] array)
static <E> UnmodifiableList<E>
copyOf(java.lang.Iterable<? extends E> iterable)
static <E> UnmodifiableList<E>
copyOf(java.util.Collection<? extends E> collection)
static <E> UnmodifiableList<E>
copyOf(java.util.Enumeration<? extends E> enumeration)
static <E> UnmodifiableList<E>
copyOf(java.util.Iterator<? extends E> iterator)
boolean
equals(java.lang.Object obj)
E
get(int i)
int
hashCode()
int
indexOf(java.lang.Object o)
int
lastIndexOf(java.lang.Object o)
java.util.ListIterator<E>
listIterator()
java.util.ListIterator<E>
listIterator(int i)
static <E> UnmodifiableList<E>
listOf()
static <E> UnmodifiableList<E>
listOf(E e)
static <E> UnmodifiableList<E>
listOf(E e1, E e2)
static <E> UnmodifiableList<E>
listOf(E e1, E e2, E e3)
static <E> UnmodifiableList<E>
listOf(E e1, E e2, E e3, E e4)
static <E> UnmodifiableList<E>
listOf(E e1, E e2, E e3, E e4, E e5)
static <E> UnmodifiableList<E>
listOf(E e1, E e2, E e3, E e4, E e5, E e6)
static <E> UnmodifiableList<E>
listOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7)
static <E> UnmodifiableList<E>
listOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8)
static <E> UnmodifiableList<E>
listOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9)
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)
E
remove(int i)
E
set(int i, E e)
java.util.List<E>
subList(int start, int end)
java.lang.String
toString()
-
Methods inherited from class net.morimekta.util.collect.UnmodifiableCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, removeIf, retainAll, size, toArray, toArray
-
-
-
-
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()
-
listOf
@Nonnull public static <E> UnmodifiableList<E> listOf(E e)
-
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)
-
builder
@Nonnull public static <E> UnmodifiableList.Builder<E> builder()
-
builder
@Nonnull public static <E> UnmodifiableList.Builder<E> builder(int initialCapacity)
-
hashCode
public int hashCode()
-
equals
public boolean equals(java.lang.Object obj)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
addAll
public boolean addAll(int i, @Nonnull java.util.Collection<? extends E> collection)
- Specified by:
addAll
in interfacejava.util.List<E>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interfacejava.util.List<E>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<E>
-
listIterator
@Nonnull public java.util.ListIterator<E> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<E>
-
listIterator
@Nonnull public java.util.ListIterator<E> listIterator(int i)
- Specified by:
listIterator
in interfacejava.util.List<E>
-
subList
@Nonnull public java.util.List<E> subList(int start, int end)
- Specified by:
subList
in interfacejava.util.List<E>
-
asList
@Nonnull public UnmodifiableList<E> asList()
Description copied from class:UnmodifiableCollection
Get the collection as an unmodifiable random access list.- Overrides:
asList
in classUnmodifiableCollection<E>
- Returns:
- The unmodifiable list.
-
-