From 8ab6e4ad440423ccd6c55c9bdef5b9fc758afe14 Mon Sep 17 00:00:00 2001 From: Vishal Date: Sat, 7 Nov 2020 12:19:25 +0530 Subject: [PATCH] BAEL-4236 | delete duplicate class IndexOutOfBoundsException.java --- .../exception/IndexOutOfBoundsException.java | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/IndexOutOfBoundsException.java diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/IndexOutOfBoundsException.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/IndexOutOfBoundsException.java deleted file mode 100644 index a1b6bf1151..0000000000 --- a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/IndexOutOfBoundsException.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.exception; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * This example produces an IndexOutOfBoundsException, when we try to copy a list using the Collections.copy method. - * As the destination list doesn't have enough space/size to copy elements from source list. - */ -public class IndexOutOfBoundsException { - - static List copyList(List source) { - List destination = new ArrayList<>(source.size()); - Collections.copy(destination, source); - return destination; - } - - public static void main(String[] args) { - List source = Arrays.asList(1, 2, 3, 4, 5); - List copy = copyList(source); - - System.out.println("copy = " + copy); - } - -}