public interface FloatCollection extends Collection<Float>, Container
Collection
specialization with float
elements.Modifier and Type | Method and Description |
---|---|
boolean |
add(float e)
Ensures that this collection contains the specified element (optional
operation).
|
boolean |
add(Float e)
Deprecated.
Use specialization
add(float) instead |
boolean |
contains(float v)
Returns
true if this collection contains at least one element
equals to the specified one. |
boolean |
contains(Object o)
Deprecated.
Use specialization
contains(float) instead |
FloatCursor |
cursor()
Returns a new cursor over this collection's elements.
|
void |
forEach(Consumer<? super Float> action)
Deprecated.
Use specialization
forEach(FloatConsumer) instead |
void |
forEach(FloatConsumer action)
Performs the given action for each element of this collection until all elements have been
processed or the action throws an exception.
|
boolean |
forEachWhile(FloatPredicate predicate)
Checks the given
predicate on each element of this collection until all element
have been processed or the predicate returns false for some element,
or throws an Exception . |
FloatIterator |
iterator()
Deprecated.
Instead of explicit
iterator() calls, use cursor() ;
iterator() is still sensible only as a backing mechanism for Java 5's for-each
statements. |
boolean |
remove(Object o)
Deprecated.
Use specialization
removeFloat(float) instead |
boolean |
removeFloat(float v)
Removes a single copy of the specified element from this
collection, if it is present (optional operation).
|
boolean |
removeIf(FloatPredicate filter)
Removes all of the elements of this collection that satisfy the given predicate.
|
boolean |
removeIf(Predicate<? super Float> filter)
Deprecated.
Use specialization
removeIf(FloatPredicate) instead |
Object[] |
toArray()
Deprecated.
Use specialization
toFloatArray() instead |
float[] |
toArray(float[] a)
Returns an array containing elements in this collection.
|
<T> T[] |
toArray(T[] array)
Deprecated.
Use specialization
toArray(float[]) instead |
float[] |
toFloatArray()
Returns an array containing all of the elements in this collection.
|
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, retainAll, size, spliterator, stream
clear, ensureCapacity, isEmpty, shrink, size, sizeAsLong
@Deprecated boolean contains(Object o)
contains(float)
insteadcontains
in interface Collection<Float>
boolean contains(float v)
true
if this collection contains at least one element
equals to the specified one.v
- element whose presence in this collection is to be testedtrue
if this collection contains the specified element@Deprecated @Nonnull Object[] toArray()
toFloatArray()
insteadtoArray
in interface Collection<Float>
@Deprecated @Nonnull <T> T[] toArray(@Nonnull T[] array)
toArray(float[])
insteadtoArray
in interface Collection<Float>
@Nonnull float[] toFloatArray()
The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
toArray(float[])
@Nonnull float[] toArray(@Nonnull float[] a)
If this collection fits in the specified array with room to spare
(i.e., the array has more elements than this collection), the element in
the array immediately following the end of the collection is set
to 0.0f
(zero). This is useful in determining
the length of this collection only if the caller knows that this
collection does not contain any elements equal to 0.0f
.
If the native array is smaller than the collection size, the array will be filled with elements in Iterator order until it is full and exclude the remainder.
If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
a
- the array into which the elements of this collection are to be
stored.float[]
containing all the elements in this collectionNullPointerException
- if the specified array is null
toFloatArray()
@Nonnull FloatCursor cursor()
Basic cursor usage idiom is:
for (FloatCursor cur = collection.cursor(); cur.moveNext();) {
// Work with cur.elem()
// Call cur.remove() to remove the current entry
}
@Deprecated @Nonnull FloatIterator iterator()
iterator()
calls, use cursor()
;
iterator()
is still sensible only as a backing mechanism for Java 5's for-each
statements.iterator
in interface Collection<Float>
iterator
in interface Iterable<Float>
@Deprecated void forEach(@Nonnull Consumer<? super Float> action)
forEach(FloatConsumer)
insteadvoid forEach(@Nonnull FloatConsumer action)
action
- the action to be performed for each elementboolean forEachWhile(@Nonnull FloatPredicate predicate)
predicate
on each element of this collection until all element
have been processed or the predicate returns false
for some element,
or throws an Exception
. Exceptions thrown by the predicate are relayed to the caller.
Unless otherwise specified by the implementing class, elements are checked by the predicate in the order of iteration (if an iteration order is specified).
If this collection is empty, this method returns true
immediately.
predicate
- the predicate to be checked for each element of this collectiontrue
if the predicate returned true
for all elements of this
collection, false
if it returned false
for the element@Deprecated boolean add(@Nonnull Float e)
add(float)
insteadadd
in interface Collection<Float>
boolean add(float e)
true
if this collection changed as a
result of the call. (Returns false
if this collection does
not permit duplicates and already contains the specified element.)
Collections that support this operation may place limitations on what elements may be added to this collection. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.
If a collection refuses to add a particular element for any reason
other than that it already contains the element, it must throw
an exception (rather than returning false
). This preserves
the invariant that a collection always contains the specified element
after this call returns.
e
- element whose presence in this collection is to be ensuredtrue
if this collection changed as a result of the callUnsupportedOperationException
- if the add
operation
is not supported by this collectionIllegalArgumentException
- if some property of the element
prevents it from being added to this collectionIllegalStateException
- if the element cannot be added at this
time due to insertion restrictionsCollection.add(Object)
@Deprecated boolean remove(Object o)
removeFloat(float)
insteadremove
in interface Collection<Float>
boolean removeFloat(float v)
true
if this collection contained the specified element
(or equivalently, if this collection changed as a result of the call).
The name of this method is "removeFloat", not "remove", because "remove" conflicts
with List.remove(int)
.
v
- element to be removed from this collection, if presenttrue
if an element was removed as a result of this callUnsupportedOperationException
- if the remove
operation
is not supported by this collectionremove(Object)
@Deprecated boolean removeIf(@Nonnull Predicate<? super Float> filter)
removeIf(FloatPredicate)
insteadremoveIf
in interface Collection<Float>
boolean removeIf(@Nonnull FloatPredicate filter)
filter
- a predicate which returns true
for elements to be removedtrue
if any elements were removedNullPointerException
- if the specified filter is nullUnsupportedOperationException
- if elements cannot be removed from this collection.
Implementations may throw this exception if a matching element cannot be removed
or if, in general, removal is not supported.