- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Deprecations in Iterable
Sat, 2009-01-17, 14:53
scala.Iterable deprecates take with the reason that it does not make
sense for an unordered collection, but does not deprecate takeWhile.
I think this is exactly backwards: take is perfectly useful ("just give
me n arbitrary elements from the collection, I don't care which"), while
takeWhile is useless ("give me an arbitrary number of elements
satisfying the predicate, maybe all, maybe none, I don't care").
And what is the non-deprecated way of getting the first n elements of a
SortedMap? Is it even guaranteed that the methods SortedMap inherits
from Iterable process elements in order of the keys?
- Florian.
Sun, 2009-01-18, 11:27
#2
Re: Deprecations in Iterable
On Sat, Jan 17, 2009 at 2:52 PM, Florian Hars wrote:
> scala.Iterable deprecates take with the reason that it does not make sense
> for an unordered collection, but does not deprecate takeWhile.
> I think this is exactly backwards: take is perfectly useful ("just give me n
> arbitrary elements from the collection, I don't care which"), while
> takeWhile is useless ("give me an arbitrary number of elements satisfying
> the predicate, maybe all, maybe none, I don't care").
>
I totally agree. Take will be undeprecated in 2.8 and takeWhile will
move to OrderedIterable.
Cheers
On Sat, Jan 17, 2009 at 9:52 PM, Florian Hars <hars@bik-gmbh.de> wrote: