Package it.unimi.dsi.fastutil.objects
Class ObjectLists.EmptyList<K>
- java.lang.Object
-
- java.util.AbstractCollection<K>
-
- it.unimi.dsi.fastutil.objects.AbstractObjectCollection<K>
-
- it.unimi.dsi.fastutil.objects.ObjectCollections.EmptyCollection<K>
-
- it.unimi.dsi.fastutil.objects.ObjectLists.EmptyList<K>
-
- All Implemented Interfaces:
ObjectCollection<K>,ObjectIterable<K>,ObjectList<K>,Serializable,Cloneable,Comparable<List<? extends K>>,Iterable<K>,Collection<K>,List<K>,RandomAccess
- Enclosing class:
- ObjectLists
public static class ObjectLists.EmptyList<K> extends ObjectCollections.EmptyCollection<K> implements ObjectList<K>, RandomAccess, Serializable, Cloneable
An immutable class representing an empty type-specific list.This class may be useful to implement your own in case you subclass a type-specific list.
- See Also:
- Serialized Form
-
-
Method Summary
Modifier and Type Method Description voidadd(int index, K k)booleanaddAll(int i, Collection<? extends K> c)voidaddElements(int index, K[] a)Add (hopefully quickly) elements to this type-specific list.voidaddElements(int index, K[] a, int offset, int length)Add (hopefully quickly) elements to this type-specific list.Objectclone()intcompareTo(List<? extends K> o)booleanequals(Object o)Kget(int i)voidgetElements(int from, Object[] a, int offset, int length)Copies (hopefully quickly) elements of this type-specific list into the given array.inthashCode()intindexOf(Object k)ObjectListIterator<K>iterator()Returns a type-specific iterator on the elements of this collection.intlastIndexOf(Object k)ObjectListIterator<K>listIterator()Returns a type-specific list iterator on the list.ObjectListIterator<K>listIterator(int i)Returns a type-specific list iterator on the list starting at a given index.Kremove(int i)booleanremove(Object k)voidremoveElements(int from, int to)Removes (hopefully quickly) elements of this type-specific list.Kset(int index, K k)voidsize(int s)Sets the size of this list.ObjectList<K>subList(int from, int to)Returns a type-specific view of the portion of this list from the indexfrom, inclusive, to the indexto, exclusive.StringtoString()-
Methods inherited from class it.unimi.dsi.fastutil.objects.ObjectCollections.EmptyCollection
addAll, clear, contains, removeAll, retainAll, size, toArray
-
Methods inherited from class java.util.AbstractCollection
add, containsAll, isEmpty, toArray
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, isEmpty, removeAll, replaceAll, retainAll, size, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
remove
public boolean remove(Object k)
- Specified by:
removein interfaceCollection<K>- Specified by:
removein interfaceList<K>- Overrides:
removein classAbstractCollection<K>
-
lastIndexOf
public int lastIndexOf(Object k)
- Specified by:
lastIndexOfin interfaceList<K>
-
addAll
public boolean addAll(int i, Collection<? extends K> c)
-
listIterator
public ObjectListIterator<K> listIterator()
Description copied from interface:ObjectListReturns a type-specific list iterator on the list.- Specified by:
listIteratorin interfaceList<K>- Specified by:
listIteratorin interfaceObjectList<K>- See Also:
List.listIterator()
-
iterator
public ObjectListIterator<K> iterator()
Description copied from interface:ObjectCollectionReturns a type-specific iterator on the elements of this collection.Note that this specification strengthens the one given in
Iterable.iterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extendsCollection.- Specified by:
iteratorin interfaceCollection<K>- Specified by:
iteratorin interfaceIterable<K>- Specified by:
iteratorin interfaceList<K>- Specified by:
iteratorin interfaceObjectCollection<K>- Specified by:
iteratorin interfaceObjectIterable<K>- Specified by:
iteratorin interfaceObjectList<K>- Overrides:
iteratorin classObjectCollections.EmptyCollection<K>- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
listIterator
public ObjectListIterator<K> listIterator(int i)
Description copied from interface:ObjectListReturns a type-specific list iterator on the list starting at a given index.- Specified by:
listIteratorin interfaceList<K>- Specified by:
listIteratorin interfaceObjectList<K>- See Also:
List.listIterator(int)
-
subList
public ObjectList<K> subList(int from, int to)
Description copied from interface:ObjectListReturns a type-specific view of the portion of this list from the indexfrom, inclusive, to the indexto, exclusive.Note that this specification strengthens the one given in
List.subList(int,int).- Specified by:
subListin interfaceList<K>- Specified by:
subListin interfaceObjectList<K>- See Also:
List.subList(int,int)
-
getElements
public void getElements(int from, Object[] a, int offset, int length)Description copied from interface:ObjectListCopies (hopefully quickly) elements of this type-specific list into the given array.- Specified by:
getElementsin interfaceObjectList<K>- Parameters:
from- the start index (inclusive).a- the destination array.offset- the offset into the destination array where to store the first element copied.length- the number of elements to be copied.
-
removeElements
public void removeElements(int from, int to)Description copied from interface:ObjectListRemoves (hopefully quickly) elements of this type-specific list.- Specified by:
removeElementsin interfaceObjectList<K>- Parameters:
from- the start index (inclusive).to- the end index (exclusive).
-
addElements
public void addElements(int index, K[] a, int offset, int length)Description copied from interface:ObjectListAdd (hopefully quickly) elements to this type-specific list.- Specified by:
addElementsin interfaceObjectList<K>- Parameters:
index- the index at which to add elements.a- the array containing the elements.offset- the offset of the first element to add.length- the number of elements to add.
-
addElements
public void addElements(int index, K[] a)Description copied from interface:ObjectListAdd (hopefully quickly) elements to this type-specific list.- Specified by:
addElementsin interfaceObjectList<K>- Parameters:
index- the index at which to add elements.a- the array containing the elements.
-
size
public void size(int s)
Description copied from interface:ObjectListSets the size of this list.If the specified size is smaller than the current size, the last elements are discarded. Otherwise, they are filled with 0/
null/false.- Specified by:
sizein interfaceObjectList<K>- Parameters:
s- the new size.
-
compareTo
public int compareTo(List<? extends K> o)
- Specified by:
compareToin interfaceComparable<K>
-
clone
public Object clone()
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<K>- Specified by:
hashCodein interfaceList<K>- Overrides:
hashCodein classObjectCollections.EmptyCollection<K>
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceCollection<K>- Specified by:
equalsin interfaceList<K>- Overrides:
equalsin classObjectCollections.EmptyCollection<K>
-
toString
public String toString()
- Overrides:
toStringin classAbstractObjectCollection<K>
-
-