RE: Random access in ArrayDeque

2014-02-10 Thread Jason Mehrens
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

Re: Random access in ArrayDeque

2014-02-09 Thread Ivan Gerasimov
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

Re: Random access in ArrayDeque

2014-02-08 Thread Doug Lea
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

Re: Random access in ArrayDeque

2014-02-07 Thread David M. Lloyd
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

Re: Random access in ArrayDeque

2014-02-07 Thread David M. Lloyd
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.