Class SynchronizedLongList
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedLongCollection
-
- org.eclipse.collections.impl.list.mutable.primitive.SynchronizedLongList
-
- All Implemented Interfaces:
java.io.Serializable
,MutableLongCollection
,LongList
,MutableLongList
,LongIterable
,OrderedLongIterable
,ReversibleLongIterable
,PrimitiveIterable
public class SynchronizedLongList extends AbstractSynchronizedLongCollection implements MutableLongList
A synchronized view of aMutableLongList
. It is imperative that the user manually synchronize on the on the collection when iterating over it using an iterator or stream.This file was automatically generated from template file synchronizedPrimitiveList.stg.
- Since:
- 3.1.
- See Also:
MutableLongList.asSynchronized()
,MutableList.asSynchronized()
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description SynchronizedLongList(MutableLongList list)
SynchronizedLongList(MutableLongList list, java.lang.Object newLock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addAllAtIndex(int index, long... source)
boolean
addAllAtIndex(int index, LongIterable source)
void
addAtIndex(int index, long element)
LazyLongIterable
asLazy()
Returns a LazyLongIterable adapter wrapping the source LongIterable.LazyLongIterable
asReversed()
MutableLongList
asSynchronized()
MutableLongList
asUnmodifiable()
int
binarySearch(long value)
<V> MutableList<V>
collect(LongToObjectFunction<? extends V> function)
Returns a new collection with the results of applying the specified function on each element of the source collection.<V> MutableList<V>
collectWithIndex(LongIntToObjectFunction<? extends V> function)
Returns a new MutableList using results obtained by applying the specified function to each element and its corresponding index.<V,R extends java.util.Collection<V>>
RcollectWithIndex(LongIntToObjectFunction<? 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.MutableLongList
distinct()
long
dotProduct(LongList list)
boolean
equals(java.lang.Object otherList)
Follows the same general contract asList.equals(Object)
.void
forEachInBoth(LongList other, LongLongProcedure procedure)
This method iterates over two CharList instances of the same size together using the specified CharCharProcedure.void
forEachWithIndex(LongIntProcedure procedure)
long
get(int index)
long
getFirst()
long
getLast()
private MutableLongList
getMutableLongList()
int
hashCode()
Follows the same general contract asList.hashCode()
.int
indexOf(long value)
<T> T
injectIntoWithIndex(T injectedValue, ObjectLongIntToObjectFunction<? super T,? extends T> function)
int
lastIndexOf(long value)
MutableLongList
newEmpty()
Creates a new empty mutable version of the same List type.MutableLongList
reject(LongPredicate predicate)
Returns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.MutableLongList
rejectWithIndex(LongIntPredicate predicate)
Returns a new MutableLongList excluding all elements with corresponding indexes matching the specified predicate.<R extends MutableLongCollection>
RrejectWithIndex(LongIntPredicate predicate, R target)
Returns a new MutableLongCollection excluding all elements with corresponding indexes matching the specified predicate.long
removeAtIndex(int index)
MutableLongList
reverseThis()
MutableLongList
select(LongPredicate predicate)
Returns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.MutableLongList
selectWithIndex(LongIntPredicate predicate)
Returns a new MutableLongList including all elements with corresponding indexes matching the specified predicate.<R extends MutableLongCollection>
RselectWithIndex(LongIntPredicate predicate, R target)
Returns a new MutableLongCollection including all elements with corresponding indexes matching the specified predicate.long
set(int index, long element)
MutableLongList
shuffleThis()
Randomly permutes this list mutating its contents and returns the same list (this).MutableLongList
shuffleThis(java.util.Random rnd)
Randomly permutes this list mutating its contents and returns the same list (this).MutableLongList
sortThis()
Sorts this list mutating its contents and returns the same mutable list (this).MutableLongList
sortThis(LongComparator comparator)
Sorts the internal data structure of this list and returns the list itself as a convenience.<T> MutableLongList
sortThisBy(LongToObjectFunction<T> function)
Sorts the internal data structure of this list based on the natural order of the key returned byfunction
.<T> MutableLongList
sortThisBy(LongToObjectFunction<T> function, java.util.Comparator<? super T> comparator)
Sorts the internal data structure of this list based on the key returned byfunction
using the providedcomparator
.java.util.Spliterator.OfLong
spliterator()
This function needs to be synchronized manuallyMutableLongList
subList(int fromIndex, int toIndex)
ImmutableLongList
toImmutable()
Returns an immutable copy of this list.MutableLongList
toReversed()
SynchronizedLongList
with(long element)
SynchronizedLongList
withAll(LongIterable elements)
SynchronizedLongList
without(long element)
SynchronizedLongList
withoutAll(LongIterable elements)
<T> MutableList<LongObjectPair<T>>
zip(java.lang.Iterable<T> iterable)
Returns aMutableList
formed from thisMutableLongList
and aListIterable
by combining corresponding elements in pairs.MutableList<LongLongPair>
zipLong(LongIterable iterable)
Returns aMutableList
formed from thisMutableLongList
and anotherLongList
by combining corresponding elements in pairs.-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedLongCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, average, chunk, clear, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, each, getLock, getLongCollection, injectInto, isEmpty, longIterator, makeString, makeString, makeString, max, maxIfEmpty, median, min, minIfEmpty, noneSatisfy, notEmpty, reduce, reduceIfEmpty, remove, removeAll, removeAll, removeIf, retainAll, retainAll, size, sum, toArray, toArray, toBag, toList, toSet, toSortedArray, toSortedList, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.LongIterable
allSatisfy, anySatisfy, average, averageIfEmpty, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, each, flatCollect, forEach, injectInto, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, max, maxIfEmpty, median, medianIfEmpty, min, minIfEmpty, noneSatisfy, reduce, reduceIfEmpty, reject, select, sum, summaryStatistics, toArray, toArray, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.list.primitive.LongList
primitiveParallelStream, primitiveStream
-
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableLongCollection
add, addAll, addAll, clear, longIterator, remove, removeAll, removeAll, removeIf, retainAll, retainAll
-
Methods inherited from interface org.eclipse.collections.api.list.primitive.MutableLongList
swap, tap
-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, size, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SynchronizedLongList
public SynchronizedLongList(MutableLongList list)
-
SynchronizedLongList
public SynchronizedLongList(MutableLongList list, java.lang.Object newLock)
-
-
Method Detail
-
getMutableLongList
private MutableLongList getMutableLongList()
-
getFirst
public long getFirst()
- Specified by:
getFirst
in interfaceOrderedLongIterable
-
getLast
public long getLast()
- Specified by:
getLast
in interfaceReversibleLongIterable
-
indexOf
public int indexOf(long value)
- Specified by:
indexOf
in interfaceOrderedLongIterable
-
lastIndexOf
public int lastIndexOf(long value)
- Specified by:
lastIndexOf
in interfaceLongList
-
addAtIndex
public void addAtIndex(int index, long element)
- Specified by:
addAtIndex
in interfaceMutableLongList
-
addAllAtIndex
public boolean addAllAtIndex(int index, long... source)
- Specified by:
addAllAtIndex
in interfaceMutableLongList
-
addAllAtIndex
public boolean addAllAtIndex(int index, LongIterable source)
- Specified by:
addAllAtIndex
in interfaceMutableLongList
-
removeAtIndex
public long removeAtIndex(int index)
- Specified by:
removeAtIndex
in interfaceMutableLongList
-
set
public long set(int index, long element)
- Specified by:
set
in interfaceMutableLongList
-
with
public SynchronizedLongList with(long element)
- Specified by:
with
in interfaceMutableLongCollection
- Specified by:
with
in interfaceMutableLongList
- Overrides:
with
in classAbstractSynchronizedLongCollection
-
without
public SynchronizedLongList without(long element)
- Specified by:
without
in interfaceMutableLongCollection
- Specified by:
without
in interfaceMutableLongList
- Overrides:
without
in classAbstractSynchronizedLongCollection
-
withAll
public SynchronizedLongList withAll(LongIterable elements)
- Specified by:
withAll
in interfaceMutableLongCollection
- Specified by:
withAll
in interfaceMutableLongList
- Overrides:
withAll
in classAbstractSynchronizedLongCollection
-
withoutAll
public SynchronizedLongList withoutAll(LongIterable elements)
- Specified by:
withoutAll
in interfaceMutableLongCollection
- Specified by:
withoutAll
in interfaceMutableLongList
- Overrides:
withoutAll
in classAbstractSynchronizedLongCollection
-
select
public MutableLongList select(LongPredicate predicate)
Description copied from interface:LongIterable
Returns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.- Specified by:
select
in interfaceLongIterable
- Specified by:
select
in interfaceLongList
- Specified by:
select
in interfaceMutableLongCollection
- Specified by:
select
in interfaceMutableLongList
- Specified by:
select
in interfaceOrderedLongIterable
- Specified by:
select
in interfaceReversibleLongIterable
- Overrides:
select
in classAbstractSynchronizedLongCollection
-
reject
public MutableLongList reject(LongPredicate predicate)
Description copied from interface:LongIterable
Returns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.- Specified by:
reject
in interfaceLongIterable
- Specified by:
reject
in interfaceLongList
- Specified by:
reject
in interfaceMutableLongCollection
- Specified by:
reject
in interfaceMutableLongList
- Specified by:
reject
in interfaceOrderedLongIterable
- Specified by:
reject
in interfaceReversibleLongIterable
- Overrides:
reject
in classAbstractSynchronizedLongCollection
-
collect
public <V> MutableList<V> collect(LongToObjectFunction<? extends V> function)
Description copied from interface:LongIterable
Returns 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:
collect
in interfaceLongIterable
- Specified by:
collect
in interfaceLongList
- Specified by:
collect
in interfaceMutableLongCollection
- Specified by:
collect
in interfaceMutableLongList
- Specified by:
collect
in interfaceOrderedLongIterable
- Specified by:
collect
in interfaceReversibleLongIterable
- Overrides:
collect
in classAbstractSynchronizedLongCollection
-
sortThis
public MutableLongList sortThis()
Description copied from interface:MutableLongList
Sorts this list mutating its contents and returns the same mutable list (this).- Specified by:
sortThis
in interfaceMutableLongList
-
sortThis
public MutableLongList sortThis(LongComparator comparator)
Description copied from interface:MutableLongList
Sorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThis
in interfaceMutableLongList
-
sortThisBy
public <T> MutableLongList sortThisBy(LongToObjectFunction<T> function)
Description copied from interface:MutableLongList
Sorts the internal data structure of this list based on the natural order of the key returned byfunction
.- Specified by:
sortThisBy
in interfaceMutableLongList
-
sortThisBy
public <T> MutableLongList sortThisBy(LongToObjectFunction<T> function, java.util.Comparator<? super T> comparator)
Description copied from interface:MutableLongList
Sorts the internal data structure of this list based on the key returned byfunction
using the providedcomparator
.- Specified by:
sortThisBy
in interfaceMutableLongList
-
shuffleThis
public MutableLongList shuffleThis()
Description copied from interface:MutableLongList
Randomly permutes this list mutating its contents and returns the same list (this). Usesjava.util.Random
as the source of randomness.- Specified by:
shuffleThis
in interfaceMutableLongList
-
shuffleThis
public MutableLongList shuffleThis(java.util.Random rnd)
Description copied from interface:MutableLongList
Randomly permutes this list mutating its contents and returns the same list (this). Implements the Fisher-Yates shuffle algorithm using the provided source of randomness.- Specified by:
shuffleThis
in interfaceMutableLongList
-
binarySearch
public int binarySearch(long value)
- Specified by:
binarySearch
in interfaceLongList
-
dotProduct
public long dotProduct(LongList list)
- Specified by:
dotProduct
in interfaceLongList
-
equals
public boolean equals(java.lang.Object otherList)
Description copied from interface:LongList
Follows the same general contract asList.equals(Object)
.
-
hashCode
public int hashCode()
Description copied from interface:LongList
Follows the same general contract asList.hashCode()
.
-
asLazy
public LazyLongIterable asLazy()
Description copied from interface:LongIterable
Returns a LazyLongIterable adapter wrapping the source LongIterable.- Specified by:
asLazy
in interfaceLongIterable
- Overrides:
asLazy
in classAbstractSynchronizedLongCollection
-
asUnmodifiable
public MutableLongList asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableLongCollection
- Specified by:
asUnmodifiable
in interfaceMutableLongList
- Overrides:
asUnmodifiable
in classAbstractSynchronizedLongCollection
-
asSynchronized
public MutableLongList asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableLongCollection
- Specified by:
asSynchronized
in interfaceMutableLongList
- Overrides:
asSynchronized
in classAbstractSynchronizedLongCollection
-
toImmutable
public ImmutableLongList toImmutable()
Description copied from interface:MutableLongList
Returns an immutable copy of this list.- Specified by:
toImmutable
in interfaceLongList
- Specified by:
toImmutable
in interfaceMutableLongCollection
- Specified by:
toImmutable
in interfaceMutableLongList
- Overrides:
toImmutable
in classAbstractSynchronizedLongCollection
-
newEmpty
public MutableLongList newEmpty()
Description copied from interface:MutableLongList
Creates a new empty mutable version of the same List type.- Specified by:
newEmpty
in interfaceMutableLongCollection
- Specified by:
newEmpty
in interfaceMutableLongList
- Since:
- 9.2.
-
reverseThis
public MutableLongList reverseThis()
- Specified by:
reverseThis
in interfaceMutableLongList
-
toReversed
public MutableLongList toReversed()
- Specified by:
toReversed
in interfaceLongList
- Specified by:
toReversed
in interfaceMutableLongList
- Specified by:
toReversed
in interfaceReversibleLongIterable
-
asReversed
public LazyLongIterable asReversed()
- Specified by:
asReversed
in interfaceReversibleLongIterable
-
forEachInBoth
public void forEachInBoth(LongList other, LongLongProcedure procedure)
Description copied from interface:LongList
This method iterates over two CharList instances of the same size together using the specified CharCharProcedure.- Specified by:
forEachInBoth
in interfaceLongList
-
forEachWithIndex
public void forEachWithIndex(LongIntProcedure procedure)
- Specified by:
forEachWithIndex
in interfaceOrderedLongIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectLongIntToObjectFunction<? super T,? extends T> function)
- Specified by:
injectIntoWithIndex
in interfaceOrderedLongIterable
- Specified by:
injectIntoWithIndex
in interfaceReversibleLongIterable
-
distinct
public MutableLongList distinct()
- Specified by:
distinct
in interfaceLongList
- Specified by:
distinct
in interfaceMutableLongList
- Specified by:
distinct
in interfaceReversibleLongIterable
- Since:
- 6.0.
-
subList
public MutableLongList subList(int fromIndex, int toIndex)
- Specified by:
subList
in interfaceLongList
- Specified by:
subList
in interfaceMutableLongList
- See Also:
List.subList(int fromIndex, int toIndex)
-
zipLong
public MutableList<LongLongPair> zipLong(LongIterable iterable)
Description copied from interface:MutableLongList
Returns aMutableList
formed from thisMutableLongList
and anotherLongList
by combining corresponding elements in pairs. If one of the twoLongList
s is longer than the other, its remaining elements are ignored.- Specified by:
zipLong
in interfaceLongList
- Specified by:
zipLong
in interfaceMutableLongList
- Since:
- 9.1.
-
zip
public <T> MutableList<LongObjectPair<T>> zip(java.lang.Iterable<T> iterable)
Description copied from interface:MutableLongList
Returns aMutableList
formed from thisMutableLongList
and aListIterable
by combining corresponding elements in pairs. If one of the two Lists is longer than the other, its remaining elements are ignored.- Specified by:
zip
in interfaceLongList
- Specified by:
zip
in interfaceMutableLongList
- Since:
- 9.1.
-
selectWithIndex
public MutableLongList selectWithIndex(LongIntPredicate predicate)
Returns a new MutableLongList including all elements with corresponding indexes matching the specified predicate.- Specified by:
selectWithIndex
in interfaceLongList
- Specified by:
selectWithIndex
in interfaceMutableLongList
- Specified by:
selectWithIndex
in interfaceOrderedLongIterable
- Specified by:
selectWithIndex
in interfaceReversibleLongIterable
- Since:
- 11.1.
-
selectWithIndex
public <R extends MutableLongCollection> R selectWithIndex(LongIntPredicate predicate, R target)
Returns a new MutableLongCollection including all elements with corresponding indexes matching the specified predicate.- Specified by:
selectWithIndex
in interfaceOrderedLongIterable
- Since:
- 11.1.
-
rejectWithIndex
public MutableLongList rejectWithIndex(LongIntPredicate predicate)
Returns a new MutableLongList excluding all elements with corresponding indexes matching the specified predicate.- Specified by:
rejectWithIndex
in interfaceLongList
- Specified by:
rejectWithIndex
in interfaceMutableLongList
- Specified by:
rejectWithIndex
in interfaceOrderedLongIterable
- Specified by:
rejectWithIndex
in interfaceReversibleLongIterable
- Since:
- 11.1.
-
rejectWithIndex
public <R extends MutableLongCollection> R rejectWithIndex(LongIntPredicate predicate, R target)
Returns a new MutableLongCollection excluding all elements with corresponding indexes matching the specified predicate.- Specified by:
rejectWithIndex
in interfaceOrderedLongIterable
- Since:
- 11.1.
-
collectWithIndex
public <V> MutableList<V> collectWithIndex(LongIntToObjectFunction<? extends V> function)
Returns a new MutableList using results obtained by applying the specified function to each element and its corresponding index.- Specified by:
collectWithIndex
in interfaceLongList
- Specified by:
collectWithIndex
in interfaceMutableLongList
- Specified by:
collectWithIndex
in interfaceOrderedLongIterable
- Specified by:
collectWithIndex
in interfaceReversibleLongIterable
- Since:
- 9.1.
-
collectWithIndex
public <V,R extends java.util.Collection<V>> R collectWithIndex(LongIntToObjectFunction<? 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:
collectWithIndex
in interfaceOrderedLongIterable
- Since:
- 9.1.
-
spliterator
public java.util.Spliterator.OfLong spliterator()
This function needs to be synchronized manually- Specified by:
spliterator
in interfaceLongList
-
-