Class

dogs.Streaming

Empty

Related Doc: package Streaming

Permalink

final case class Empty[A]() extends Streaming[A] with Product with Serializable

Concrete Streaming[A] types:

Cons represents a lazy, possibly infinite stream of values. Eval[_] is used to represent possible laziness (via now, later, and always). The head of Cons is eager -- a lazy head can be represented using Wait(always(...)) or Wait(Later(...)).

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Empty
  2. Streaming
  3. Serializable
  4. Serializable
  5. Product
  6. Equals
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Empty()

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def ++(rhs: Eval[Streaming[A]]): Streaming[A]

    Permalink

    Lazily concatenate two streams.

    Lazily concatenate two streams.

    In this case the evaluation of the second stream may be deferred.

    Definition Classes
    Streaming
  4. def ++(rhs: Streaming[A]): Streaming[A]

    Permalink

    Lazily concatenate two streams.

    Lazily concatenate two streams.

    Definition Classes
    Streaming
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def compact: Streaming[A]

    Permalink

    Compact removes "pauses" in the stream (represented as Wait(_) nodes).

    Compact removes "pauses" in the stream (represented as Wait(_) nodes).

    Normally, Wait(_) values are used to defer tail computation in cases where it is convenient to return a stream value where neither the head or tail are computed yet.

    In some cases (particularly if the stream is to be memoized) it may be desirable to ensure that these values are not retained.

    Definition Classes
    Streaming
  9. def drop(n: Int): Streaming[A]

    Permalink

    Return a stream consisting of all but the first n elements of this stream.

    Return a stream consisting of all but the first n elements of this stream.

    If the current stream has n or fewer elements, an empty stream will be returned.

    Definition Classes
    Streaming
  10. def dropWhile(f: (A) ⇒ Boolean): Streaming[A]

    Permalink

    From the beginning of this stream, create a new stream which removes all elements that fulfill the predicate f.

    From the beginning of this stream, create a new stream which removes all elements that fulfill the predicate f. Once an element is found which does not fulfill the predicate, that element and all subsequent elements will be returned.

    If all elements satisfy f, an empty stream will be returned. If no elements satisfy f, the current stream will be returned.

    For example:

    Streaming(1, 2, 3, 4, 5, 6, 7).takeWhile(n => n != 4)

    Will result in: Streaming(4, 5, 6, 7)

    Definition Classes
    Streaming
  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def exists(f: (A) ⇒ Boolean): Boolean

    Permalink

    Return true if some element of the stream satisfies the predicate, false otherwise.

    Return true if some element of the stream satisfies the predicate, false otherwise.

    Definition Classes
    Streaming
  13. def filter(f: (A) ⇒ Boolean): Streaming[A]

    Permalink

    Lazily filter the stream given the predicate f.

    Lazily filter the stream given the predicate f.

    Definition Classes
    Streaming
  14. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def find(f: (A) ⇒ Boolean): Option[A]

    Permalink

    Eagerly search the stream from the left.

    Eagerly search the stream from the left. The search ends when f returns true for some a, or the stream is exhausted. Some(a) signals a match, None means no matching items were found.

    Definition Classes
    Streaming
  16. def flatMap[B](f: (A) ⇒ Streaming[B]): Streaming[B]

    Permalink

    Lazily transform the stream given a function f.

    Lazily transform the stream given a function f.

    Definition Classes
    Streaming
  17. def fold[B](b: Eval[B], f: (A, Eval[Streaming[A]]) ⇒ B): B

    Permalink

    The stream's catamorphism.

    The stream's catamorphism.

    This method allows the stream to be transformed into an arbitrary value by handling two cases:

    1. empty stream: return b 2. non-empty stream: apply the function to the head and tail

    This method can be more convenient than pattern-matching, since it includes support for handling deferred streams (i.e. Wait(_)), these nodes will be evaluated until an empty or non-empty stream is found (i.e. until Empty() or Cons() is found).

    Definition Classes
    Streaming
  18. def foldLeft[B](b: B)(f: (B, A) ⇒ B): B

    Permalink

    Eagerly fold the stream to a single value from the left.

    Eagerly fold the stream to a single value from the left.

    Definition Classes
    Streaming
  19. def foldRight[B](b: Eval[B])(f: (A, Eval[B]) ⇒ Eval[B]): Eval[B]

    Permalink

    Lazily fold the stream to a single value from the right.

    Lazily fold the stream to a single value from the right.

    Definition Classes
    Streaming
  20. def foldStreaming[B](bs: ⇒ Streaming[B], f: (A, Eval[Streaming[A]]) ⇒ Streaming[B]): Streaming[B]

    Permalink

    A variant of fold, used for constructing streams.

    A variant of fold, used for constructing streams.

    The only difference is that foldStreaming will preserve deferred streams. This makes it more appropriate to use in situations where the stream's laziness must be preserved.

    Definition Classes
    Streaming
  21. def forall(f: (A) ⇒ Boolean): Boolean

    Permalink

    Return true if every element of the stream satisfies the predicate, false otherwise.

    Return true if every element of the stream satisfies the predicate, false otherwise.

    Definition Classes
    Streaming
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def interleave(rhs: Streaming[A]): Streaming[A]

    Permalink

    Interleave the elements of two streams.

    Interleave the elements of two streams.

    Given x = [x0, x1, x2, ...] and y = [y0, y1, y2, ...] this method will return the stream [x0, y0, x1, y1, x2, ...]

    If one stream is longer than the other, the rest of its elements will appear after the other stream is exhausted.

    Definition Classes
    Streaming
  24. def isEmpty: Boolean

    Permalink

    Return true if the stream is empty, false otherwise.

    Return true if the stream is empty, false otherwise.

    In this case of deferred streams this will force the first element to be calculated.

    Definition Classes
    Streaming
  25. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  26. def iterator: Iterator[A]

    Permalink

    Provide an iterator over the elements in the stream.

    Provide an iterator over the elements in the stream.

    Definition Classes
    Streaming
  27. def izip[B](rhs: Streaming[B]): Streaming[Ior[A, B]]

    Permalink

    Lazily zip two streams together using Ior.

    Lazily zip two streams together using Ior.

    Unlike zip, the length of the result will be the longer of the two arguments.

    Definition Classes
    Streaming
  28. def izipMap[B, C](rhs: Streaming[B])(f: (A, B) ⇒ C, g: (A) ⇒ C, h: (B) ⇒ C): Streaming[C]

    Permalink

    Zip two streams together, using the given function f to produce the output values.

    Zip two streams together, using the given function f to produce the output values.

    Unlike zipMap, the length of the result will be the *longer* of the two input streams. The functions g and h will be used in this case to produce valid C values.

    The expression:

    (lhs izipMap rhs)(f, g, h)

    is equivalent to (but more efficient than):

    (lhs izip rhs).map { case Ior.Both(a, b) => f(a, b) case Ior.Left(a) => g(a) case Ior.Right(b) => h(b) }

    Definition Classes
    Streaming
  29. def map[B](f: (A) ⇒ B): Streaming[B]

    Permalink

    Lazily transform the stream given a function f.

    Lazily transform the stream given a function f.

    Definition Classes
    Streaming
  30. def memoize: Streaming[A]

    Permalink

    Ensure that repeated traversals of the stream will not cause repeated tail computations.

    Ensure that repeated traversals of the stream will not cause repeated tail computations.

    By default this structure does not memoize to avoid memory leaks when the head of the stream is retained. However, the user ultimately has control of the memoization approach based on what kinds of Eval instances they use.

    There are two calls to .memoize here -- one is a recursive call to this method (on the tail) and the other is a call to memoize the Eval instance holding the tail. For more information on how this works see cats.Eval.memoize.

    Definition Classes
    Streaming
  31. def merge(rhs: Streaming[A])(implicit ev: Order[A]): Streaming[A]

    Permalink

    Merge two sorted streams into a new stream.

    Merge two sorted streams into a new stream.

    The streams are assumed to already be sorted. If they are not, the resulting order is not defined.

    Definition Classes
    Streaming
  32. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  33. def nonEmpty: Boolean

    Permalink

    Return true if the stream is non-empty, false otherwise.

    Return true if the stream is non-empty, false otherwise.

    In this case of deferred streams this will force the first element to be calculated.

    Definition Classes
    Streaming
  34. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  36. def peekEmpty: Option[Boolean]

    Permalink

    Peek at the start of the stream to see whether we know if it is empty.

    Peek at the start of the stream to see whether we know if it is empty.

    Unlike .isEmpty/.nonEmpty, this method will not force the calculationg of a deferred stream. Instead, None will be returned.

    Definition Classes
    Streaming
  37. def product[B](rhs: Streaming[B]): Streaming[(A, B)]

    Permalink

    Produce the Cartestian product of two streams.

    Produce the Cartestian product of two streams.

    Given x = [x0, x1, x2, ...] and y = [y0, y1, y2, ...] this method will return the stream:

    [(x0, y0), (x0, y1), (x1, y0), (x0, y2), (x1, y1), (x2, y0), ...]

    This is the diagonalized product of both streams. Every possible combination will (eventually) be reached.

    This is true even for infinite streams, at least in theory -- time and space limitations of evaluating an infinite stream may make it impossible to reach very distant elements.

    This method lazily evaluates the input streams, but due to the diagonalization method may read ahead more than is strictly necessary.

    Definition Classes
    Streaming
  38. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  39. def tails: Streaming[Streaming[A]]

    Permalink

    Provide a stream of all the tails of a stream (including itself).

    Provide a stream of all the tails of a stream (including itself).

    For example, Streaming(1, 2).tails is equivalent to:

    Streaming(Streaming(1, 2), Streaming(1), Streaming.empty)

    Definition Classes
    Streaming
  40. def take(n: Int): Streaming[A]

    Permalink

    Return a stream consisting only of the first n elements of this stream.

    Return a stream consisting only of the first n elements of this stream.

    If the current stream has n or fewer elements, the entire stream will be returned.

    Definition Classes
    Streaming
  41. def takeWhile(f: (A) ⇒ Boolean): Streaming[A]

    Permalink

    From the beginning of this stream, create a new stream which takes only those elements that fulfill the predicate f.

    From the beginning of this stream, create a new stream which takes only those elements that fulfill the predicate f. Once an element is found which does not fulfill the predicate, no further elements will be returned.

    If all elements satisfy f, the current stream will be returned. If no elements satisfy f, an empty stream will be returned.

    For example:

    Streaming(1, 2, 3, 4, 5, 6, 7).takeWhile(n => n != 4)

    Will result in: Streaming(1, 2, 3)

    Definition Classes
    Streaming
  42. def toArray(implicit ct: ClassTag[A]): Array[A]

    Permalink

    Provide an array of elements in the stream.

    Provide an array of elements in the stream.

    This will evaluate the stream immediately, and will hang in the case of infinite streams.

    Definition Classes
    Streaming
  43. def toList: List[A]

    Permalink

    Provide a list of elements in the stream.

    Provide a list of elements in the stream.

    This will evaluate the stream immediately, and will hang in the case of infinite streams.

    Definition Classes
    Streaming
  44. def toScalaList: scala.collection.immutable.List[A]

    Permalink

    Provide a scala.collection.immutable.List of elements in the stream.

    Provide a scala.collection.immutable.List of elements in the stream.

    This will evaluate the stream immediately, and will hang in the case of infinite streams.

    Definition Classes
    Streaming
  45. def toString(limit: Int = 10): String

    Permalink

    String representation of the first n elements of a stream.

    String representation of the first n elements of a stream.

    Definition Classes
    Streaming
  46. def toString(): String

    Permalink

    Basic string representation of a stream.

    Basic string representation of a stream.

    This method will not force evaluation of any lazy part of a stream. As a result, you will see at most one element (the first one).

    Use .toString(n) to see the first n elements of the stream.

    Definition Classes
    Streaming → AnyRef → Any
  47. def uncons: Option[(A, Eval[Streaming[A]])]

    Permalink

    Deconstruct a stream into a head and tail (if available).

    Deconstruct a stream into a head and tail (if available).

    This method will evaluate the stream until it finds a head and tail, or until the stream is exhausted. The head will be evaluated, whereas the tail will remain (potentially) lazy within Eval.

    Definition Classes
    Streaming
  48. def unzip[B, C](implicit ev: =:=[A, (B, C)]): (Streaming[B], Streaming[C])

    Permalink

    Unzip this stream of tuples into two distinct streams.

    Unzip this stream of tuples into two distinct streams.

    Definition Classes
    Streaming
  49. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. def zip[B](rhs: Streaming[B]): Streaming[(A, B)]

    Permalink

    Lazily zip two streams together.

    Lazily zip two streams together.

    The length of the result will be the shorter of the two arguments.

    Definition Classes
    Streaming
  53. def zipMap[B, C](rhs: Streaming[B])(f: (A, B) ⇒ C): Streaming[C]

    Permalink

    Lazily zip two streams together, using the given function f to produce output values.

    Lazily zip two streams together, using the given function f to produce output values.

    The length of the result will be the shorter of the two arguments.

    The expression:

    (lhs zipMap rhs)(f)

    is equivalent to (but more efficient than):

    (lhs zip rhs).map { case (a, b) => f(a, b) }

    Definition Classes
    Streaming
  54. def zipWithIndex: Streaming[(A, Int)]

    Permalink

    Zip the items of the stream with their position.

    Zip the items of the stream with their position.

    Indices start at 0, so

    Streaming('x, 'y, 'z).zipWithIndex

    lazily produces:

    Streaming(('x, 0), ('y, 1), ('z, 2))

    Definition Classes
    Streaming

Inherited from Streaming[A]

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped