diff --git a/core-java-8/src/test/java/com/baeldung/RandomListElementTest.java b/core-java-8/src/test/java/com/baeldung/RandomListElementTest.java index 85aaddbca8..540a8c0af9 100644 --- a/core-java-8/src/test/java/com/baeldung/RandomListElementTest.java +++ b/core-java-8/src/test/java/com/baeldung/RandomListElementTest.java @@ -2,10 +2,7 @@ package com.baeldung; import org.junit.Test; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Random; +import java.util.*; import java.util.concurrent.ThreadLocalRandom; public class RandomListElementTest { @@ -41,7 +38,7 @@ public class RandomListElementTest { @Test public void givenList_whenNumberElementsChosen_shouldReturnRandomElementsNoRepeat() { Random rand = new Random(); - List givenList = Arrays.asList("one", "two", "three", "four"); + List givenList = new LinkedList<>(Arrays.asList("one", "two", "three", "four")); int numberOfElements = 2;