public static class LongLists.Singleton extends AbstractLongList implements java.io.Serializable, java.lang.Cloneable
This class may be useful to implement your own in case you subclass a type-specific list.
AbstractLongList.LongSubList
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(java.util.Collection<? extends java.lang.Long> c)
Delegates to a more generic method.
|
boolean |
addAll(int i,
java.util.Collection<? extends java.lang.Long> c) |
boolean |
addAll(int i,
LongCollection c)
Delegates to a more generic method.
|
boolean |
addAll(LongCollection c)
Adds all elements of the given type-specific collection to this collection.
|
void |
clear() |
java.lang.Object |
clone() |
boolean |
contains(long k) |
long |
getLong(int i) |
LongListIterator |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
LongListIterator |
listIterator()
Returns a type-specific list iterator on the list.
|
LongListIterator |
listIterator(int i)
Returns a type-specific list iterator on the list starting at a given index.
|
boolean |
rem(long k)
Note that this method should be called
remove() , but the clash
with the similarly named index-based method in the List interface
forces us to use a distinguished name. |
boolean |
removeAll(java.util.Collection<?> c)
Remove from this collection all elements in the given collection.
|
long |
removeLong(int i) |
boolean |
retainAll(java.util.Collection<?> c)
Retains in this collection only elements from the given collection.
|
int |
size() |
void |
size(int size)
Sets the size of this list.
|
LongList |
subList(int from,
int to)
Returns a type-specific view of the portion of this list from the index
from , inclusive, to the index to , exclusive. |
long[] |
toLongArray()
Returns a primitive type array containing the items of this collection.
|
add, add, add, addAll, addAll, addElements, addElements, compareTo, equals, get, getElements, hashCode, indexOf, indexOf, lastIndexOf, lastIndexOf, longListIterator, longListIterator, longSubList, peek, peekLong, pop, popLong, push, push, remove, remove, removeElements, set, set, top, topLong, toString
add, contains, containsAll, containsAll, isEmpty, longIterator, rem, removeAll, retainAll, toArray, toArray, toArray, toLongArray
add, contains, containsAll, isEmpty, replaceAll, sort, spliterator, toArray, toArray
containsAll, longIterator, removeAll, retainAll, toArray, toArray, toLongArray
public long getLong(int i)
public long removeLong(int i)
removeLong
in interface LongList
removeLong
in class AbstractLongList
List.remove(int)
public boolean contains(long k)
contains
in interface LongCollection
contains
in class AbstractLongList
Collection.contains(Object)
public boolean addAll(java.util.Collection<? extends java.lang.Long> c)
AbstractLongList
addAll
in interface java.util.Collection<java.lang.Long>
addAll
in interface java.util.List<java.lang.Long>
addAll
in class AbstractLongList
c
- a collection.true
if this collection changed as a result of the call.public boolean addAll(int i, java.util.Collection<? extends java.lang.Long> c)
addAll
in interface java.util.List<java.lang.Long>
addAll
in class AbstractLongList
public boolean removeAll(java.util.Collection<?> c)
AbstractLongCollection
removeAll
in interface java.util.Collection<java.lang.Long>
removeAll
in interface java.util.List<java.lang.Long>
removeAll
in class AbstractLongCollection
c
- a collection.true
if this collection changed as a result of the call.public boolean retainAll(java.util.Collection<?> c)
AbstractLongCollection
retainAll
in interface java.util.Collection<java.lang.Long>
retainAll
in interface java.util.List<java.lang.Long>
retainAll
in class AbstractLongCollection
c
- a collection.true
if this collection changed as a result of the call.public long[] toLongArray()
LongCollection
toLongArray
in interface LongCollection
toLongArray
in class AbstractLongCollection
Collection.toArray()
public LongListIterator listIterator()
LongList
listIterator
in interface LongList
listIterator
in interface java.util.List<java.lang.Long>
listIterator
in class AbstractLongList
List.listIterator()
public LongListIterator iterator()
LongCollection
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 extends Collection
.
iterator
in interface LongCollection
iterator
in interface LongIterable
iterator
in interface LongList
iterator
in interface java.lang.Iterable<java.lang.Long>
iterator
in interface java.util.Collection<java.lang.Long>
iterator
in interface java.util.List<java.lang.Long>
iterator
in class AbstractLongList
public LongListIterator listIterator(int i)
LongList
listIterator
in interface LongList
listIterator
in interface java.util.List<java.lang.Long>
listIterator
in class AbstractLongList
List.listIterator(int)
public LongList subList(int from, int to)
LongList
from
, inclusive, to the index to
, exclusive.
Note that this specification strengthens the one given in List.subList(int,int)
.
subList
in interface LongList
subList
in interface java.util.List<java.lang.Long>
subList
in class AbstractLongList
List.subList(int,int)
public int size()
size
in interface java.util.Collection<java.lang.Long>
size
in interface java.util.List<java.lang.Long>
size
in class java.util.AbstractCollection<java.lang.Long>
public void size(int size)
LongList
If the specified size is smaller than the current size, the last elements are
discarded. Otherwise, they are filled with 0/null
/false
.
size
in interface LongList
size
in class AbstractLongList
size
- the new size.public void clear()
clear
in interface java.util.Collection<java.lang.Long>
clear
in interface java.util.List<java.lang.Long>
clear
in class java.util.AbstractCollection<java.lang.Long>
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean rem(long k)
LongCollection
remove()
, but the clash
with the similarly named index-based method in the List
interface
forces us to use a distinguished name. For simplicity, the set interfaces reinstates
remove()
.rem
in interface LongCollection
rem
in class AbstractLongList
Collection.remove(Object)
public boolean addAll(LongCollection c)
AbstractLongCollection
addAll
in interface LongCollection
addAll
in class AbstractLongList
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.addAll(Collection)
public boolean addAll(int i, LongCollection c)
AbstractLongList
addAll
in interface LongList
addAll
in class AbstractLongList
List.add(int,Object)