diff --git a/core-java-8/src/main/java/com/baeldung/streamApi/Product.java b/core-java-8/src/main/java/com/baeldung/stream/Product.java similarity index 96% rename from core-java-8/src/main/java/com/baeldung/streamApi/Product.java rename to core-java-8/src/main/java/com/baeldung/stream/Product.java index 1b7478551f..e99a969b81 100644 --- a/core-java-8/src/main/java/com/baeldung/streamApi/Product.java +++ b/core-java-8/src/main/java/com/baeldung/stream/Product.java @@ -1,4 +1,4 @@ -package com.baeldung.streamApi; +package com.baeldung.stream; import java.util.List; import java.util.stream.Stream; diff --git a/core-java-8/src/main/java/com/baeldung/stream/StreamApi.java b/core-java-8/src/main/java/com/baeldung/stream/StreamApi.java index 364fdeffbb..f0d5f1aa7e 100644 --- a/core-java-8/src/main/java/com/baeldung/stream/StreamApi.java +++ b/core-java-8/src/main/java/com/baeldung/stream/StreamApi.java @@ -16,7 +16,7 @@ public class StreamApi { } public static String getLastElementUsingSkip(List valueList) { - long count = valueList.stream().count(); + long count = (long) valueList.size(); Stream stream = valueList.stream(); return stream.skip(count - 1).findFirst().orElse(null); } diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java index 73a10a57f4..5005cf7f47 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java @@ -1,6 +1,6 @@ package com.baeldung.java8; -import com.baeldung.streamApi.Product; +import com.baeldung.stream.Product; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; diff --git a/core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java b/core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java index c28d6300e0..2c88dc5ec7 100644 --- a/core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java @@ -6,6 +6,7 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; +import java.util.stream.Stream; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -65,7 +66,9 @@ public class PrimitiveStreamsUnitTest { @Test public void givenAnArrayWhenSumIsCalledThenTheCorrectSumIsReturned() { - int sum = Arrays.asList(33,45).stream().mapToInt(a -> a).sum(); + int sum = Stream.of(33,45) + .mapToInt(i -> i) + .sum(); assertEquals(78, sum); }