diff --git a/libraries-primitive/pom.xml b/libraries-primitive/pom.xml
index 12fc35c1b5..cddb3ab1fe 100644
--- a/libraries-primitive/pom.xml
+++ b/libraries-primitive/pom.xml
@@ -9,9 +9,14 @@
1.0-SNAPSHOT
libraries-primitive
+
+ 1.8
+ 1.8
+
+
-
-
+
+
it.unimi.dsi
fastutil
8.2.2
@@ -36,5 +41,18 @@
1.19
test
+
+
+ org.eclipse.collections
+ eclipse-collections-api
+ 10.0.0
+
+
+
+ org.eclipse.collections
+ eclipse-collections
+ 10.0.0
+
+
-
+
\ No newline at end of file
diff --git a/libraries-primitive/src/test/java/com/baeldung/PrimitiveCollectionsUnitTest.java b/libraries-primitive/src/test/java/com/baeldung/PrimitiveCollectionsUnitTest.java
new file mode 100644
index 0000000000..2adecd37fc
--- /dev/null
+++ b/libraries-primitive/src/test/java/com/baeldung/PrimitiveCollectionsUnitTest.java
@@ -0,0 +1,70 @@
+package com.baeldung;
+
+import org.eclipse.collections.api.list.primitive.ImmutableIntList;
+import org.eclipse.collections.api.list.primitive.MutableLongList;
+import org.eclipse.collections.api.map.primitive.MutableIntIntMap;
+import org.eclipse.collections.api.set.primitive.MutableIntSet;
+import org.eclipse.collections.impl.factory.primitive.*;
+import org.eclipse.collections.impl.list.Interval;
+import org.eclipse.collections.impl.list.primitive.IntInterval;
+import org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap;
+import org.junit.Test;
+
+import java.util.stream.DoubleStream;
+
+import static org.junit.Assert.assertEquals;
+
+
+public class PrimitiveCollectionsUnitTest {
+
+ @Test
+ public void whenListOfLongHasOneTwoThree_thenSumIsSix() {
+ MutableLongList longList = LongLists.mutable.of(1L, 2L, 3L);
+ assertEquals(6, longList.sum());
+ }
+
+ @Test
+ public void whenListOfIntHasOneTwoThree_thenMaxIsThree() {
+ ImmutableIntList intList = IntLists.immutable.of(1, 2, 3);
+ assertEquals(3, intList.max());
+ }
+
+ @Test
+ public void whenConvertFromIterableToPrimitive_thenValuesAreEquals() {
+ Iterable iterable = Interval.oneTo(3);
+ MutableIntSet intSet = IntSets.mutable.withAll(iterable);
+ IntInterval intInterval = IntInterval.oneTo(3);
+ assertEquals(intInterval.toSet(), intSet);
+ }
+
+ @Test
+ public void testOperationsOnIntIntMap() {
+ MutableIntIntMap map = new IntIntHashMap();
+ assertEquals(5, map.addToValue(0, 5));
+ assertEquals(5, map.get(0));
+ assertEquals(3, map.getIfAbsentPut(1, 3));
+ }
+
+ @Test
+ public void whenCreateDoubleStream_thenAverageIsThree() {
+ DoubleStream doubleStream = DoubleLists
+ .mutable.with(1.0, 2.0, 3.0, 4.0, 5.0)
+ .primitiveStream();
+ assertEquals(3, doubleStream.average().getAsDouble(), 0.001);
+ }
+
+ @Test
+ public void whenCreateMapFromStream_thenValuesMustMatch() {
+ Iterable integers = Interval.oneTo(3);
+ MutableIntIntMap map =
+ IntIntMaps.mutable.from(
+ integers,
+ key -> key,
+ value -> value * value);
+ MutableIntIntMap expected = IntIntMaps.mutable.empty()
+ .withKeyValue(1, 1)
+ .withKeyValue(2, 4)
+ .withKeyValue(3, 9);
+ assertEquals(expected, map);
+ }
+}
\ No newline at end of file