I have a double[]
and I want to filter out (create a new array without) negative values in one line without adding for
loops. Is this possible using Java 8 lambda expressions?
In python it would be this using generators:
[i for i in x if i > 0]
Is it possible to do something similarly concise in Java 8?
double[]
, but easy with aList
: dreamsyssoft.com/java-8-lambda-tutorial/filter-tutorial.php(i for i in x if i > 0)