com.daodecode.scalax.collection.extensions

IterableLikeExtension

implicit final class IterableLikeExtension[A, Repr <: IterableLike[A, Repr]] extends AnyVal

Linear Supertypes
AnyVal, NotNull, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. IterableLikeExtension
  2. AnyVal
  3. NotNull
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new IterableLikeExtension(iterableLike: IterableLike[A, Repr])

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. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def foldLeftWhile[B](z: B)(p: (B) ⇒ Boolean)(op: (B, A) ⇒ B): B

    Applies a binary operator to a start value and all elements of this collection while predicate p is satisfied, going left to right.

    Applies a binary operator to a start value and all elements of this collection while predicate p is satisfied, going left to right.

    Example:

    scala> val xs = Iterable(List(1,2,3), List(4,5), List(6,7,8,9)).
    | foldLeftWhile(List.empty[Int])(_.size < 4){ case (acc, l) => acc ++ l }
    xs: List[Int] = List(1, 2, 3, 4, 5)
    B

    the result type of the binary operator.

    z

    the start value.

    p

    the predicate used to test if folding should continue.

    op

    the binary operator.

    returns

    the result of inserting op between consecutive elements of this collection while predicate p is satisfied, going left to right with the start value z on the left.

    Since

    0.1.0

  6. def foldRightWhile[B](z: B)(p: (B) ⇒ Boolean)(op: (A, B) ⇒ B): B

    Applies a binary operator to all elements of this collection and a start value while predicate p is satisfied, going right to left.

    Applies a binary operator to all elements of this collection and a start value while predicate p is satisfied, going right to left.

    Example:

    scala> val xs = Iterable(List(1,2,3), List(4,5), List(6,7,8,9)).
    | foldRightWhile(List.empty[Int])(_.size < 5){ case (l, acc) =>  l ::: acc }
    xs: List[Int] = List(4, 5, 6, 7, 8, 9)
    B

    the result type of the binary operator.

    z

    the start value.

    p

    the predicate used to test if folding should continue.

    op

    the binary operator.

    returns

    the result of inserting op between consecutive elements of this collection while predicate p is satisfied, going right to left with the start value z on the right.

    Since

    0.1.0

  7. def getClass(): Class[_ <: AnyVal]

    Definition Classes
    AnyVal → Any
  8. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  9. val iterableLike: IterableLike[A, Repr]

  10. def toCompleteMap[K, V, That](implicit ev: <:<[A, (K, V)], cbf: CanBuildFrom[Repr, V, That]): Map[K, That]

    Converts this collection to a map.

    Converts this collection to a map. This method is unavailable unless the elements are members of Tuple2[K, V]. The method is different from toMap in the way that values for duplicate keys will be collected into collection, so all the values will be in the result map.

    Example:

    scala> val cm = List(1 -> "1", 2 -> "2", 1 -> "11").toCompleteMap
    cm: scala.collection.immutable.Map[Int,List[String]] = Map(2 -> List(2), 1 -> List(1, 11))
    returns

    a map of type immutable.Map[K, That] where That is a collection of V

    Since

    0.1.1

  11. def toString(): String

    Definition Classes
    Any
  12. def withFrequency: Map[A, Int]

    Creates a new immutable Map with unique elements of this collection as keys and count of duplicates ((as determined by ==) (frequency) as values

    Creates a new immutable Map with unique elements of this collection as keys and count of duplicates ((as determined by ==) (frequency) as values

    Example:

    scala> val fm = List("a", "b", "c", "a", "b", "d").withFrequency
    fm: scala.collection.immutable.Map[String,Int] = Map(b -> 2, d -> 1, a -> 2, c -> 1)
    returns

    a map of type immutable.Map[A, Int] where Int represents a frequency of key A in original collection

    Since

    0.1.1

Inherited from AnyVal

Inherited from NotNull

Inherited from Any

Ungrouped