WithFilter

scala.collection.WithFilter
abstract class WithFilter[+A, +CC[_]] extends Serializable

A template trait that contains just the map, flatMap, foreach and withFilter methods of trait Iterable.

Attributes

A

Element type (e.g. Int)

CC

Collection type constructor (e.g. List)

Source:
WithFilter.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class WithFilter[A, CC]
class WithFilter[K, V, IterableCC, CC]
class WithFilter[K, V, IterableCC, MapCC, CC]
class WithFilter[A, IterableCC, CC]

Members list

Concise view

Value members

Abstract methods

def flatMap[B](f: A => IterableOnce[B]): CC[B]

Builds a new collection by applying a function to all elements of the filtered outer collection containing this WithFilter instance that satisfy

Builds a new collection by applying a function to all elements of the filtered outer collection containing this WithFilter instance that satisfy

Attributes

B

the element type of the returned collection.

f

the function to apply to each element.

Returns:

a new collection resulting from applying the given collection-valued function f to each element of the filtered outer collection and concatenating the results.

Source:
WithFilter.scala
def foreach[U](f: A => U): Unit

Applies a function f to all elements of the filtered outer collection.

Applies a function f to all elements of the filtered outer collection.

Attributes

U

the type parameter describing the result of function f. This result will always be ignored. Typically U is Unit, but this is not necessary.

f

the function that is applied for its side-effect to every element. The result of function f is discarded.

Source:
WithFilter.scala
def map[B](f: A => B): CC[B]

Builds a new collection by applying a function to all elements of the filtered outer collection.

Builds a new collection by applying a function to all elements of the filtered outer collection.

Attributes

B

the element type of the returned collection.

f

the function to apply to each element.

Returns:

a new collection resulting from applying the given function f to each element of the filtered outer collection and collecting the results.

Source:
WithFilter.scala
def withFilter(q: A => Boolean): WithFilter[A, CC]

Further refines the filter for this filtered collection.

Further refines the filter for this filtered collection.

Attributes

q

the predicate used to test elements.

Returns:

an object of class WithFilter, which supports map, flatMap, foreach, and withFilter operations. All these operations apply to those elements of this collection which also satisfy both p and q predicates.

Source:
WithFilter.scala