public static class LongLists.Singleton extends AbstractLongList implements Serializable, 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(Collection<? extends Long> c)
Delegates to a more generic method.
|
boolean |
addAll(int i,
Collection<? extends 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() |
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)
|
boolean |
removeAll(Collection<?> c)
Remove from this collection all elements in the given collection.
|
long |
removeLong(int i) |
boolean |
retainAll(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, toArray, toArray
containsAll, longIterator, removeAll, retainAll, toArray, toArray, toLongArray
public long getLong(int i)
getLong
in interface LongList
List.get(int)
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(Collection<? extends Long> c)
AbstractLongList
addAll
in interface Collection<Long>
addAll
in interface List<Long>
addAll
in class AbstractLongList
c
- a collection.true
if this collection changed as a result of the call.public boolean addAll(int i, Collection<? extends Long> c)
addAll
in interface List<Long>
addAll
in class AbstractLongList
public boolean removeAll(Collection<?> c)
AbstractLongCollection
removeAll
in interface Collection<Long>
removeAll
in interface List<Long>
removeAll
in class AbstractLongCollection
c
- a collection.true
if this collection changed as a result of the call.public boolean retainAll(Collection<?> c)
AbstractLongCollection
retainAll
in interface Collection<Long>
retainAll
in interface List<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 List<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 Iterable<Long>
iterator
in interface Collection<Long>
iterator
in interface List<Long>
iterator
in class AbstractLongList
public LongListIterator listIterator(int i)
LongList
listIterator
in interface LongList
listIterator
in interface List<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 List<Long>
subList
in class AbstractLongList
List.subList(int,int)
public int size()
size
in interface Collection<Long>
size
in interface List<Long>
size
in class AbstractCollection<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 Collection<Long>
clear
in interface List<Long>
clear
in class AbstractCollection<Long>
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)