Packages

c

monix.tail.batches

GenericCursor

abstract class GenericCursor[+A] extends BatchCursor[A]

Reusable BatchCursor base class that can be used for implementing cursors by just providing the primitive operations, hasNext, next and recommendedBatchSize.

Self Type
GenericCursor[A]
Source
GenericCursor.scala
Linear Supertypes
BatchCursor[A], Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. GenericCursor
  2. BatchCursor
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new GenericCursor()

Abstract Value Members

  1. abstract def hasNext(): Boolean

    Tests whether this cursor can provide another element.

    Tests whether this cursor can provide another element.

    This method can be side-effecting, depending on the implementation and thus it can also throw exceptions. This is because in certain cases the only way to know if there is a next element or not involves triggering dangerous side-effects.

    This method is idempotent until the call to next happens, meaning that multiple hasNext calls can be made and implementations are advised to memoize the result.

    returns

    true if a subsequent call to next will yield an element, false otherwise.

    Definition Classes
    BatchCursor
  2. abstract def next(): A

    Produces the next element of this iterator.

    Produces the next element of this iterator.

    This method is side-effecting, as it mutates the internal state of the cursor and can throw exceptions.

    returns

    the next element of this iterator, if hasNext is true, undefined behavior otherwise (can throw exceptions).

    Definition Classes
    BatchCursor
  3. abstract def recommendedBatchSize: Int

    In case this cursor is going to be processed eagerly, in batches then this value should be the recommended batch size for the source cursor.

    In case this cursor is going to be processed eagerly, in batches then this value should be the recommended batch size for the source cursor.

    Examples:

    • if this cursor is iterating over a standard collection with a finite size, it can be something generous like 1024
    • if it's iterating over a cheap infinite iterator (e.g. Iterator.range), it could be 128.
    • if it does any sort of I/O or blocking of threads, then the recommended value is 1.

    Basically the batch size should be adjusted according to how expensive processing this cursor is. If it's a strict collection of a finite size, then it can probably be processed all at once. But if it's a big database result set that can block threads on reads, then it's probably wise to do it one item at a time.

    Definition Classes
    BatchCursor

Concrete Value Members

  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
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. def collect[B](pf: PartialFunction[A, B]): BatchCursor[B]

    Creates a cursor by transforming values produced by the source cursor with a partial function, dropping those values for which the partial function is not defined.

    Creates a cursor by transforming values produced by the source cursor with a partial function, dropping those values for which the partial function is not defined.

    NOTE: application of this function can be either strict or lazy (depending on the underlying cursor type), but it does not modify the original collection.

    pf

    the partial function which filters and maps the cursor.

    returns

    a new cursor which yields each value x produced by this cursor for which pf is defined

    Definition Classes
    GenericCursorBatchCursor
  7. def drop(n: Int): BatchCursor[A]

    Creates a new cursor that advances this cursor past the first n elements, or the length of the cursor, whichever is smaller.

    Creates a new cursor that advances this cursor past the first n elements, or the length of the cursor, whichever is smaller.

    n

    the number of elements to drop

    returns

    a cursor which produces all values of the current cursor, except it omits the first n values.

    Definition Classes
    GenericCursorBatchCursor
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def filter(p: (A) => Boolean): BatchCursor[A]

    Returns an cursor over all the elements of the source cursor that satisfy the predicate p.

    Returns an cursor over all the elements of the source cursor that satisfy the predicate p. The order of the elements is preserved.

    NOTE: application of this function can be either strict or lazy (depending on the underlying cursor type), but it does not modify the original collection.

    p

    the predicate used to test values.

    returns

    a cursor which produces those values of this cursor which satisfy the predicate p.

    Definition Classes
    GenericCursorBatchCursor
  11. def foldLeft[R](initial: R)(op: (R, A) => R): R

    Applies a binary operator to a start value and all elements of this cursor, going left to right.

    Applies a binary operator to a start value and all elements of this cursor, going left to right.

    NOTE: applying this function on the cursor will consume it completely.

    R

    is the result type of the binary operator.

    initial

    is the start value.

    op

    the binary operator to apply

    returns

    the result of inserting op between consecutive elements of this cursor, going left to right with the start value initial on the left. Returns initial if the cursor is empty.

    Definition Classes
    BatchCursor
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. def isEmpty: Boolean

    Returns true in case our cursor is empty or false if there are more elements to process.

    Returns true in case our cursor is empty or false if there are more elements to process.

    Alias for !cursor.hasNext().

    Definition Classes
    BatchCursor
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def map[B](f: (A) => B): BatchCursor[B]

    Creates a new cursor that maps all produced values of this cursor to new values using a transformation function.

    Creates a new cursor that maps all produced values of this cursor to new values using a transformation function.

    NOTE: application of this function can be either strict or lazy (depending on the underlying cursor type), but it does not modify the original collection.

    f

    is the transformation function

    returns

    a new cursor which transforms every value produced by this cursor by applying the function f to it.

    Definition Classes
    GenericCursorBatchCursor
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def nonEmpty: Boolean

    Returns true in case our cursor has more elements to process or false if the cursor is empty.

    Returns true in case our cursor has more elements to process or false if the cursor is empty.

    Alias for hasNext.

    Definition Classes
    BatchCursor
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. def slice(from: Int, until: Int): BatchCursor[A]

    Creates an cursor returning an interval of the values produced by this cursor.

    Creates an cursor returning an interval of the values produced by this cursor.

    from

    the index of the first element in this cursor which forms part of the slice.

    until

    the index of the first element following the slice.

    returns

    a cursor which advances this cursor past the first from elements using drop, and then takes until - from elements, using take

    Definition Classes
    GenericCursorBatchCursor
  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def take(n: Int): BatchCursor[A]

    Creates a new cursor that will only emit the first n values of this cursor.

    Creates a new cursor that will only emit the first n values of this cursor.

    n

    is the number of values to take

    returns

    a cursor producing only of the first n values of this cursor, or else the whole sequence, if it produces fewer than n values.

    Definition Classes
    GenericCursorBatchCursor
  24. def toArray[B >: A](implicit arg0: ClassTag[B]): Array[B]

    Converts this cursor into an Array, consuming it in the process.

    Converts this cursor into an Array, consuming it in the process.

    Definition Classes
    BatchCursor
  25. def toBatch: Batch[A]

    Converts this cursor into a reusable array-backed Batch, consuming it in the process.

    Converts this cursor into a reusable array-backed Batch, consuming it in the process.

    Definition Classes
    BatchCursor
  26. def toIterator: Iterator[A]

    Converts this cursor into a Scala Iterator.

    Converts this cursor into a Scala Iterator.

    Definition Classes
    GenericCursorBatchCursor
  27. def toList: List[A]

    Converts this cursor into a Scala immutable List, consuming it in the process.

    Converts this cursor into a Scala immutable List, consuming it in the process.

    Definition Classes
    BatchCursor
  28. def toString(): String
    Definition Classes
    AnyRef → Any
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from BatchCursor[A]

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped