| 1526 | /// when replacing an element in the destination list is not |
| 1527 | /// supported. |
| 1528 | public static <T> void copy(List<? super T> destination, |
| 1529 | List<? extends T> source) { |
| 1530 | if (destination.size() < source.size()) { |
| 1531 | // luni.38=Source size {0} does not fit into destination |
| 1532 | throw new IndexOutOfBoundsException("" + source.size() + " out of: " + destination.size()); |
| 1533 | } |
| 1534 | Iterator<? extends T> srcIt = source.iterator(); |
| 1535 | ListIterator<? super T> destIt = destination.listIterator(); |
| 1536 | while (srcIt.hasNext()) { |
| 1537 | try { |
| 1538 | destIt.next(); |
| 1539 | } catch (NoSuchElementException e) { |
| 1540 | // luni.38=Source size {0} does not fit into destination |
| 1541 | throw new IndexOutOfBoundsException("" + source.size()); |
| 1542 | } |
| 1543 | destIt.set(srcIt.next()); |
| 1544 | } |
| 1545 | } |
| 1546 | |
| 1547 | /// Returns an `Enumeration` on the specified collection. |
| 1548 | /// |