public static class LongSets.Singleton extends AbstractLongSet implements java.io.Serializable, java.lang.Cloneable
This class may be useful to implement your own in case you subclass a type-specific set.
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(java.util.Collection<? extends java.lang.Long> c) |
boolean |
addAll(LongCollection c)
Adds all elements of the given type-specific collection to this collection.
|
java.lang.Object |
clone() |
boolean |
contains(long k)
Returns
true if this collection contains the specified element. |
void |
forEach(java.util.function.Consumer<? super java.lang.Long> action)
Deprecated.
|
void |
forEach(java.util.function.LongConsumer action)
Performs the given action for each element of this type-specific
Iterable
until all elements have been processed or the action throws an
exception. |
LongListIterator |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
boolean |
remove(long k)
Removes an element from this set.
|
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
removeAll(LongCollection c)
Remove from this collection all elements in the given type-specific collection.
|
boolean |
removeIf(java.util.function.LongPredicate filter)
Remove from this collection all elements which satisfy the given predicate.
|
boolean |
removeIf(java.util.function.Predicate<? super java.lang.Long> filter)
Deprecated.
|
boolean |
retainAll(java.util.Collection<?> c) |
boolean |
retainAll(LongCollection c)
Retains in this collection only elements from the given type-specific collection.
|
int |
size() |
LongSpliterator |
spliterator()
Returns a type-specific spliterator on the elements of this set.
|
java.lang.Object[] |
toArray()
Deprecated.
|
long[] |
toLongArray()
Returns a primitive type array containing the items of this collection.
|
equals, hashCode, rem
add, add, contains, containsAll, containsAll, forEach, remove, removeIf, toArray, toLongArray, toString
add, contains, of, of, of, of, of, remove
add, containsAll, longIterator, longParallelStream, longSpliterator, longStream, parallelStream, removeIf, stream, toArray, toLongArray
forEach
public boolean contains(long k)
AbstractLongCollection
true
if this collection contains the specified element.contains
in interface LongCollection
contains
in class AbstractLongCollection
Collection.contains(Object)
public boolean remove(long k)
AbstractLongSet
rem()
method
implemented by type-specific abstract Collection
superclass.remove
in interface LongSet
remove
in class AbstractLongSet
Collection.remove(Object)
public LongListIterator iterator()
LongCollection
iterator
in interface LongCollection
iterator
in interface LongIterable
iterator
in interface LongSet
iterator
in interface java.lang.Iterable<java.lang.Long>
iterator
in interface java.util.Collection<java.lang.Long>
iterator
in interface java.util.Set<java.lang.Long>
iterator
in class AbstractLongSet
Iterable.iterator()
public LongSpliterator spliterator()
LongSet
Set spliterators must report at least Spliterator.DISTINCT
.
See Set.spliterator()
for more documentation on the requirements
of the returned spliterator.
spliterator
in interface LongCollection
spliterator
in interface LongIterable
spliterator
in interface LongSet
spliterator
in interface java.lang.Iterable<java.lang.Long>
spliterator
in interface java.util.Collection<java.lang.Long>
spliterator
in interface java.util.Set<java.lang.Long>
public int size()
size
in interface java.util.Collection<java.lang.Long>
size
in interface java.util.Set<java.lang.Long>
size
in class java.util.AbstractCollection<java.lang.Long>
public long[] toLongArray()
LongCollection
toLongArray
in interface LongCollection
toLongArray
in class AbstractLongCollection
Collection.toArray()
@Deprecated public void forEach(java.util.function.Consumer<? super java.lang.Long> action)
LongIterable
forEach
in interface LongIterable
forEach
in interface java.lang.Iterable<java.lang.Long>
public boolean addAll(java.util.Collection<? extends java.lang.Long> c)
AbstractLongCollection
addAll
in interface java.util.Collection<java.lang.Long>
addAll
in interface java.util.Set<java.lang.Long>
addAll
in class AbstractLongCollection
public boolean removeAll(java.util.Collection<?> c)
AbstractLongCollection
removeAll
in interface java.util.Collection<java.lang.Long>
removeAll
in interface java.util.Set<java.lang.Long>
removeAll
in class AbstractLongCollection
public boolean retainAll(java.util.Collection<?> c)
AbstractLongCollection
retainAll
in interface java.util.Collection<java.lang.Long>
retainAll
in interface java.util.Set<java.lang.Long>
retainAll
in class AbstractLongCollection
@Deprecated public boolean removeIf(java.util.function.Predicate<? super java.lang.Long> filter)
LongCollection
removeIf
in interface LongCollection
removeIf
in interface java.util.Collection<java.lang.Long>
public void forEach(java.util.function.LongConsumer action)
LongIterable
Iterable
until all elements have been processed or the action throws an
exception.forEach
in interface LongIterable
action
- the action to be performed for each element.Iterable.forEach(java.util.function.Consumer)
public boolean addAll(LongCollection c)
LongCollection
addAll
in interface LongCollection
addAll
in class AbstractLongCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.addAll(Collection)
public boolean removeAll(LongCollection c)
LongCollection
removeAll
in interface LongCollection
removeAll
in class AbstractLongCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.removeAll(Collection)
public boolean retainAll(LongCollection c)
LongCollection
retainAll
in interface LongCollection
retainAll
in class AbstractLongCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.retainAll(Collection)
public boolean removeIf(java.util.function.LongPredicate filter)
LongCollection
removeIf
in interface LongCollection
filter
- a predicate which returns true
for elements to be
removed.true
if any elements were removed.Collection.removeIf(java.util.function.Predicate)
@Deprecated public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<java.lang.Long>
toArray
in interface java.util.Set<java.lang.Long>
toArray
in class java.util.AbstractCollection<java.lang.Long>
public java.lang.Object clone()
clone
in class java.lang.Object