I was looking through the java source code, ArrayList.java->hugeCapacity, when I found something I'd never seen before:
private static int hugeCapacity(int minCapacity) {
if (minCapacity < 0) // overflow
throw new OutOfMemoryError();
return (minCapacity > MAX_ARRAY_SIZE) ?
Integer.MAX_VALUE :
MAX_ARRAY_SIZE;
}
I looked on this site before posting this question and found nothing helpful. I also looked at the docs for return()
, but I had no success. Perhaps I'm looking for the wrong thing.
Anyways, what is that return statement doing?