trait _map[A] extends Stream.Flow._extend._map[A]
- Alphabetic
- Stream._extend._map
- Stream.Flow._extend._map
- Stream.Flow._extend.Z.Shared
- scala.AnyRef
- scala.Any
- Hide All
- Show All
- Public
- All
Method
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
collect[B](f: PartialFunction[A, B])(implicit arg0: Tag[B]): Stream[B]
Filter and converter
Filter and converter
Only lets elements for which given PartialFinction is defined
The elements are converted to returned type
def all = ~~[Any] + "ABC" + 1 + 22.0 + "DE" + 333F + "F" all.lp // Prints ~(ABC, 1, 22.0, DE, 333.0, F) all.collect{ case s: String if (s.length > 1) => s }.lp // Prints ~(ABC, DE)
Note. collect always requires double evaluation for each element, so letMap is preferred in many cases
- Definition Classes
- _map → Shared
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flatMap[B](f: Mapping[A, ~[B]])(implicit i: Tag[B]): Stream[B]
Map multiplier
Map multiplier
For every existing element, a mapped stream of elements is inserted into the pipeline
Note. The mapping can return an empty stream, in which case total number of elements might even be reduced
~~(1, 2, 3).flatMap(i => Seq(i * 10, i * 100, i * 1000)).lp // Output ~(10, 100, 1000, 20, 200, 2000, 30, 300, 3000)
- f
function to provide a stream of elements for each existing element
-
def
flatten[B](implicit f: Mapping[A, ~[B]], i: Tag[B]): Stream[B]
Converts a stream of streams into a flat stream
Converts a stream of streams into a flat stream
val stream: ~[~[Char]] = ~~( 'a' to 'd', List('x', 'y', 'z'), Vector('v', 'e', 'c', 't', 'o', 'r')) stream.flatten.lp // Prints: ~(a, b, c, d, x, y, z, v, e, c, t, o, r)
- Definition Classes
- _map
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
letMap[B](f: Mapping[A, Opt[B]])(implicit i: Tag[B]): Stream[B]
Filter and converter
Filter and converter
Only lets elements for which given function returns non empty Opt
The elements are converted to the new type
def all = "ABC" ~+ "1" + "22" + "D" + "333" + "E" all.letMap(v => if (v.length < 2) \/ else v).lp // Prints: ~(ABC, 22, 333) all.letMap({ case s if (s.length >= 2) => s case _ => \/ }).lp // Prints: ~(ABC, 22, 333)
Note: letMap is often a faster alternative to collect with PartialFunction, because it is evaluated just once for each element
- Definition Classes
- _map → Shared
-
def
letType[B](implicit t: ClassTag[B]): Stream[B]
Filter and type converter
Filter and type converter
Only lets elements, which are instances of the given type
Note, the result is mapped to the specified type
def all = ~~[Any] + "1" + 2 + 3.0 + 4l + "5" all.lp // Prints ~(1, 2, 3.0, 4, 5) all.letType[String].lp // Prints ~(1, 5)
- Definition Classes
- _map → Shared
-
def
map[B](f: Mapping[A, B])(implicit i: Tag[B]): Stream[B]
Element conversion
-
def
mapCast[B]: Stream[B]
Element cast
-
def
mapIdx[B](f: Mapping.Idx[A, B], start: Int = 0)(implicit arg0: Tag[B]): ~[B]
Indexed element conversion
Indexed element conversion
Converts every element in the pipeline with given function
('A' to 'G').all.mapIdx(_ + "=" + _, 1).lp // Prints ~(1=A, 2=B, 3=C, 4=D, 5=E, 6=F, 7=G)
- f
the conversion function which also accepts element index in the sequence
- start
the starting value of indexing
- Definition Classes
- _map
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Stream Conversion Interface