Copy list to another list examples (#4725)

This commit is contained in:
Felipe Santiago Corro
2018-07-16 03:41:08 -03:00
committed by maibin
parent 61e6d9a3cd
commit f68615d772
4 changed files with 244 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package com.baeldung.java10.list;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
public class CopyListServiceUnitTest {
@Test(expected = UnsupportedOperationException.class)
public void whenModifyCopyOfList_thenThrowsException() {
List<Integer> copyList = List.copyOf(Arrays.asList(1, 2, 3, 4));
}
}