Helpers and utilities for working with various collections from the Scala standard library.
"com.github.morgen-peschke" % "commons-collections" % commonsVersion
ivy"com.github.morgen-peschke::commons-collections:$commonsVersion"
Provides TraversibleLike#takeUntil
, which is alternative to TraversibleLike#takeWhile
.
The most useful distinction between the two is how the final value is handled.
assert((0 to 10).toList.takeWhile(_ != 5) == List(0, 1, 2, 3, 4))
assert((0 to 10).toList.takeUntil(_ == 5) == List(0, 1, 2, 3, 4, 5))
Provides utility methods for manipulating Range
and NumericRange
.
grow
:: This extends a range such that (ignoring underflow)range.grow(n).drop(n) == range
growRight
:: This extends a range such that (ignoring overflow)range.growRight(n).dropRight(n) == range
shift
:: This shifts a range towardsInt.MaxValue
by a multiple of the range stepunshift
:: This shifts a range towardsInt.MinValue
by a multiple of the range stepsliceRange
:: This specialization ofNumericRange#slice
returns aNumericRange
instead of anIndexedSeq