Re: Why doesn't ArrayDeque implement the List interface?




"Mike Schilling" <mscottschilling@xxxxxxxxxxx> wrote
No, the get method would be trivial to implement:

public T get(int i)
{
if ( i < 0 || i >= size)
throw new IllegalIndexException();
return members[(firstIndex + i) % size];
}

No, I was not refering to this access method but to a binary search method.

Even more trivial would be just to myDeque.getArray() and get the i-th
element.

regards,
Giovanni


.