Skip to content

Idea: Add a single method to all collections' companion object #42

Open
@BalmungSan

Description

@BalmungSan

IMHO it is pretty common to wanting to create a collection of a single element. Whereas you can always use the apply that accepts a varargs, I personally would prefer to call a single method on the companion object of the collection I want.

My arguments are:

  1. I find such method to better show the intent.
  2. Such a method could be more efficient, especially because one would avoid the intermediate Seq that is allocated for the varargs.
  3. Iterator already has single.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlibrary:collectionsstatus:pendingThis enhancement request lacks consensus on whether or not to include it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions