question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add `any` operator

See original GitHub issue

To make Kotlin Flow more suitable for a wide range of tasks, I suggest to add an any function like in Reactor.

Description

Emit a single boolean true if any of the values of this Flux sequence match the predicate.

Signature

fun <T> Flow<T>.any(predicate: (T) -> Boolean)): Flow<Boolean>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jdreddawaycommented, Oct 20, 2022

jfsanchez91 it would be better performance to use this.firstOrNull() and check for null instead of try/catching.

1reaction
JakeWhartoncommented, Sep 10, 2020

Since Flow doesn’t have the concept of Mono

A Mono in coroutines is just a suspend fun, an asynchronous function invocation that can only produce a value or exception.

Read more comments on GitHub >

github_iconTop Results From Across the Web

To find sum of two numbers without using any operator
Write a program to find sum of positive integers without using any operator. Only use of printf() is allowed. No other library function...
Read more >
SQL ANY and ALL Operators - W3Schools
The ANY and ALL operators allow you to perform a comparison between a single column value and a range of other values. The...
Read more >
ANY Operator in SQL Server with Examples - Dot Net Tutorials
The ANY Operator in SQL Server is used to compare a value to each value in a list of results from a query...
Read more >
Expression Add Operators - LeetCode
Given a string num that contains only digits and an integer target , return all possibilities to insert the binary operators '+' ,...
Read more >
Addition operators - + and += | Microsoft Learn
The C# addition operators (`+`, and `+=`) work with operands of numeric, string, or delegate types.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found