What would happen from a call like
someList.addAll( Integer.MAX_VALUE, someCollection );
where someList contains at least Integer.MAX_VALUE elements and someCollection
is not empty?
According to
<http://java.sun.com/javase/6/docs/api/java/util/List.html#add(int,%20E)>
void add(int index, E element)
Inserts the specified element at the specified position in this list (optional operation).
and throws
IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size())
Suppose we have a List 'someList' containing exactly Integer.MAX_VALUE
elements and we
someList.add( element );
or
someList.add( Integer.MAX_VALUE, element );
According to the Javadocs, this is legal, but how then could we reference the
last element of the list?
(Presumably we're facing an OOME before these are testable problems in today's
JVMs.)
--
Lew
what happens. I suspect that the original implementors thought "2