public class ChannelsKt
Modifier and Type | Method and Description |
---|---|
static <E> java.lang.Object |
any(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean> p)
Returns
true if channel has at least one element. |
static <E,R> R |
consume(BroadcastChannel<E> $receiver,
kotlin.jvm.functions.Function1<? super kotlinx.coroutines.channels.ReceiveChannel<? extends E>,? extends R> block)
Opens subscription to this
interface BroadcastChannel and makes sure that the given block consumes all elements
from it by always invoking ReceiveChannel.cancel after the execution of the block. |
static <E,R> R |
consume(ReceiveChannel<? extends E> $receiver,
kotlin.jvm.functions.Function1<? super kotlinx.coroutines.channels.ReceiveChannel<? extends E>,? extends R> block)
Makes sure that the given block consumes all elements from the given channel
by always invoking
ReceiveChannel.cancel after the execution of the block. |
static kotlin.jvm.functions.Function1<java.lang.Throwable,kotlin.Unit> |
consumes(ReceiveChannel<?> $receiver)
Returns a CompletionHandler that invokes
ReceiveChannel.cancel on the interface ReceiveChannel
with the corresponding cause. See also ChannelsKt.consume . |
static kotlin.jvm.functions.Function1<java.lang.Throwable,kotlin.Unit> |
consumesAll(kotlinx.coroutines.channels.ReceiveChannel channels)
Returns a CompletionHandler that invokes
ReceiveChannel.cancel on all the
specified interface ReceiveChannel instances with the corresponding cause.
See also ChannelsKt.consumes for a version on one channel. |
static <E> java.lang.Object |
count(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super java.lang.Integer> p)
Returns the number of elements in this channel.
|
static <E> ReceiveChannel<E> |
distinct(ReceiveChannel<? extends E> $receiver)
Returns a channel containing only distinct elements from the given channel.
|
static <E,K> ReceiveChannel<E> |
distinctBy(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super K>,? extends java.lang.Object> selector)
Returns a channel containing only elements from the given channel
having distinct keys returned by the given selector function.
|
static <E> ReceiveChannel<E> |
drop(ReceiveChannel<? extends E> $receiver,
int n,
NonExistentClass context)
Returns a channel containing all elements except first n elements.
|
static <E> ReceiveChannel<E> |
dropWhile(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing all elements except first elements that satisfy the given predicate.
|
static <E> java.lang.Object |
elementAt(ReceiveChannel<? extends E> $receiver,
int index,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this channel.
|
static <E> java.lang.Object |
elementAtOrNull(ReceiveChannel<? extends E> $receiver,
int index,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns an element at the given index or
null if the index is out of bounds of this channel. |
static <E> ReceiveChannel<E> |
filter(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing only elements matching the given predicate.
|
static <E> ReceiveChannel<E> |
filterIndexed(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function3<? super java.lang.Integer,? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing only elements matching the given predicate.
|
static <E> ReceiveChannel<E> |
filterNot(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing all elements not matching the given predicate.
|
static <E> ReceiveChannel<E> |
filterNotNull(ReceiveChannel<? extends E> $receiver)
Returns a channel containing all elements that are not
null . |
static <E,C extends Collection<? super E>> |
filterNotNullTo(ReceiveChannel<? extends E> $receiver,
C destination,
kotlin.coroutines.experimental.Continuation<? super C> p)
Appends all elements that are not
null to the given destination. |
static <E,C extends SendChannel<? super E>> |
filterNotNullTo(ReceiveChannel<? extends E> $receiver,
C destination,
kotlin.coroutines.experimental.Continuation<? super C> p)
Appends all elements that are not
null to the given destination. |
static <E> java.lang.Object |
first(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns first element.
|
static <E> java.lang.Object |
firstOrNull(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the first element, or
null if the channel is empty. |
static <E,R> ReceiveChannel<R> |
flatMap(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super kotlinx.coroutines.channels.ReceiveChannel<? extends R>>,? extends java.lang.Object> transform)
Returns a single channel of all elements from results of transform function being invoked on each element of original channel.
|
static <E> java.lang.Object |
indexOf(ReceiveChannel<? extends E> $receiver,
E element,
kotlin.coroutines.experimental.Continuation<? super java.lang.Integer> p)
Returns first index of element, or -1 if the channel does not contain element.
|
static <E> java.lang.Object |
last(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the last element.
|
static <E> java.lang.Object |
lastIndexOf(ReceiveChannel<? extends E> $receiver,
E element,
kotlin.coroutines.experimental.Continuation<? super java.lang.Integer> p)
Returns last index of element, or -1 if the channel does not contain element.
|
static <E> java.lang.Object |
lastOrNull(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the last element, or
null if the channel is empty. |
static <E,R> ReceiveChannel<R> |
map(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super R>,? extends java.lang.Object> transform)
Returns a channel containing the results of applying the given transform function
to each element in the original channel.
|
static <E,R> ReceiveChannel<R> |
mapIndexed(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function3<? super java.lang.Integer,? super E,? super kotlin.coroutines.experimental.Continuation<? super R>,? extends java.lang.Object> transform)
Returns a channel containing the results of applying the given transform function
to each element and its index in the original channel.
|
static <E,R> ReceiveChannel<R> |
mapIndexedNotNull(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function3<? super java.lang.Integer,? super E,? super kotlin.coroutines.experimental.Continuation<? super R>,? extends java.lang.Object> transform)
Returns a channel containing only the non-null results of applying the given transform function
to each element and its index in the original channel.
|
static <E,R> ReceiveChannel<R> |
mapNotNull(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super R>,? extends java.lang.Object> transform)
Returns a channel containing only the non-null results of applying the given transform function
to each element in the original channel.
|
static <E> java.lang.Object |
maxWith(ReceiveChannel<? extends E> $receiver,
java.util.Comparator<? super E> comparator,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the first element having the largest value according to the provided comparator or
null if there are no elements. |
static <E> java.lang.Object |
minWith(ReceiveChannel<? extends E> $receiver,
java.util.Comparator<? super E> comparator,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the first element having the smallest value according to the provided comparator or
null if there are no elements. |
static <E> java.lang.Object |
none(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean> p)
Returns
true if the channel has no elements. |
static <E> ReceiveChannel<E> |
requireNoNulls(ReceiveChannel<? extends E> $receiver)
Returns an original collection containing all the non-
null elements, throwing an IllegalArgumentException if there are any null elements. |
static <E> void |
sendBlocking(SendChannel<? super E> $receiver,
E element)
Adds element into to this channel, blocking the caller while this channel
SendChannel.isFull ,
or throws exception if the channel SendChannel.isClosedForSend (see SendChannel.close for details). |
static <E> java.lang.Object |
single(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the single element, or throws an exception if the channel is empty or has more than one element.
|
static <E> java.lang.Object |
singleOrNull(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super E> p)
Returns single element, or
null if the channel is empty or has more than one element. |
static <E> ReceiveChannel<E> |
take(ReceiveChannel<? extends E> $receiver,
int n,
NonExistentClass context)
Returns a channel containing first n elements.
|
static <E> ReceiveChannel<E> |
takeWhile(ReceiveChannel<? extends E> $receiver,
NonExistentClass context,
kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing first elements satisfying the given predicate.
|
static <E,C extends SendChannel<? super E>> |
toChannel(ReceiveChannel<? extends E> $receiver,
C destination,
kotlin.coroutines.experimental.Continuation<? super C> p)
Send each element of the original channel
and appends the results to the given destination.
|
static <E,C extends Collection<? super E>> |
toCollection(ReceiveChannel<? extends E> $receiver,
C destination,
kotlin.coroutines.experimental.Continuation<? super C> p)
Appends all elements to the given destination collection.
|
static <E> java.lang.Object |
toList(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super java.util.List<? extends E>> p)
Returns a List containing all elements.
|
static <K,V> java.lang.Object |
toMap(ReceiveChannel<? extends kotlin.Pair<? extends K,? extends V>> $receiver,
kotlin.coroutines.experimental.Continuation<? super java.util.Map<K,? extends V>> p)
Returns a Map filled with all elements of this channel.
|
static <K,V,M extends Map<? super K,? super V>> |
toMap(ReceiveChannel<? extends kotlin.Pair<? extends K,? extends V>> $receiver,
M destination,
kotlin.coroutines.experimental.Continuation<? super M> p)
Returns a MutableMap filled with all elements of this channel.
|
static <E> java.lang.Object |
toMutableList(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super java.util.List<E>> p)
Returns a MutableList filled with all elements of this channel.
|
static <E> java.lang.Object |
toMutableSet(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super java.util.Set<E>> p)
Returns a mutable set containing all distinct elements from the given channel.
|
static <E> java.lang.Object |
toSet(ReceiveChannel<? extends E> $receiver,
kotlin.coroutines.experimental.Continuation<? super java.util.Set<? extends E>> p)
Returns a Set of all elements.
|
static <E> ReceiveChannel<kotlin.collections.IndexedValue> |
withIndex(ReceiveChannel<? extends E> $receiver,
NonExistentClass context)
Returns a channel of IndexedValue for each element of the original channel.
|
static <E,R> ReceiveChannel<kotlin.Pair> |
zip(ReceiveChannel<? extends E> $receiver,
ReceiveChannel<? extends R> other)
Returns a channel of pairs built from elements of both channels with same indexes.
Resulting channel has length of shortest input channel.
|
static <E,R,V> ReceiveChannel<V> |
zip(ReceiveChannel<? extends E> $receiver,
ReceiveChannel<? extends R> other,
NonExistentClass context,
kotlin.jvm.functions.Function2<? super E,? super R,? extends V> transform)
Returns a channel of values built from elements of both collections with same indexes using provided transform. Resulting channel has length of shortest input channels.
|
public static kotlin.jvm.functions.Function1<java.lang.Throwable,kotlin.Unit> consumesAll(kotlinx.coroutines.channels.ReceiveChannel channels)
Returns a CompletionHandler that invokes ReceiveChannel.cancel
on all the
specified interface ReceiveChannel
instances with the corresponding cause.
See also ChannelsKt.consumes
for a version on one channel.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object any(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean> p)
Returns true
if channel has at least one element.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,R> R consume(BroadcastChannel<E> $receiver, kotlin.jvm.functions.Function1<? super kotlinx.coroutines.channels.ReceiveChannel<? extends E>,? extends R> block)
Opens subscription to this interface BroadcastChannel
and makes sure that the given block consumes all elements
from it by always invoking ReceiveChannel.cancel
after the execution of the block.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,R> R consume(ReceiveChannel<? extends E> $receiver, kotlin.jvm.functions.Function1<? super kotlinx.coroutines.channels.ReceiveChannel<? extends E>,? extends R> block)
Makes sure that the given block consumes all elements from the given channel
by always invoking ReceiveChannel.cancel
after the execution of the block.
WARNING: It is planned that in the future a second invocation of this method on an channel that is already being consumed is going to fail fast, that is immediately throw an IllegalStateException. See this issue for details.
The operation is terminal.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static kotlin.jvm.functions.Function1<java.lang.Throwable,kotlin.Unit> consumes(ReceiveChannel<?> $receiver)
Returns a CompletionHandler that invokes ReceiveChannel.cancel
on the interface ReceiveChannel
with the corresponding cause. See also ChannelsKt.consume
.
WARNING: It is planned that in the future a second invocation of this method on an channel that is already being consumed is going to fail fast, that it immediately throws an IllegalStateException. See this issue for details.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object count(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super java.lang.Integer> p)
Returns the number of elements in this channel.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> distinct(ReceiveChannel<? extends E> $receiver)
Returns a channel containing only distinct elements from the given channel.
The elements in the resulting channel are in the same order as they were in the source channel.
The operation is intermediate and stateful.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,K> ReceiveChannel<E> distinctBy(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super K>,? extends java.lang.Object> selector)
Returns a channel containing only elements from the given channel having distinct keys returned by the given selector function.
The elements in the resulting channel are in the same order as they were in the source channel.
The operation is intermediate and stateful.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> drop(ReceiveChannel<? extends E> $receiver, int n, NonExistentClass context)
Returns a channel containing all elements except first n elements.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> dropWhile(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing all elements except first elements that satisfy the given predicate.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object elementAt(ReceiveChannel<? extends E> $receiver, int index, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this channel.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object elementAtOrNull(ReceiveChannel<? extends E> $receiver, int index, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns an element at the given index or null
if the index is out of bounds of this channel.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> filter(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing only elements matching the given predicate.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> filterIndexed(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing only elements matching the given predicate.
predicate
- function that takes the index of an element and the element itself and returns the result of predicate evaluation on the element.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> filterNot(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing all elements not matching the given predicate.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> filterNotNull(ReceiveChannel<? extends E> $receiver)
Returns a channel containing all elements that are not null
.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,C extends Collection<? super E>> java.lang.Object filterNotNullTo(ReceiveChannel<? extends E> $receiver, C destination, kotlin.coroutines.experimental.Continuation<? super C> p)
Appends all elements that are not null
to the given destination.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,C extends SendChannel<? super E>> java.lang.Object filterNotNullTo(ReceiveChannel<? extends E> $receiver, C destination, kotlin.coroutines.experimental.Continuation<? super C> p)
Appends all elements that are not null
to the given destination.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object first(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns first element.
if the channel is empty.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object firstOrNull(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the first element, or null
if the channel is empty.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,R> ReceiveChannel<R> flatMap(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super kotlinx.coroutines.channels.ReceiveChannel<? extends R>>,? extends java.lang.Object> transform)
Returns a single channel of all elements from results of transform function being invoked on each element of original channel.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object indexOf(ReceiveChannel<? extends E> $receiver, E element, kotlin.coroutines.experimental.Continuation<? super java.lang.Integer> p)
Returns first index of element, or -1 if the channel does not contain element.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object last(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the last element.
if the channel is empty.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object lastIndexOf(ReceiveChannel<? extends E> $receiver, E element, kotlin.coroutines.experimental.Continuation<? super java.lang.Integer> p)
Returns last index of element, or -1 if the channel does not contain element.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object lastOrNull(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the last element, or null
if the channel is empty.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,R> ReceiveChannel<R> map(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super R>,? extends java.lang.Object> transform)
Returns a channel containing the results of applying the given transform function to each element in the original channel.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
ChannelsKt.consume
,
interface ReceiveChannel
public static <E,R> ReceiveChannel<R> mapIndexed(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super E,? super kotlin.coroutines.experimental.Continuation<? super R>,? extends java.lang.Object> transform)
Returns a channel containing the results of applying the given transform function to each element and its index in the original channel.
transform
- function that takes the index of an element and the element itself and returns the result of the transform applied to the element.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,R> ReceiveChannel<R> mapIndexedNotNull(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super E,? super kotlin.coroutines.experimental.Continuation<? super R>,? extends java.lang.Object> transform)
Returns a channel containing only the non-null results of applying the given transform function to each element and its index in the original channel.
transform
- function that takes the index of an element and the element itself and returns the result of the transform applied to the element.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,R> ReceiveChannel<R> mapNotNull(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super R>,? extends java.lang.Object> transform)
Returns a channel containing only the non-null results of applying the given transform function to each element in the original channel.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object maxWith(ReceiveChannel<? extends E> $receiver, java.util.Comparator<? super E> comparator, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the first element having the largest value according to the provided comparator or null
if there are no elements.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object minWith(ReceiveChannel<? extends E> $receiver, java.util.Comparator<? super E> comparator, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the first element having the smallest value according to the provided comparator or null
if there are no elements.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object none(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean> p)
Returns true
if the channel has no elements.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> requireNoNulls(ReceiveChannel<? extends E> $receiver)
Returns an original collection containing all the non-null
elements, throwing an IllegalArgumentException if there are any null
elements.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> void sendBlocking(SendChannel<? super E> $receiver, E element)
Adds element into to this channel, blocking the caller while this channel SendChannel.isFull
,
or throws exception if the channel SendChannel.isClosedForSend
(see SendChannel.close
for details).
This is a way to call SendChannel.send
method inside a blocking code using BuildersKt.runBlocking
,
so this function should not be used from coroutine.
public static <E> java.lang.Object single(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns the single element, or throws an exception if the channel is empty or has more than one element.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object singleOrNull(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super E> p)
Returns single element, or null
if the channel is empty or has more than one element.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> take(ReceiveChannel<? extends E> $receiver, int n, NonExistentClass context)
Returns a channel containing first n elements.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<E> takeWhile(ReceiveChannel<? extends E> $receiver, NonExistentClass context, kotlin.jvm.functions.Function2<? super E,? super kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean>,? extends java.lang.Object> predicate)
Returns a channel containing first elements satisfying the given predicate.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,C extends SendChannel<? super E>> java.lang.Object toChannel(ReceiveChannel<? extends E> $receiver, C destination, kotlin.coroutines.experimental.Continuation<? super C> p)
Send each element of the original channel and appends the results to the given destination.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,C extends Collection<? super E>> java.lang.Object toCollection(ReceiveChannel<? extends E> $receiver, C destination, kotlin.coroutines.experimental.Continuation<? super C> p)
Appends all elements to the given destination collection.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object toList(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super java.util.List<? extends E>> p)
Returns a List containing all elements.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
ChannelsKt.consume
,
interface ReceiveChannel
public static <K,V> java.lang.Object toMap(ReceiveChannel<? extends kotlin.Pair<? extends K,? extends V>> $receiver, kotlin.coroutines.experimental.Continuation<? super java.util.Map<K,? extends V>> p)
Returns a Map filled with all elements of this channel.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <K,V,M extends Map<? super K,? super V>> java.lang.Object toMap(ReceiveChannel<? extends kotlin.Pair<? extends K,? extends V>> $receiver, M destination, kotlin.coroutines.experimental.Continuation<? super M> p)
Returns a MutableMap filled with all elements of this channel.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object toMutableList(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super java.util.List<E>> p)
Returns a MutableList filled with all elements of this channel.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object toMutableSet(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super java.util.Set<E>> p)
Returns a mutable set containing all distinct elements from the given channel.
The returned set preserves the element iteration order of the original channel.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> java.lang.Object toSet(ReceiveChannel<? extends E> $receiver, kotlin.coroutines.experimental.Continuation<? super java.util.Set<? extends E>> p)
Returns a Set of all elements.
The returned set preserves the element iteration order of the original channel.
The operation is terminal.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E> ReceiveChannel<kotlin.collections.IndexedValue> withIndex(ReceiveChannel<? extends E> $receiver, NonExistentClass context)
Returns a channel of IndexedValue for each element of the original channel.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of the original interface ReceiveChannel
.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,R> ReceiveChannel<kotlin.Pair> zip(ReceiveChannel<? extends E> $receiver, ReceiveChannel<? extends R> other)
Returns a channel of pairs built from elements of both channels with same indexes. Resulting channel has length of shortest input channel.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of both the original interface ReceiveChannel
and the other
one.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.
public static <E,R,V> ReceiveChannel<V> zip(ReceiveChannel<? extends E> $receiver, ReceiveChannel<? extends R> other, NonExistentClass context, kotlin.jvm.functions.Function2<? super E,? super R,? extends V> transform)
Returns a channel of values built from elements of both collections with same indexes using provided transform. Resulting channel has length of shortest input channels.
The operation is intermediate and stateless.
This function ChannelsKt.consume
all elements of both the original interface ReceiveChannel
and the other
one.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See https://github.com/Kotlin/kotlinx.coroutines/issues/254.