trait _filter[A] extends Stream.Flow._extend._filter[A]
- Alphabetic
- Stream._extend._filter
- Stream.Flow._extend._filter
- 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
- _filter → Shared
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
filter(f: Filter[A]): Stream[A]
Same as let
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
let(f: Filter[A]): Stream[A]
Main filter
-
def
letAll(that: ~[A])(implicit o: Ordering[A] = null): ~[A]
Group filter
Group filter
Only lets elements equal to the found in that stream
val idx = (1 to 5).all.flatMap(i => Seq(i,i,i)).to[Idx] idx.all.lp // Prints: ~(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5) idx.all.letAll(3 to 7).lp // Prints: ~(3, 3, 3, 4, 4, 4, 5, 5, 5) idx.all.letAll(List(2, 5, 11)).lp // Prints: ~(2, 2, 2, 5, 5, 5)
Note. The operation is very efficient if streams are sorted
- Definition Classes
- _filter
-
def
letAllBy[B](f: Mapping[A, B], that: ~[B])(implicit o: Ordering[B] = null): ~[A]
Property group filter
Property group filter
Only lets elements, which produce property value equal to the found in that stream
~~("abc", "d", "e", "", "fg", "hijk").letAllBy(_.length, Seq(0, 1, 2)).lp // Output ~(d, e, , fg)
- Definition Classes
- _filter
-
def
letIdx(f: Filter.Idx[A], start: Int = 0): ~[A]
Indexed filter
Indexed filter
Only lets elements satisfying the filter
('a' to 'z').all.letIdx((i, v) => i >= 2 && i <= 7, 1).lp // Output ~(b, c, d, e, f, g)
- start
the starting indexing value
- Definition Classes
- _filter
-
def
letLast(number: Int): ~[A]
Sequence tail filter
Sequence tail filter
Only lets specified number of last elements
(1 to 10).all.letLast(3).lp // Prints ~(8, 9, 10)
- Definition Classes
- _filter
-
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
- _filter → Shared
-
def
letNext(number: Int): ~[A]
Sequence head filter
-
def
letRange(r: Range): ~[A]
Sequence range filter
Sequence range filter
Only lets elements within given index range
('a' to 'z').all.letRange(1 to 7).lp // Output ~(b, c, d, e, f, g, h)
- Definition Classes
- _filter
-
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
- _filter → Shared
-
def
letWhile(f: Filter[A]): ~[A]
Sequence head filter
Sequence head filter
Only lets first consecutive elements satisfying the filter
Note, everything starting from the first non compliant element will be discarded (including later compliant elements)
def all = (1 to 5).all +~ (1 to 5) all.lp // Prints ~(1, 2, 3, 4, 5, 1, 2, 3, 4, 5) all.letWhile(_ <= 3).lp // Prints ~(1, 2, 3)
- Definition Classes
- _filter
-
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( ... )
-
def
drop(f: Filter[A]): Stream[A]
Reversed filter
-
def
dropAll(a: ~[A])(implicit o: Ordering[A] = null): ~[A]
Group reversed filter
Group reversed filter
Discards all elements equal to the found in that stream
val idx = (1 to 5).all.flatMap(i => Seq(i, i, i)).to[Idx] idx.all.lp // Prints: ~(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5) idx.all.dropAll(3 to 7).lp // Prints: ~(1, 1, 1, 2, 2, 2) idx.all.dropAll(List(2, 5, 11)).lp // Prints: ~(1, 1, 1, 3, 3, 3, 4, 4, 4)
Note. The operation is very efficient if streams are sorted
- Definition Classes
- _filter
-
def
dropAllBy[B](f: Mapping[A, B], a: ~[B])(implicit o: Ordering[B] = null): ~[A]
Property group reversed filter
Property group reversed filter
Discards elements, which produce property value equal to the found in that stream
~~("abc", "d", "e", "", "fg", "hijk").dropAllBy(_.length, Seq(0, 3)).lp // Output ~(d, e, fg, hijk)
- Definition Classes
- _filter
-
def
dropEverythingIf(b: Boolean): ~[A]
Discarding everything
Discarding everything
With a single test lets to drop the entire pipeline in favor of void instance
Note: This can also be done with 'if-else' outside the pipeline, however it proved to be useful with really long statements
(1 to 10).all.dropEverythingIf(true).lp // Prints ~()
- Definition Classes
- _filter
-
def
dropLast(number: Int): ~[A]
Sequence tail reversed filter
Sequence tail reversed filter
Discards the last consecutive number of elements
(1 to 10).all.dropLast(3).lp // Prints ~(1, 2, 3, 4, 5, 6, 7)
- Definition Classes
- _filter
-
def
dropNext(number: Int): ~[A]
Sequence head reversed filter
Sequence head reversed filter
Discards the first consecutive number of elements
(1 to 10).all.dropNext(3).lp // Prints ~(4, 5, 6, 7, 8, 9, 10)
- Definition Classes
- _filter
-
def
dropRange(r: Range): ~[A]
Sequence range reversed filter
Sequence range reversed filter
Discards elements, which fall within the specified range
(1 to 10).all.dropRange(3 to 7).lp // Prints ~(1, 2, 3, 9, 10)
- Definition Classes
- _filter
-
def
dropWhile(f: Filter[A]): ~[A]
Sequence head reversed filter
Sequence head reversed filter
Discards first consecutive elements satisfying the filter
Note, everything starting from the first non compliant element will be allowed (including later compliant elements)
def all = (1 to 5).all +~ (1 to 5) all.lp // Prints ~(1, 2, 3, 4, 5, 1, 2, 3, 4, 5) all.dropWhile(_ <= 3).lp // Prints ~(4, 5, 1, 2, 3, 4, 5)
- Definition Classes
- _filter
Filter Interface
Base word
let
means 'allow only' certain elements trough the pipelineBase word
drop
means 'discard' certain elements from the pipeline