Too bad there is no interface with only get(index), set(index, x),
and indexOf(x). Implementing only these would probably satisfy
all candidate usages.
With default methods can't we modify the RandomAccess marker interface with
hostile implementations?
Jason
Wouldn't it be convenient, if negative indices were allowed for the
get() method here?
So that get(-1) would return the last element, like in some other
languages such as Perl or Python.
I understand it violates the spec for the List#get(), but this is the
'Double Ended' queue, so we may
On 02/07/2014 01:59 PM, Martin Buchholz wrote:
ArrayDeque should implement most of the methods in List, notably get(i).
ArrayDeque should not actually implement List itself, because the change in
contract/behavior for hashCode/equals would be too great.
Right. My vague recollection is that
Just want to say that we've also had the need to implement an
array-backed Deque+List; we found no surprises implementing it and thus
I believe that extending ArrayDeque to implement List would be a
positive change. Failing that, a combined ArrayListAndDeque class seems
like a good idea.
I
On 02/07/2014 12:59 PM, Martin Buchholz wrote:
Sorry we're all such lamers.
??
ArrayDeque should implement most of the methods in List, notably get(i).
ArrayDeque should not actually implement List itself, because the change
in contract/behavior for hashCode/equals would be too great.