_use

trait _use[A]
class java.lang.Object
trait scala.Matchable
class Any
class Stream.Flow[Stream.Flow.A]
class Stream.Custom.Pipeline.ParallelFlow[Stream.Custom.Pipeline.ParallelFlow.A]

Def

def contains[B >: A](value: B): Boolean

Value check

Value check

Returns true if flow contains given value

Source
_use.scala
def count: Int

All count

All count

Counts all flow elements

Source
_use.scala

Count and time

Count and time

Returns all elements count and Time.Length it took to pump the flow

  val (cnt,time) = (1 <> 1000).stream.parallel.peek(_ => J.sleep(1.Millis)).countAndTime

  ("" + cnt + " elements processed in " + time.tag).tp

  // Output
  1000 elements processed in 0.040820901 sec

Note. Only massively parallel execution allowed to process the above example in 0.04 seconds

Source
_use.scala
def drain: Unit

Pump flow out

Pump flow out

Fetches and discards all flow elements

This operation can be usefull for side effects built into pipeline

Source
_use.scala
def exists(f: A => Boolean): Boolean

Exists check

Exists check

Returns true if there is an elemnet satisfying given predicate

Source
_use.scala
def find(f: A => Boolean): A

Find value

Find value

Finds value accepted by given predicate

Note: If value is not found operation fails, use findOpt in most cases

Source
_use.scala
def findAnyOpt: Opt[A]

Find optional any value

Find optional any value

Finds any value or returns void option if not found

Source
_use.scala
def findOpt(f: A => Boolean): Opt[A]

Find optional value

Find optional value

Finds value accepted by given predicate or returns void option if not found

Source
_use.scala
def fold(start: A)(bf: (A, A) => A): A

Fold

Fold

Folds elements with a binary function

Value Params
f

binary function to fold elements with

start

seed value to start with

Source
_use.scala
def foldAs[B](start: B)(bf: (B, A) => B, cf: (B, B) => B): B

Fold and convert

Fold and convert

Folds and converts elements with a binary function

Value Params
f

binary function to fold elements with

start

seed value to start with

Source
_use.scala
def foreach[U](f: A => U): Unit

Process flow

Process flow

Applies given function to each flow element

Source
_use.scala
def isEvery(f: A => Boolean): Boolean

Forall check

Forall check

Returns true if every single element satisfies the given predicate

Source
_use.scala
def max(using Ordering[A]): A

Maximum

Maximum

Computes maximum value

Fails for empty streams

Source
_use.scala
def maxBy[B](f: A => B)(using Ordering[B]): A

Maximum by property

Maximum by property

Computes maximum value based on given function

Fails for empty streams

Source
_use.scala
def maxByOpt[B](f: A => B)(using Ordering[B]): Opt[A]

Optional maximum by property

Optional maximum by property

Computes maximum value based on given function or returns void option for empty streams

Source
_use.scala
def maxOpt(using Ordering[A]): Opt[A]

Optional maximum

Optional maximum

Computes maximum value or returns void option for empty streams

Source
_use.scala
def min(using Ordering[A]): A

Minimum

Minimum

Computes minimum value

Fails for empty streams

Source
_use.scala
def minBy[B](f: A => B)(using Ordering[B]): A

Minimum by property

Minimum by property

Computes minimum value based on given function

Fails for empty streams

Source
_use.scala
def minByOpt[B](f: A => B)(using Ordering[B]): Opt[A]

Optional minimum by property

Optional minimum by property

Computes minimum value based on given function or returns void option for empty streams

Source
_use.scala
def minOpt(using Ordering[A]): Opt[A]

Optional minimum

Optional minimum

Computes minimum value or returns void option for empty streams

Source
_use.scala
def range(using Ordering[A]): Range[A]

Range

Range

Computes value range

Fails for empty streams

Source
_use.scala
def rangeOpt(using Ordering[A]): Opt[Range[A]]

Optional range

Optional range

Computes value value or returns void option for empty streams

Source
_use.scala
def reduce(bf: (A, A) => A): A

Reduce

Reduce

Folds elements with a binary function

Note. Threre is no default value, and if flow is empty, operation fails. Use reduceOpt as a safer option

Value Params
f

binary function to fold elements with

Source
_use.scala
def reduceOpt(bf: (A, A) => A): Opt[A]

Optional reduce

Optional reduce

Folds elements with a binary function or returns empty option when stream is empty

Value Params
f

binary function to fold elements with

Source
_use.scala
def sum(using Math.Sum[A]): A

Sum

Sum

Calculates sum of all values

For empty stream returns zero

Source
_use.scala