Copy list to another list examples (#4725)
This commit is contained in:
committed by
maibin
parent
61e6d9a3cd
commit
f68615d772
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user