1178 else {
1179 expectedModCount = lst.modCount;
1180 current = lst.first;
1181 s = est = lst.size;
1182 }
1183 }
1184 return s;
1185 }
1186
1187 public long estimateSize() { return (long) getEst(); }
1188
1189 public Spliterator<E> trySplit() {
1190 Node<E> p;
1191 int s = getEst();
1192 if (s > 1 && (p = current) != null) {
1193 int n = batch + BATCH_UNIT;
1194 if (n > s)
1195 n = s;
1196 if (n > MAX_BATCH)
1197 n = MAX_BATCH;
1198 Object[] a;
1199 try {
1200 a = new Object[n];
1201 } catch (OutOfMemoryError oome) {
1202 return null;
1203 }
1204 int j = 0;
1205 do { a[j++] = p.item; } while ((p = p.next) != null && j < n);
1206 current = p;
1207 batch = j;
1208 est = s - j;
1209 return Spliterators.spliterator(a, 0, j, Spliterator.ORDERED);
1210 }
1211 return null;
1212 }
1213
1214 public void forEachRemaining(Consumer<? super E> action) {
1215 Node<E> p; int n;
1216 if (action == null) throw new NullPointerException();
1217 if ((n = getEst()) > 0 && (p = current) != null) {
1218 current = null;
1219 est = 0;
1220 do {
1221 E e = p.item;
1222 p = p.next;
1223 action.accept(e);
|
1178 else {
1179 expectedModCount = lst.modCount;
1180 current = lst.first;
1181 s = est = lst.size;
1182 }
1183 }
1184 return s;
1185 }
1186
1187 public long estimateSize() { return (long) getEst(); }
1188
1189 public Spliterator<E> trySplit() {
1190 Node<E> p;
1191 int s = getEst();
1192 if (s > 1 && (p = current) != null) {
1193 int n = batch + BATCH_UNIT;
1194 if (n > s)
1195 n = s;
1196 if (n > MAX_BATCH)
1197 n = MAX_BATCH;
1198 Object[] a = new Object[n];
1199 int j = 0;
1200 do { a[j++] = p.item; } while ((p = p.next) != null && j < n);
1201 current = p;
1202 batch = j;
1203 est = s - j;
1204 return Spliterators.spliterator(a, 0, j, Spliterator.ORDERED);
1205 }
1206 return null;
1207 }
1208
1209 public void forEachRemaining(Consumer<? super E> action) {
1210 Node<E> p; int n;
1211 if (action == null) throw new NullPointerException();
1212 if ((n = getEst()) > 0 && (p = current) != null) {
1213 current = null;
1214 est = 0;
1215 do {
1216 E e = p.item;
1217 p = p.next;
1218 action.accept(e);
|