Class AppendOnlyLinkedArrayList<T>
- java.lang.Object
-
- io.reactivex.rxjava3.internal.util.AppendOnlyLinkedArrayList<T>
-
- Type Parameters:
T
- the value type
public class AppendOnlyLinkedArrayList<T> extends java.lang.Object
A linked-array-list implementation that only supports appending and consumption.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AppendOnlyLinkedArrayList.NonThrowingPredicate<T>
Predicate interface suppressing the exception.
-
Constructor Summary
Constructors Constructor Description AppendOnlyLinkedArrayList(int capacity)
Constructs an empty list with a per-link capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <U> boolean
accept(Observer<? super U> observer)
Interprets the contents as NotificationLite objects and calls the appropriate Observer method.<U> boolean
accept(org.reactivestreams.Subscriber<? super U> subscriber)
Interprets the contents as NotificationLite objects and calls the appropriate Subscriber method.void
add(T value)
Append a non-null value to the list.void
forEachWhile(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> void
forEachWhile(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.void
setFirst(T value)
Set a value as the first element of the list.
-
-
-
Method Detail
-
add
public void add(T value)
Append a non-null value to the list.Don't add null to the list!
- Parameters:
value
- the value to append
-
setFirst
public void setFirst(T value)
Set a value as the first element of the list.- Parameters:
value
- the value to set
-
forEachWhile
public void forEachWhile(AppendOnlyLinkedArrayList.NonThrowingPredicate<? super T> consumer)
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
public <U> boolean accept(Observer<? super U> observer)
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
public <S> void forEachWhile(S state, BiPredicate<? super S,? super T> consumer) throws java.lang.Throwable
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:
java.lang.Throwable
- if the predicate throws
-
-