t

Stream._extend._flow

trait _flow[A] extends Stream.Flow._extend._flow[A]

Flow Control

Self Type
Stream[A]
Ordering
  1. Alphabetic
Inherited
  1. Stream._extend._flow
  2. Stream.Flow._extend._flow
  3. scala.AnyRef
  4. scala.Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Method

  1. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  2. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  3. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  4. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  6. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  7. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  8. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. final def notify(): Unit
    Definition Classes
    AnyRef
  10. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  11. def parallel: Stream.Flow[A]

    Parallel

    Parallel

    Returns Stream.Flow with parallel execution

    Each consecutive element will be sent to a new thread for processing

    (1 <> 5).all.parallel.peek("Value: " +  _ + "\t" + App.Thread.name lp).drain
    
    // Output
    Value: 1    ForkJoinPool.commonPool-worker-9
    Value: 3    ForkJoinPool.commonPool-worker-11
    Value: 2    main
    Value: 4    ForkJoinPool.commonPool-worker-2
    Value: 5    ForkJoinPool.commonPool-worker-4
    Definition Classes
    _flow
  12. def parallelIf(boolean: Boolean): Stream.Flow[A]

    Conditionally parallel

    Conditionally parallel

    Switches to parallel execution if boolean parameter == true

    Returns Stream.Flow, which could be implemented as sequential Stream or parallel Stream.Flow

    (1 <> 50).all.parallelIf(true).isParallel.lp   // Prints: true
    
    (1 <> 50).all.parallelIf(false).isParallel.lp  // Prints: false
    Definition Classes
    _flow
  13. def parallelIfOver(threshold: Int): Stream.Flow[A]

    Conditionally parallel

    Conditionally parallel

    Switches to parallel execution if number of elements exceeds threshold

    Returns Stream.Flow, which could be implemented as sequential Stream or parallel Stream.Flow

    (1 <> 50).all.parallelIfOver(100).isParallel.lp   // Prints: false
    
    (1 <> 200).all.parallelIfOver(100).isParallel.lp  // Prints: true
    Definition Classes
    _flow
  14. def preview: Stream[A] with Stream.Preview[A]

    Adds preview capabilities

    Adds preview capabilities

    Preview allows to pre load and inspect elements, even before they go through Stream

    Definition Classes
    _flow
  15. def reverse: ~[A]

    Reverse order

    Reverse order

    Re-arranges elements is reverse order

    Definition Classes
    _flow
  16. def sequential: Stream[A]

    Returns self

    Returns self

    This method is inherited from Stream.Flow, which could be parallel

    In Stream context sequential returns this

    See Stream.Flow.sequential

    Definition Classes
    _flow_flow
  17. def shuffle: ~[A]

    Randomize order

    Randomize order

    Re-arranges elements is random order

    Note: this operation requires full buffering and is not suitable for large streams

    Definition Classes
    _flow
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. def transpose[B](implicit f: Mapping[A, ~[B]]): ~[~[B]]

    Transpose

    Transpose

    Transposes matrix where rows become columns

    def all: ~[~[Int]] = ~.*(11 <> 15, List(21, 22, 23, 24, 25), Vector(31, 32, 33, 34, 35))
    
    all.toText.lp
    
    all.transpose.toText.lp
    
    // Output
    ---------------------
    ?
    ---------------------
    ~(11, 12, 13, 14, 15)
    ~(21, 22, 23, 24, 25)
    ~(31, 32, 33, 34, 35)
    ---------------------
    
    -------------
    ?
    -------------
    ~(11, 21, 31)
    ~(12, 22, 32)
    ~(13, 23, 33)
    ~(14, 24, 34)
    ~(15, 25, 35)
    -------------
    Definition Classes
    _flow
  21. def unfold(f: Mapping[~[A], A]): ~[A]

    Lazy infinite stream

    Lazy infinite stream

    Lazily unfolds next value with a function taking all prior values

     // Unfoldifg Fibonacci Sequence
    
    (0 ~+ 1).unfold(_.letLast(2).sum).letNext(20).lp
    
     // Output
     ~(0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181)
    Definition Classes
    _flow
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Operator

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
Linear Supertypes
Source: _flow.scala