Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an empty method to each collection #28

Closed
julienrf opened this issue Jul 20, 2017 · 4 comments
Closed

Add an empty method to each collection #28

julienrf opened this issue Jul 20, 2017 · 4 comments

Comments

@julienrf
Copy link
Contributor

See scala/collection-strawman#145 (comment) and scala/scala3#2573 for motivation.

The following should be enough:

def empty: CC[A] = iterableFactory.empty[A]

Or maybe:

def empty: C = fromSpecificIterable(iterableFactory.empty[A])
@julienrf
Copy link
Contributor Author

julienrf commented Nov 6, 2017

Note that the changes proposed in scala/scala3#2573 (comment) not only require empty but also point (in case there is no subsequent generator).

@szeiger
Copy link

szeiger commented Jun 6, 2018

Let's see what Dotty does about this and maybe implement it in 2.14.

@SethTisue SethTisue transferred this issue from scala/collection-strawman Feb 20, 2019
@dwijnand dwijnand transferred this issue from scala/scala-dev Oct 29, 2020
@dwijnand
Copy link
Member

dwijnand commented Oct 29, 2020

Are there any collections that don't have an empty?

@NthPortal
Copy link
Contributor

NthPortal commented Oct 29, 2020

it's defined on IterableOps, so all collections have one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants