Package net.minestom.server.thread
Class AcquirableCollection<E>
java.lang.Object
net.minestom.server.thread.AcquirableCollection<E>
- All Implemented Interfaces:
Iterable<Acquirable<E>>
,Collection<Acquirable<E>>
@Experimental
public class AcquirableCollection<E>
extends Object
implements Collection<Acquirable<E>>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
acquireAsync
(@NotNull Consumer<E> consumer) void
acquireSync
(@NotNull Consumer<E> consumer) boolean
add
(Acquirable<E> eAcquirable) boolean
addAll
(@NotNull Collection<? extends Acquirable<E>> c) void
clear()
boolean
boolean
containsAll
(@NotNull Collection<?> c) boolean
isEmpty()
@NotNull Iterator
<Acquirable<E>> iterator()
boolean
boolean
removeAll
(@NotNull Collection<?> c) boolean
retainAll
(@NotNull Collection<?> c) protected static <T> Map
<TickThread, List<T>> retrieveOptionalThreadMap
(@NotNull Collection<Acquirable<T>> collection, @NotNull Thread currentThread, @NotNull Consumer<T> consumer) Createsint
size()
@NotNull Object[]
toArray()
<T> T[]
toArray
(T[] a) unwrap()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
AcquirableCollection
-
-
Method Details
-
acquireSync
-
acquireAsync
-
unwrap
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
-
iterator
-
toArray
- Specified by:
toArray
in interfaceCollection<E>
-
toArray
@NotNull public <T> T[] toArray(@NotNull T[] a) - Specified by:
toArray
in interfaceCollection<E>
-
add
- Specified by:
add
in interfaceCollection<E>
-
remove
- Specified by:
remove
in interfaceCollection<E>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
-
addAll
- Specified by:
addAll
in interfaceCollection<E>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
-
retrieveOptionalThreadMap
protected static <T> Map<TickThread,List<T>> retrieveOptionalThreadMap(@NotNull @NotNull Collection<Acquirable<T>> collection, @NotNull @NotNull Thread currentThread, @NotNull @NotNull Consumer<T> consumer) Creates- Parameters:
collection
- the acquirable collectioncurrentThread
- the current threadconsumer
- the consumer to execute when an element is already in the current thread- Returns:
- a new Thread to acquirable elements map
-