(int index)
| 397 | } |
| 398 | |
| 399 | private T get(int index) { |
| 400 | while (cache.size() <= index) { |
| 401 | if (source.hasNext()) { |
| 402 | cache.add(source.next()); |
| 403 | } else { |
| 404 | return null; |
| 405 | } |
| 406 | } |
| 407 | return cache.get(index); |
| 408 | } |
| 409 | |
| 410 | private int size() { |
| 411 | if (source.hasNext()) return Integer.MAX_VALUE; |