Source does not fit in dest at java.util.Collections.copy()

Normally we use Collections.copy(dest,src) to copies the elements of the source list into the destination list, overwriting its contents List<String> destList = new ArrayList<String>(10); Collections.copy(destList, srclist); But if program like this, it will throw an exception “Source does not fit in dest at java.util.Collections.copy()” This can be avoided by creating the destination list as follows […]