final class RichIterableOnce[A] extends AnyVal
- Source
- RichIterableOnce.scala
- Alphabetic
- By Inheritance
- RichIterableOnce
- AnyVal
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RichIterableOnce(self: IterableOnce[A])
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- Any
- final def ##: Int
- Definition Classes
- Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def collapseBy[K](f: (A) => K): IndexedSeq[(K, Seq[A])]
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)))
- def countBy[K](f: (A) => K): Map[K, Int]
Like groupBy but returns the count of each key instead of the actual values
- def distinctUsing[B](f: (A) => B): IndexedSeq[A]
- def findMapped[B](f: (A) => Option[B]): Option[B]
A combination of map + find that returns the first Some that is found after applying the map operation.
- def findMappedFuture[B](f: (A) => Future[Option[B]])(implicit ec: ExecutionContext): Future[Option[B]]
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.
- def getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def maxOption[B >: A](implicit cmp: Ordering[B]): Option[A]
- def minOption[B >: A](implicit cmp: Ordering[B]): Option[A]
- def mkStringOrBlank(start: String, sep: String, end: String): String
Same as mkString except if the IterableOnce is empty then an empty string is returned instead of the start and end params.
- val self: IterableOnce[A]
- def sortByCached[K](f: (A) => K)(implicit ord: Ordering[K]): IndexedSeq[A]
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.
- def toHashMap[K, V](implicit ev: <:<[A, (K, V)]): HashMap[K, V]
Like .toMap but creates an immutable.HashMap
- def toHashSet: HashSet[A]
Like .toSet but creates an immutable.HashSet
- def toMultiValuedLowerAlphaNumericMap[V](implicit ev: <:<[A, (String, V)]): HashMap[String, Vector[V]]
- def toMultiValuedMap[K, V](implicit ev: <:<[A, (K, V)]): HashMap[K, Vector[V]]
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)
- def toMultiValuedMapUsing[K](toKey: (A) => K): HashMap[K, IndexedSeq[A]]
Like .groupBy but gives you an immutable.HashMap[K, IndexedSeq[A]]
- def toMultiValuedMapUsingKeys[K](toKeys: (A) => IterableOnce[K]): HashMap[K, IndexedSeq[A]]
Like .groupBy but gives you an immutable.HashMap[K, IndexedSeq[A]]
- def toMultiValuedMapWithKeyTransform[K, V, K2](keyTransform: (K) => K2)(implicit ev: <:<[A, (K, V)]): HashMap[K2, Vector[V]]
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)
- def toMultiValuedMapWithTransforms[K, V, K2, V2](keyTransform: (K) => K2, valueTransform: (V) => V2)(implicit ev: <:<[A, (K, V)]): HashMap[K2, Vector[V2]]
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)
- def toMultiValuedURLNameMap[V](implicit ev: <:<[A, (String, V)]): HashMap[String, Vector[V]]
- def toSortedSet(implicit ord: Ordering[A]): SortedSet[A]
Like .toSet but returns a scala.collection.immutable.SortedSet instead
- def toString(): String
- Definition Classes
- Any
- def toUniqueHashMap[K, V](implicit ev: <:<[A, (K, V)]): HashMap[K, V]
Same as .toHashMap but ensures there are no duplicate keys
- def toUniqueHashMapUsing[K](f: (A) => K): HashMap[K, A]
Alias of uniqueGroupBy
- def toUniqueHashMapWithKeyTransform[K, V, K2](keyTransform: (K) => K2)(implicit ev: <:<[A, (K, V)]): HashMap[K2, V]
Same as toUniqueHashMap but allows you to specify a transform function for the key
- def toUniqueHashMapWithTransforms[K, V, K2, V2](keyTransform: (K) => K2, valueTransform: (V) => V2)(implicit ev: <:<[A, (K, V)]): HashMap[K2, V2]
Same as toUniqueHashMap but allows you to specify transform functions for the key and value
- def toUniqueHashSet: HashSet[A]
Like .toHashSet but makes sure there are no duplicates
- def toUniqueLowerAlphaNumericMap[V](implicit ev: <:<[A, (String, V)]): HashMap[String, V]
- def toUniqueMap[K, V](implicit ev: <:<[A, (K, V)]): HashMap[K, V]
Same as .toMap but ensures there are no duplicate keys
- def toUniqueSet: Set[A]
Like .toSet but makes sure there are no duplicates
- def toUniqueURLNameMap[V](implicit ev: <:<[A, (String, V)]): HashMap[String, V]
- def toVector: Vector[A]
Returns a Vector of this Iterable (if it's not already a Vector)
- def uniqueGroupBy[K](f: (A) => K): HashMap[K, A]
Like groupBy but only allows a single value per key