[External] : Re: ReversibleCollection proposal
Peter Levart
peter.levart at gmail.com
Sat May 1 14:36:13 UTC 2021
On 4/30/21 9:25 PM, Stuart Marks wrote:
> So I think we're stuck with void-returning add{First,Last} methods.
Have you thought of perhaps not adding them at all?
Collection.add() for:
List(s) - behaves the same as addLast()
LinkedHashSet - behaves the same as addLast()
Deque - behaves the same as addLast()
So for all ReversibleCollection(s) where it works, addLast() would be
equivalent to add()
addFirst(x) can be written as: reversed().add(x) if reversed() is
specified to return a reversed view over the underlying
ReversibleCollection.
Peter
More information about the core-libs-dev
mailing list