Class

fm.common.rich

RichTraversableOnce

Related Doc: package rich

Permalink

final class RichTraversableOnce[A] extends AnyVal

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

Instance Constructors

  1. new RichTraversableOnce(self: TraversableOnce[A])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def collapseBy[K](f: (A) ⇒ K): IndexedSeq[(K, Seq[A])]

    Permalink

    Collapse records that are next to each other by a key

    Collapse records that are next to each other by a key

    Example:

    This groups evens and odds together:

    Vector(2,4,6,1,3,2,5,7).collapseBy{ _ % 2 == 0 }
    // res1: IndexedSeq[(Boolean, Seq[Int])] = Vector((true,Vector(2, 4, 6)), (false,Vector(1, 3)), (true,Vector(2)), (false,Vector(5, 7)))
  6. def countBy[K](f: (A) ⇒ K): Map[K, Int]

    Permalink

    Like groupBy but returns the count of each key instead of the actual values

  7. def distinctUsing[B](f: (A) ⇒ B): IndexedSeq[A]

    Permalink
  8. def findMapped[B](f: (A) ⇒ Option[B]): Option[B]

    Permalink

    A combination of map + find that returns the first Some that is found after applying the map operation.

  9. def findMappedFuture[B](f: (A) ⇒ Future[Option[B]])(implicit ec: ExecutionContext): Future[Option[B]]

    Permalink

    Like findMapped except works with Futures.

    Like findMapped except works with Futures. Executes the futures one at a time until one with a defined result is found.

  10. def foreachWithIndex[U](f: (A, Int) ⇒ U): Unit

    Permalink
  11. def foreachWithLongIndex[U](f: (A, Long) ⇒ U): Unit

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

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

    Permalink
    Definition Classes
    Any
  14. def maxOption[B >: A](implicit cmp: Ordering[B]): Option[A]

    Permalink
  15. def minOption[B >: A](implicit cmp: Ordering[B]): Option[A]

    Permalink
  16. def mkStringOrBlank(start: String, sep: String, end: String): String

    Permalink

    Same as mkString except if the TraversableOnce is empty then an empty string is returned instead of the start and end params.

  17. val self: TraversableOnce[A]

    Permalink
  18. def sortByCached[K](f: (A) ⇒ K)(implicit ord: Ordering[K]): IndexedSeq[A]

    Permalink

    Like the normal sortBy but will cache the result of calling f on each element (i.e.

    Like the normal sortBy but will cache the result of calling f on each element (i.e. f is only called once for each element). This is useful when f is an expensive function and not just a single field access on the element.

    If this is call on something that isn't already an IndexedSeq then it will be automatically converted before sorting.

  19. def toHashMap[K, V](implicit ev: <:<[A, (K, V)]): HashMap[K, V]

    Permalink

    Like .toMap but creates an immutable.HashMap

  20. def toHashSet: HashSet[A]

    Permalink

    Like .toSet but creates an immutable.HashSet

  21. def toMultiValuedLowerAlphaNumericMap[V](implicit ev: <:<[A, (String, V)]): HashMap[String, Vector[V]]

    Permalink
  22. def toMultiValuedMap[K, V](implicit ev: <:<[A, (K, V)]): HashMap[K, Vector[V]]

    Permalink

    Like .toHashMap except allows multiple values per key

    Like .toHashMap except allows multiple values per key

    TODO: Change this to IndexedSeq so we can switch to ImmutableArray (if we want to)

  23. def toMultiValuedMapUsing[K](toKey: (A) ⇒ K): HashMap[K, IndexedSeq[A]]

    Permalink

    Like .groupBy but gives you an immutable.HashMap[K, IndexedSeq[A]]

  24. def toMultiValuedMapUsingKeys[K](toKeys: (A) ⇒ TraversableOnce[K]): HashMap[K, IndexedSeq[A]]

    Permalink

    Like .groupBy but gives you an immutable.HashMap[K, IndexedSeq[A]]

  25. def toMultiValuedMapWithKeyTransform[K, V, K2](keyTransform: (K) ⇒ K2)(implicit ev: <:<[A, (K, V)]): HashMap[K2, Vector[V]]

    Permalink

    Same as toMultiValuedMap but allows you to specify a transform function for the key

    Same as toMultiValuedMap but allows you to specify a transform function for the key

    TODO: Change this to IndexedSeq so we can switch to ImmutableArray (if we want to)

  26. def toMultiValuedMapWithTransforms[K, V, K2, V2](keyTransform: (K) ⇒ K2, valueTransform: (V) ⇒ V2)(implicit ev: <:<[A, (K, V)]): HashMap[K2, Vector[V2]]

    Permalink

    Same as toMultiValuedMap but allows you to specify transform functions for the key and value

    Same as toMultiValuedMap but allows you to specify transform functions for the key and value

    TODO: Change this to IndexedSeq so we can switch to ImmutableArray (if we want to)

  27. def toMultiValuedURLNameMap[V](implicit ev: <:<[A, (String, V)]): HashMap[String, Vector[V]]

    Permalink
  28. def toSortedSet(implicit ord: Ordering[A]): SortedSet[A]

    Permalink

    Like .toSet but returns a scala.collection.immutable.SortedSet instead

  29. def toString(): String

    Permalink
    Definition Classes
    Any
  30. def toUniqueHashMap[K, V](implicit ev: <:<[A, (K, V)]): HashMap[K, V]

    Permalink

    Same as .toHashMap but ensures there are no duplicate keys

  31. def toUniqueHashMapUsing[K](f: (A) ⇒ K): HashMap[K, A]

    Permalink

    Alias of uniqueGroupBy

  32. def toUniqueHashMapWithKeyTransform[K, V, K2](keyTransform: (K) ⇒ K2)(implicit ev: <:<[A, (K, V)]): HashMap[K2, V]

    Permalink

    Same as toUniqueHashMap but allows you to specify a transform function for the key

  33. def toUniqueHashMapWithTransforms[K, V, K2, V2](keyTransform: (K) ⇒ K2, valueTransform: (V) ⇒ V2)(implicit ev: <:<[A, (K, V)]): HashMap[K2, V2]

    Permalink

    Same as toUniqueHashMap but allows you to specify transform functions for the key and value

  34. def toUniqueHashSet: HashSet[A]

    Permalink

    Like .toHashSet but makes sure there are no duplicates

  35. def toUniqueLowerAlphaNumericMap[V](implicit ev: <:<[A, (String, V)]): HashMap[String, V]

    Permalink
  36. def toUniqueMap[K, V](implicit ev: <:<[A, (K, V)]): HashMap[K, V]

    Permalink

    Same as .toMap but ensures there are no duplicate keys

  37. def toUniqueSet: Set[A]

    Permalink

    Like .toSet but makes sure there are no duplicates

  38. def toUniqueURLNameMap[V](implicit ev: <:<[A, (String, V)]): HashMap[String, V]

    Permalink
  39. def toVector: Vector[A]

    Permalink

    Returns a Vector of this Iterable (if it's not already a Vector)

  40. def uniqueGroupBy[K](f: (A) ⇒ K): HashMap[K, A]

    Permalink

    Like groupBy but only allows a single value per key

Inherited from AnyVal

Inherited from Any

Ungrouped