Packages

c

io.regadas.scio.cats.syntax

SCollectionOps

final class SCollectionOps[F[_], A] extends AnyVal

com.spotify.scio.values.SCollection functions that operate over F[_] types.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SCollectionOps
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new SCollectionOps(coll: SCollection[F[A]])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. def as[B](b: B)(implicit F: Functor[F], coder: Coder[F[B]]): SCollection[F[B]]

    Replaces the A value in F[A] with the supplied value.

    Replaces the A value in F[A] with the supplied value.

    Example:

    scala> val coll: SCollection[List[Int]] = sc.paralelize(Seq(List(1, 2, 3)))
    scala> coll.as("hello")
    res0: SCollection[List[String]](List(hello, hello, hello))
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def collect_[B](f: PartialFunction[A, B])(implicit F: FunctorFilter[F], coder: Coder[F[B]]): SCollection[F[B]]
  7. def combine_(implicit M: CommutativeMonoid[F[A]], C: Coder[F[A]]): SCollection[F[A]]

    Combines all the elements in each window of the input into a single value in the output.

    Combines all the elements in each window of the input into a single value in the output.

    If the input com.spotify.scio.values.SCollection is windowed into org.apache.beam.sdk.transforms.windowing.GlobalWindows, cats.kernel.CommutativeMonoid empty will be outputed in the org.apache.beam.sdk.transforms.windowing.GlobalWindow if the input is empty.

  8. def empty(implicit FF: Foldable[F]): SCollection[F[A]]

    Filters all empty F[A]

  9. def empty(p: (A) => Boolean)(implicit F: FunctorFilter[F], FF: Foldable[F], c: Coder[F[A]]): SCollection[F[A]]

    Similar to ffilter but filters all empty F[A] that satisfy the predicate.

    Similar to ffilter but filters all empty F[A] that satisfy the predicate.

    Example:

    scala> val coll: SCollection[List[Int]] = sc.paralelize(Seq(List(1, 2, 3), List(-1, 0)))
    scala> coll.empty(_ > 1)
  10. def ffilter(p: (A) => Boolean)(implicit F: FunctorFilter[F], c: Coder[F[A]]): SCollection[F[A]]

    Apply a filter to a structure such that the output structure contains all A elements in the input structure that satisfy the predicate f but none that don't.

    Apply a filter to a structure such that the output structure contains all A elements in the input structure that satisfy the predicate f but none that don't.

    Example:

    scala> val data = Seq(Option(1), Option(2), None)
    scala> sc.parallelize(data).ffilter(_ <= 1)
    res0: SCollection[Option[Int]](Option(1), None, None)
    
    scala> val listData = Seq(List(1, 2, 3), List(4, 5, 6))
    scala> sc.parallelize(listData).ffilter(_ <= 1)
    res0: SCollection[List[Int]](List(1), List())
  11. def filter_(p: (A) => Boolean)(implicit F: FunctorFilter[F], FF: Foldable[F], c: Coder[F[A]]): SCollection[F[A]]

    Filter the elements that satisfy a predicate.

  12. def flatMap_[B](f: (A) => F[B])(implicit F: FlatMap[F], coder: Coder[F[B]]): SCollection[F[B]]

    Allows us to have a value in a context (F[A]) and then feed that into a function that takes a normal value and returns a value in a context (A => F[B]).

  13. def flatTraverse[G[_], B](f: (A) => G[F[B]])(implicit T: Traverse[F], F: FlatMap[F], G: Applicative[G], coder: Coder[G[F[B]]]): SCollection[G[F[B]]]

    A traverse followed by flattening the inner result.

    A traverse followed by flattening the inner result.

    Example:

    scala> val data = Seq(Option(List("1", "2", "3", "four")))
    scala> val parseInt: String => Option[Int] = s => Try(s.toInt).toOption
    scala> sc.parallelize(data).flatTraverse(_.map(parseInt))
    res0: SCollection[List[Option[Int]]](List(Some(1), Some(2), Some(3), None))
  14. def flatten_(implicit FF: Foldable[F], c: Coder[A]): SCollection[A]

    "flatten" a nested structure into a single-layer A layer.

    "flatten" a nested structure into a single-layer A layer.

    Example:

    scala> val coll: SCollection[List[Int]] = sc.paralelize(Seq(List(1, 2, 3)))
    scala> coll.flattenF
    res0: SCollection[Int](1, 2, 3)
  15. def foldF(implicit F: Foldable[F], M: CommutativeMonoid[A], c: Coder[A]): SCollection[A]

    Fold implemented using the given Monoid[A] instance.

  16. def fproduct[B](f: (A) => B)(implicit F: Functor[F], coder: Coder[F[(A, B)]]): SCollection[F[(A, B)]]

    Tuple the values in fa with the result of applying a function with the value

    Tuple the values in fa with the result of applying a function with the value

    Example:

    scala> val coll: SCollection[Option[Int]] = sc.paralelize(Seq(Option(42)))
    scala> coll.fproduct(_.toString)
    res0: SCollection[Option[(Int, String)]](Some((42, 42)))
  17. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def mapFilter[B](f: (A) => Option[B])(implicit F: FunctorFilter[F], coder: Coder[F[B]]): SCollection[F[B]]

    A combined map and filter.

    A combined map and filter. Filtering is handled via Option instead of Boolean such that the output type B can be different than the input type A.

    Example:

    scala> val m: Map[Int, String] = Map(1 -> "one", 3 -> "three")
    scala> val data = Seq(Option(1), Option(2), None)
    scala> sc.parallelize(data).mapFilter(m.get(_))
    res0: SCollection[Option[String]](Some("one"), None, None)
    
    scala> val listData = Seq(List(1, 2, 3), List(4, 5, 6))
    scala> sc.parallelize(listData).mapFilter(m.get(_))
    res0: SCollection[List[String]](List("one", "three"), List())
  20. def map_[B](f: (A) => B)(implicit F: Functor[F], coder: Coder[F[B]]): SCollection[F[B]]

    Apply function to F[A]

    Apply function to F[A]

    scala> val coll: SCollection[Map[Int, String]] =
             sc.paralelize(Seq(Map(1 -> "hi", 2 -> "there", 3 -> "you")))
    scala> coll.map_(_ ++ "!")
    res0: SCollection[Map[Int, String]](Map(1 -> hi!, 2 -> there!, 3 -> you!))
  21. def maxOption(implicit F: Foldable[F], o: Order[A], c: Coder[Option[A]]): SCollection[Option[A]]
  22. def minOption(implicit F: Foldable[F], o: Order[A], c: Coder[Option[A]]): SCollection[Option[A]]
  23. def mproduct[B](f: (A) => F[B])(implicit F: FlatMap[F], coder: Coder[F[(A, B)]]): SCollection[F[(A, B)]]

    Pair A with the result of function application.

    Pair A with the result of function application.

    Example:

    scala> val coll: SCollection[List[String]] = sc.paralelize(Seq(List("12", "34", "56")))
    scala> coll.mproduct(_.toList)
    res0: SCollection[List[(String, String)]](List((12,1), (12,2), (34,3), (34,4), (56,5), (56,6)))
  24. def nonEmpty(implicit FF: Foldable[F]): SCollection[F[A]]

    Filters all non empty F[A]

  25. def nonEmpty(p: (A) => Boolean)(implicit F: FunctorFilter[F], FF: Foldable[F], c: Coder[F[A]]): SCollection[F[A]]

    Similar to ffilter but filters all non empty F[A] that satisfy the predicate.

    Similar to ffilter but filters all non empty F[A] that satisfy the predicate.

    Example:

    scala> val coll: SCollection[List[Int]] = sc.paralelize(Seq(List(1, 2, 3), List(-1, 0)))
    scala> coll.nonEmpty(_ > 1)
    res0: SCollection[List[Int]](List(2, 3))
  26. def show(out: PrintStream)(implicit S: Show[F[A]]): SCollection[F[A]]

    Writes to the supplied PrintStream, converting each element to a String via Show.

    Writes to the supplied PrintStream, converting each element to a String via Show.

    out

    PrintStream to write the elements to.

  27. def showStdOut(implicit S: Show[F[A]]): SCollection[F[A]]
  28. def toString(): String
    Definition Classes
    Any
  29. def traverse[G[_], B](f: (A) => G[B])(implicit arg0: Applicative[G], T: Traverse[F], coder: Coder[G[F[B]]]): SCollection[G[F[B]]]

    Given a function which returns a G effect, thread this effect through the running of this function on all the values in F, returning an F[B] in a G context.

    Given a function which returns a G effect, thread this effect through the running of this function on all the values in F, returning an F[B] in a G context.

    Example:

    scala> val data = Seq(List(Some(1), Some(2), None), List(Some(1), Some(2), Some(3)))
    scala> sc.parallelize(data).traverse(identity)
    res0: SCollection[Option[List[Int]]](None, Some(List(1, 2, 3)))
  30. def tupleLeft[B](b: B)(implicit F: Functor[F], coder: Coder[F[(B, A)]]): SCollection[F[(B, A)]]

    Tuples the A value in F[A] with the supplied B value, with the B value on the left.

    Tuples the A value in F[A] with the supplied B value, with the B value on the left.

    Example:

    scala> val coll: SCollection[List[String]] = sc.paralelize(Seq(List("hello", "world")))
    scala> coll.tupleLeft(42)
    res0: SCollection[List[(Int, String)]](List((42,hello), (42,world)))
  31. def tupleRight[B](b: B)(implicit F: Functor[F], coder: Coder[F[(A, B)]]): SCollection[F[(A, B)]]

    Tuples the A value in F[A] with the supplied B value, with the B value on the right.

    Tuples the A value in F[A] with the supplied B value, with the B value on the right.

    Example: Example:

    scala> val coll: SCollection[List[String]] = sc.paralelize(Seq(List("hello", "world")))
    scala> coll.tupleRight(42)
    res0: SCollection[List[(String, Int)]](List((hello, 42), (world, 42)))

Inherited from AnyVal

Inherited from Any

Ungrouped