final class ListOps[A] extends AnyVal
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- ListOps
- AnyVal
- Any
- Hide All
- Show All
Visibility
- Public
- All
Instance Constructors
- new ListOps(la: List[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
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
def
groupByNel[B](f: (A) ⇒ B)(implicit B: Order[B]): SortedMap[B, NonEmptyList[A]]
Groups elements inside this
List
according to theOrder
of the keys produced by the given mapping function.Groups elements inside this
List
according to theOrder
of the keys produced by the given mapping function.scala> import cats.data.NonEmptyList scala> import scala.collection.immutable.SortedMap scala> import cats.implicits._ scala> val list = List(12, -2, 3, -5) scala> list.groupByNel(_ >= 0) res0: SortedMap[Boolean, NonEmptyList[Int]] = Map(false -> NonEmptyList(-2, -5), true -> NonEmptyList(12, 3))
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
toNel: Option[NonEmptyList[A]]
Returns an Option of NonEmptyList from a List
Returns an Option of NonEmptyList from a List
Example:
scala> import cats.data.NonEmptyList scala> import cats.implicits._ scala> val result1: List[Int] = List(1, 2) scala> result1.toNel res0: Option[NonEmptyList[Int]] = Some(NonEmptyList(1, 2)) scala> val result2: List[Int] = List.empty[Int] scala> result2.toNel res1: Option[NonEmptyList[Int]] = None
-
def
toString(): String
- Definition Classes
- Any