src/share/classes/java/util/LinkedList.java

Print this page
rev 7572 : 8017141: java.util/stream Spliterators from sequential sources should not catch OOME
Reviewed-by:
Contributed-by: paul.sandoz@oracle.com

*** 1193,1208 **** int n = batch + BATCH_UNIT; if (n > s) n = s; if (n > MAX_BATCH) n = MAX_BATCH; ! Object[] a; ! try { ! a = new Object[n]; ! } catch (OutOfMemoryError oome) { ! return null; ! } int j = 0; do { a[j++] = p.item; } while ((p = p.next) != null && j < n); current = p; batch = j; est = s - j; --- 1193,1203 ---- int n = batch + BATCH_UNIT; if (n > s) n = s; if (n > MAX_BATCH) n = MAX_BATCH; ! Object[] a = new Object[n]; int j = 0; do { a[j++] = p.item; } while ((p = p.next) != null && j < n); current = p; batch = j; est = s - j;