Utils
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Utils.type
Members list
Extensions
Extensions
Transforms a list of Either values into a single Either containing a list of successful values or the first encountered error.
Transforms a list of Either values into a single Either containing a list of successful values or the first encountered error.
Attributes
- Returns
-
an
Eithercontaining:Right(List[A])if all elements in the list areRightLeft(E)if at least one element in the list isLeft, with the first error encountered.
Applies a function to the value inside an Option, propagating errors using Either.
Applies a function to the value inside an Option, propagating errors using Either.
Value parameters
- f
-
the function to be applied to the value inside the Option, producing an Either result.
Attributes
- Returns
-
either an error of type E or an Option containing the transformed value of type B.
Convert to a Map where key is the element and value is a function applied to it
Convert to a Map where key is the element and value is a function applied to it
Value parameters
- f
-
the function transforming each element
Attributes
- Returns
-
a
Mapmapping each element to its transformation. - Example
-
List(1, 2).associate(_ + 1) // Map(1 -> 2, 2 -> 3)
Creates a Map where each key is the result of applying a function to the elements of the sequence and the corresponding value is the original element.
Creates a Map where each key is the result of applying a function to the elements of the sequence and the corresponding value is the original element.
Value parameters
- f
-
the function used to transform each element to a key in the resulting
Map.
Attributes
- Returns
-
a
Mapwhere keys are the transformed elements and values are the original elements.