Class AppendOnlyLinkedArrayList<T>
java.lang.Object
io.reactivex.rxjava3.internal.util.AppendOnlyLinkedArrayList<T>
- Type Parameters:
T- the value type
A linked-array-list implementation that only supports appending and consumption.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePredicate interface suppressing the exception. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAppendOnlyLinkedArrayList(int capacity) Constructs an empty list with a per-link capacity. -
Method Summary
Modifier and TypeMethodDescription<U> booleanInterprets the contents as NotificationLite objects and calls the appropriate Observer method.<U> booleanaccept(org.reactivestreams.Subscriber<? super U> subscriber) Interprets the contents as NotificationLite objects and calls the appropriate Subscriber method.voidAppend a non-null value to the list.voidforEachWhile(AppendOnlyLinkedArrayList.NonThrowingPredicate<? super T> consumer) Loops over all elements of the array until a null element is encountered or the given predicate returns true.<S> voidforEachWhile(S state, BiPredicate<? super S, ? super T> consumer) Loops over all elements of the array until a null element is encountered or the given predicate returns true.voidSet a value as the first element of the list.
-
Field Details
-
capacity
final int capacity -
head
-
tail
Object[] tail -
offset
int offset
-
-
Constructor Details
-
AppendOnlyLinkedArrayList
public AppendOnlyLinkedArrayList(int capacity) Constructs an empty list with a per-link capacity.- Parameters:
capacity- the capacity of each link
-
-
Method Details
-
add
Append a non-null value to the list.Don't add null to the list!
- Parameters:
value- the value to append
-
setFirst
Set a value as the first element of the list.- Parameters:
value- the value to set
-
forEachWhile
Loops over all elements of the array until a null element is encountered or the given predicate returns true.- Parameters:
consumer- the consumer of values that returns true if the forEach should terminate
-
accept
public <U> boolean accept(org.reactivestreams.Subscriber<? super U> subscriber) Interprets the contents as NotificationLite objects and calls the appropriate Subscriber method.- Type Parameters:
U- the target type- Parameters:
subscriber- the subscriber to emit the events to- Returns:
- true if a terminal event has been reached
-
accept
Interprets the contents as NotificationLite objects and calls the appropriate Observer method.- Type Parameters:
U- the target type- Parameters:
observer- the observer to emit the events to- Returns:
- true if a terminal event has been reached
-
forEachWhile
Loops over all elements of the array until a null element is encountered or the given predicate returns true.- Type Parameters:
S- the extra state type- Parameters:
state- the extra state passed into the consumerconsumer- the consumer of values that returns true if the forEach should terminate- Throws:
Throwable- if the predicate throws
-