Skip to content

add non-empty collection variants #274

Open
@scarf005

Description

@scarf005

motivation:

it'd be nice to centralize nonempty collections into de-facto stdlib.

example usage:

scala> List().head
java.util.NoSuchElementException: head of empty list
  at scala.collection.immutable.Nil$.head(List.scala:663)
  at scala.collection.immutable.Nil$.head(List.scala:662)
  ... 30 elided
                                                                                                                                                                                                                                        scala> List().headOption
val res1: Option[Nothing] = None

scala> NonEmptyList(1).head
1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions