MCPcopy Create free account
hub / github.com/davidgiven/luje / copy

Method copy

lib/java/util/Collections.java:1591–1608  ·  view source on GitHub ↗

Copies the elements from the source list to the destination list. At the end both lists will have the same objects at the same index. If the destination array is larger than the source list, the elements in the destination list with index >= source.size() will be unchanged. @param destinati

(List<? super T> destination,
            List<? extends T> source)

Source from the content-addressed store, hash-verified

1589 * supported.
1590 */
1591 public static <T> void copy(List<? super T> destination,
1592 List<? extends T> source) {
1593 if (destination.size() < source.size()) {
1594 // luni.38=Source size {0} does not fit into destination
1595 throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.38", source.size())); //$NON-NLS-1$
1596 }
1597 Iterator<? extends T> srcIt = source.iterator();
1598 ListIterator<? super T> destIt = destination.listIterator();
1599 while (srcIt.hasNext()) {
1600 try {
1601 destIt.next();
1602 } catch (NoSuchElementException e) {
1603 // luni.38=Source size {0} does not fit into destination
1604 throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.38", source.size())); //$NON-NLS-1$
1605 }
1606 destIt.set(srcIt.next());
1607 }
1608 }
1609
1610 /**
1611 * Returns an {@code Enumeration} on the specified collection.

Callers

nothing calls this directly

Calls 7

getStringMethod · 0.95
sizeMethod · 0.65
iteratorMethod · 0.65
listIteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected