Class SynchronizedFloatStack
- java.lang.Object
-
- org.eclipse.collections.impl.stack.mutable.primitive.SynchronizedFloatStack
-
- All Implemented Interfaces:
java.io.Serializable,FloatIterable,OrderedFloatIterable,PrimitiveIterable,FloatStack,MutableFloatStack
public class SynchronizedFloatStack extends java.lang.Object implements MutableFloatStack, java.io.Serializable
A synchronized view of aMutableFloatStack. It is imperative that the user manually synchronize on the collection when iterating over it using theFloatIterator, as perCollections.synchronizedCollection(Collection).This file was automatically generated from template file synchronizedPrimitiveStack.stg.
- Since:
- 3.1.
- See Also:
MutableFloatStack.asSynchronized(),MutableStack.asSynchronized(), Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Objectlockprivate static longserialVersionUIDprivate MutableFloatStackstack
-
Constructor Summary
Constructors Constructor Description SynchronizedFloatStack(MutableFloatStack stack)SynchronizedFloatStack(MutableFloatStack stack, java.lang.Object newLock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallSatisfy(FloatPredicate predicate)Returns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(FloatPredicate predicate)Returns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.voidappendString(java.lang.Appendable appendable)Prints a string representation of this collection onto the givenAppendable.voidappendString(java.lang.Appendable appendable, java.lang.String separator)Prints a string representation of this collection onto the givenAppendable.voidappendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)Prints a string representation of this collection onto the givenAppendable.LazyFloatIterableasLazy()Returns a LazyFloatIterable adapter wrapping the source FloatIterable.MutableFloatStackasSynchronized()MutableFloatStackasUnmodifiable()doubleaverage()RichIterable<FloatIterable>chunk(int size)Partitions elements in fixed size chunks.voidclear()Clears the Stack<V> MutableStack<V>collect(FloatToObjectFunction<? extends V> function)Returns a new collection with the results of applying the specified function on each element of the source collection.<V> MutableStack<V>collectWithIndex(FloatIntToObjectFunction<? extends V> function)Returns a new MutableStack using results obtained by applying the specified function to each element and its corresponding index.<V,R extends java.util.Collection<V>>
RcollectWithIndex(FloatIntToObjectFunction<? extends V> function, R target)Adds elements to the target Collection using results obtained by applying the specified function to each element and its corresponding index.booleancontains(float value)Returns true if the value is contained in the FloatIterable, and false if it is not.booleancontainsAll(float... source)Returns true if all of the values specified in the source array are contained in the FloatIterable, and false if they are not.booleancontainsAll(FloatIterable source)Returns true if all of the values specified in the source FloatIterable are contained in the FloatIterable, and false if they are not.intcount(FloatPredicate predicate)Returns a count of the number of elements in the FloatIterable that return true for the specified predicate.floatdetectIfNone(FloatPredicate predicate, float ifNone)voideach(FloatProcedure procedure)A synonym for forEach.booleanequals(java.lang.Object otherStack)Follows the same general contract asStackIterable.equals(Object).FloatIteratorfloatIterator()Must be called in a synchronized block.voidforEachWithIndex(FloatIntProcedure procedure)floatgetFirst()inthashCode()Follows the same general contract asStackIterable.hashCode().intindexOf(float value)<T> TinjectInto(T injectedValue, ObjectFloatToObjectFunction<? super T,? extends T> function)<T> TinjectIntoWithIndex(T injectedValue, ObjectFloatIntToObjectFunction<? super T,? extends T> function)booleanisEmpty()Returns true if this iterable has zero items.java.lang.StringmakeString()Returns a string representation of this collection by delegating toPrimitiveIterable.makeString(String)and defaulting the separator parameter to the characters", "(comma and space).java.lang.StringmakeString(java.lang.String separator)Returns a string representation of this collection by delegating toPrimitiveIterable.makeString(String, String, String)and defaulting the start and end parameters to""(the empty String).java.lang.StringmakeString(java.lang.String start, java.lang.String separator, java.lang.String end)Returns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.floatmax()floatmaxIfEmpty(float defaultValue)doublemedian()floatmin()floatminIfEmpty(float defaultValue)MutableFloatStacknewEmpty()Creates a new empty mutable version of the same stack type.booleannoneSatisfy(FloatPredicate predicate)Returns true if none of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.booleannotEmpty()The English equivalent of !this.isEmpty()floatpeek()Returns the top of the stack.FloatListpeek(int count)Returns FloatList of the number of elements specified by the count, beginning with the top of the stack.floatpeekAt(int index)Returns the element at the specified index.floatpop()Removes and returns the top element of the stack.FloatListpop(int count)Removes and returns a FloatList of the number of elements specified by the count, beginning with the top of the stack.voidpush(float item)Adds an item to the top of the stack.MutableFloatStackreject(FloatPredicate predicate)Returns a new FloatIterable with all of the elements in the FloatIterable that return false for the specified predicate.MutableFloatStackrejectWithIndex(FloatIntPredicate predicate)Returns a new MutableFloatStack excluding all elements with corresponding indexes matching the specified predicate.<R extends MutableFloatCollection>
RrejectWithIndex(FloatIntPredicate predicate, R target)Returns a new MutableFloatCollection excluding all elements with corresponding indexes matching the specified predicate.MutableFloatStackselect(FloatPredicate predicate)Returns a new FloatIterable with all of the elements in the FloatIterable that return true for the specified predicate.MutableFloatStackselectWithIndex(FloatIntPredicate predicate)Returns a new MutableFloatStack including all elements with corresponding indexes matching the specified predicate.<R extends MutableFloatCollection>
RselectWithIndex(FloatIntPredicate predicate, R target)Returns a new MutableFloatCollection including all elements with corresponding indexes matching the specified predicate.intsize()Returns the number of items in this iterable.doublesum()float[]toArray()Converts the FloatIterable to a primitive float array.float[]toArray(float[] target)Converts the FloatIterable to a primitive float array.MutableFloatBagtoBag()Converts the FloatIterable to a new MutableFloatBag.ImmutableFloatStacktoImmutable()MutableFloatListtoList()Converts the FloatIterable to a new MutableFloatList.MutableFloatSettoSet()Converts the FloatIterable to a new MutableFloatSet.float[]toSortedArray()MutableFloatListtoSortedList()MutableFloatStacktoStack()Converts the collection to a FloatStack.java.lang.StringtoString()Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.FloatIterable
averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, medianIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toSortedList, toSortedListBy, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.stack.primitive.MutableFloatStack
tap
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
lock
private final java.lang.Object lock
-
stack
private final MutableFloatStack stack
-
-
Constructor Detail
-
SynchronizedFloatStack
public SynchronizedFloatStack(MutableFloatStack stack)
-
SynchronizedFloatStack
public SynchronizedFloatStack(MutableFloatStack stack, java.lang.Object newLock)
-
-
Method Detail
-
push
public void push(float item)
Description copied from interface:MutableFloatStackAdds an item to the top of the stack.- Specified by:
pushin interfaceMutableFloatStack
-
pop
public float pop()
Description copied from interface:MutableFloatStackRemoves and returns the top element of the stack.- Specified by:
popin interfaceMutableFloatStack
-
pop
public FloatList pop(int count)
Description copied from interface:MutableFloatStackRemoves and returns a FloatList of the number of elements specified by the count, beginning with the top of the stack.- Specified by:
popin interfaceMutableFloatStack
-
peek
public float peek()
Description copied from interface:FloatStackReturns the top of the stack.- Specified by:
peekin interfaceFloatStack
-
peek
public FloatList peek(int count)
Description copied from interface:FloatStackReturns FloatList of the number of elements specified by the count, beginning with the top of the stack.- Specified by:
peekin interfaceFloatStack
-
peekAt
public float peekAt(int index)
Description copied from interface:FloatStackReturns the element at the specified index.- Specified by:
peekAtin interfaceFloatStack- Parameters:
index- the location to peek into
-
size
public int size()
Description copied from interface:PrimitiveIterableReturns the number of items in this iterable.- Specified by:
sizein interfacePrimitiveIterable
-
isEmpty
public boolean isEmpty()
Description copied from interface:PrimitiveIterableReturns true if this iterable has zero items.- Specified by:
isEmptyin interfacePrimitiveIterable
-
notEmpty
public boolean notEmpty()
Description copied from interface:PrimitiveIterableThe English equivalent of !this.isEmpty()- Specified by:
notEmptyin interfacePrimitiveIterable
-
clear
public void clear()
Description copied from interface:MutableFloatStackClears the Stack- Specified by:
clearin interfaceMutableFloatStack
-
contains
public boolean contains(float value)
Description copied from interface:FloatIterableReturns true if the value is contained in the FloatIterable, and false if it is not.- Specified by:
containsin interfaceFloatIterable
-
containsAll
public boolean containsAll(float... source)
Description copied from interface:FloatIterableReturns true if all of the values specified in the source array are contained in the FloatIterable, and false if they are not.- Specified by:
containsAllin interfaceFloatIterable
-
containsAll
public boolean containsAll(FloatIterable source)
Description copied from interface:FloatIterableReturns true if all of the values specified in the source FloatIterable are contained in the FloatIterable, and false if they are not.- Specified by:
containsAllin interfaceFloatIterable
-
floatIterator
public FloatIterator floatIterator()
Must be called in a synchronized block.- Specified by:
floatIteratorin interfaceFloatIterable
-
each
public void each(FloatProcedure procedure)
Description copied from interface:FloatIterableA synonym for forEach.- Specified by:
eachin interfaceFloatIterable- Since:
- 7.0.
-
count
public int count(FloatPredicate predicate)
Description copied from interface:FloatIterableReturns a count of the number of elements in the FloatIterable that return true for the specified predicate.- Specified by:
countin interfaceFloatIterable
-
anySatisfy
public boolean anySatisfy(FloatPredicate predicate)
Description copied from interface:FloatIterableReturns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceFloatIterable
-
allSatisfy
public boolean allSatisfy(FloatPredicate predicate)
Description copied from interface:FloatIterableReturns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceFloatIterable
-
noneSatisfy
public boolean noneSatisfy(FloatPredicate predicate)
Description copied from interface:FloatIterableReturns true if none of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfyin interfaceFloatIterable
-
detectIfNone
public float detectIfNone(FloatPredicate predicate, float ifNone)
- Specified by:
detectIfNonein interfaceFloatIterable
-
select
public MutableFloatStack select(FloatPredicate predicate)
Description copied from interface:FloatIterableReturns a new FloatIterable with all of the elements in the FloatIterable that return true for the specified predicate.- Specified by:
selectin interfaceFloatIterable- Specified by:
selectin interfaceFloatStack- Specified by:
selectin interfaceMutableFloatStack- Specified by:
selectin interfaceOrderedFloatIterable
-
reject
public MutableFloatStack reject(FloatPredicate predicate)
Description copied from interface:FloatIterableReturns a new FloatIterable with all of the elements in the FloatIterable that return false for the specified predicate.- Specified by:
rejectin interfaceFloatIterable- Specified by:
rejectin interfaceFloatStack- Specified by:
rejectin interfaceMutableFloatStack- Specified by:
rejectin interfaceOrderedFloatIterable
-
collect
public <V> MutableStack<V> collect(FloatToObjectFunction<? extends V> function)
Description copied from interface:FloatIterableReturns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.- Specified by:
collectin interfaceFloatIterable- Specified by:
collectin interfaceFloatStack- Specified by:
collectin interfaceMutableFloatStack- Specified by:
collectin interfaceOrderedFloatIterable
-
sum
public double sum()
- Specified by:
sumin interfaceFloatIterable
-
max
public float max()
- Specified by:
maxin interfaceFloatIterable
-
min
public float min()
- Specified by:
minin interfaceFloatIterable
-
minIfEmpty
public float minIfEmpty(float defaultValue)
- Specified by:
minIfEmptyin interfaceFloatIterable
-
maxIfEmpty
public float maxIfEmpty(float defaultValue)
- Specified by:
maxIfEmptyin interfaceFloatIterable
-
average
public double average()
- Specified by:
averagein interfaceFloatIterable
-
median
public double median()
- Specified by:
medianin interfaceFloatIterable
-
toSortedList
public MutableFloatList toSortedList()
- Specified by:
toSortedListin interfaceFloatIterable
-
toSortedArray
public float[] toSortedArray()
- Specified by:
toSortedArrayin interfaceFloatIterable
-
toArray
public float[] toArray()
Description copied from interface:FloatIterableConverts the FloatIterable to a primitive float array.- Specified by:
toArrayin interfaceFloatIterable
-
toArray
public float[] toArray(float[] target)
Description copied from interface:FloatIterableConverts the FloatIterable to a primitive float array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.- Specified by:
toArrayin interfaceFloatIterable
-
toString
public java.lang.String toString()
Description copied from interface:PrimitiveIterableReturns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.Assert.assertEquals("[]", IntLists.mutable.empty().toString()); Assert.assertEquals("[1]", IntLists.mutable.with(1).toString()); Assert.assertEquals("[1, 2, 3]", IntLists.mutable.with(1, 2, 3).toString());- Specified by:
toStringin interfacePrimitiveIterable- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this PrimitiveIterable
- See Also:
AbstractCollection.toString()
-
makeString
public java.lang.String makeString()
Description copied from interface:PrimitiveIterableReturns a string representation of this collection by delegating toPrimitiveIterable.makeString(String)and defaulting the separator parameter to the characters", "(comma and space).- Specified by:
makeStringin interfacePrimitiveIterable- Returns:
- a string representation of this collection.
-
makeString
public java.lang.String makeString(java.lang.String separator)
Description copied from interface:PrimitiveIterableReturns a string representation of this collection by delegating toPrimitiveIterable.makeString(String, String, String)and defaulting the start and end parameters to""(the empty String).- Specified by:
makeStringin interfacePrimitiveIterable- Returns:
- a string representation of this collection.
-
makeString
public java.lang.String makeString(java.lang.String start, java.lang.String separator, java.lang.String end)Description copied from interface:PrimitiveIterableReturns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.- Specified by:
makeStringin interfacePrimitiveIterable- Returns:
- a string representation of this collection.
-
appendString
public void appendString(java.lang.Appendable appendable)
Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString().- Specified by:
appendStringin interfacePrimitiveIterable
-
appendString
public void appendString(java.lang.Appendable appendable, java.lang.String separator)Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String).- Specified by:
appendStringin interfacePrimitiveIterable
-
appendString
public void appendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String, String, String).- Specified by:
appendStringin interfacePrimitiveIterable
-
toList
public MutableFloatList toList()
Description copied from interface:FloatIterableConverts the FloatIterable to a new MutableFloatList.- Specified by:
toListin interfaceFloatIterable
-
toSet
public MutableFloatSet toSet()
Description copied from interface:FloatIterableConverts the FloatIterable to a new MutableFloatSet.- Specified by:
toSetin interfaceFloatIterable
-
toBag
public MutableFloatBag toBag()
Description copied from interface:FloatIterableConverts the FloatIterable to a new MutableFloatBag.- Specified by:
toBagin interfaceFloatIterable
-
equals
public boolean equals(java.lang.Object otherStack)
Description copied from interface:FloatStackFollows the same general contract asStackIterable.equals(Object).- Specified by:
equalsin interfaceFloatStack- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:FloatStackFollows the same general contract asStackIterable.hashCode().- Specified by:
hashCodein interfaceFloatStack- Overrides:
hashCodein classjava.lang.Object
-
asLazy
public LazyFloatIterable asLazy()
Description copied from interface:FloatIterableReturns a LazyFloatIterable adapter wrapping the source FloatIterable.- Specified by:
asLazyin interfaceFloatIterable
-
asUnmodifiable
public MutableFloatStack asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableFloatStack
-
asSynchronized
public MutableFloatStack asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableFloatStack
-
toImmutable
public ImmutableFloatStack toImmutable()
- Specified by:
toImmutablein interfaceFloatStack
-
newEmpty
public MutableFloatStack newEmpty()
Description copied from interface:MutableFloatStackCreates a new empty mutable version of the same stack type.- Specified by:
newEmptyin interfaceMutableFloatStack- Since:
- 9.2.
-
injectInto
public <T> T injectInto(T injectedValue, ObjectFloatToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoin interfaceFloatIterable
-
chunk
public RichIterable<FloatIterable> chunk(int size)
Description copied from interface:FloatIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceFloatIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingFloatIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
getFirst
public float getFirst()
- Specified by:
getFirstin interfaceOrderedFloatIterable
-
indexOf
public int indexOf(float value)
- Specified by:
indexOfin interfaceOrderedFloatIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectFloatIntToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoWithIndexin interfaceOrderedFloatIterable
-
forEachWithIndex
public void forEachWithIndex(FloatIntProcedure procedure)
- Specified by:
forEachWithIndexin interfaceOrderedFloatIterable
-
selectWithIndex
public MutableFloatStack selectWithIndex(FloatIntPredicate predicate)
Returns a new MutableFloatStack including all elements with corresponding indexes matching the specified predicate.- Specified by:
selectWithIndexin interfaceFloatStack- Specified by:
selectWithIndexin interfaceMutableFloatStack- Specified by:
selectWithIndexin interfaceOrderedFloatIterable- Since:
- 11.1.
-
selectWithIndex
public <R extends MutableFloatCollection> R selectWithIndex(FloatIntPredicate predicate, R target)
Returns a new MutableFloatCollection including all elements with corresponding indexes matching the specified predicate.- Specified by:
selectWithIndexin interfaceOrderedFloatIterable- Since:
- 11.1.
-
rejectWithIndex
public MutableFloatStack rejectWithIndex(FloatIntPredicate predicate)
Returns a new MutableFloatStack excluding all elements with corresponding indexes matching the specified predicate.- Specified by:
rejectWithIndexin interfaceFloatStack- Specified by:
rejectWithIndexin interfaceMutableFloatStack- Specified by:
rejectWithIndexin interfaceOrderedFloatIterable- Since:
- 11.1.
-
rejectWithIndex
public <R extends MutableFloatCollection> R rejectWithIndex(FloatIntPredicate predicate, R target)
Returns a new MutableFloatCollection excluding all elements with corresponding indexes matching the specified predicate.- Specified by:
rejectWithIndexin interfaceOrderedFloatIterable- Since:
- 11.1.
-
collectWithIndex
public <V> MutableStack<V> collectWithIndex(FloatIntToObjectFunction<? extends V> function)
Returns a new MutableStack using results obtained by applying the specified function to each element and its corresponding index.- Specified by:
collectWithIndexin interfaceFloatStack- Specified by:
collectWithIndexin interfaceMutableFloatStack- Specified by:
collectWithIndexin interfaceOrderedFloatIterable- Since:
- 9.1.
-
collectWithIndex
public <V,R extends java.util.Collection<V>> R collectWithIndex(FloatIntToObjectFunction<? extends V> function, R target)
Adds elements to the target Collection using results obtained by applying the specified function to each element and its corresponding index.- Specified by:
collectWithIndexin interfaceOrderedFloatIterable- Since:
- 9.1.
-
toStack
public MutableFloatStack toStack()
Description copied from interface:OrderedFloatIterableConverts the collection to a FloatStack.- Specified by:
toStackin interfaceOrderedFloatIterable
-
-