Split or move java-collections-maps module (#7802)
This commit is contained in:
parent
ee9f90ab2f
commit
f4b4a9eea5
|
@ -1,3 +1,11 @@
|
|||
## Relevant Articles:
|
||||
- [Map of Primitives in Java](https://www.baeldung.com/java-map-primitives)
|
||||
- [Copying a HashMap in Java](https://www.baeldung.com/java-copy-hashmap)
|
||||
- [Guide to WeakHashMap in Java](https://www.baeldung.com/java-weakhashmap)
|
||||
- [Map to String Conversion in Java](https://www.baeldung.com/java-map-to-string-conversion)
|
||||
- [Iterate over a Map in Java](https://www.baeldung.com/java-iterate-map)
|
||||
- [Merging Two Maps with Java 8](https://www.baeldung.com/java-merge-maps)
|
||||
- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort)
|
||||
- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max)
|
||||
- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
|
||||
- [Java TreeMap vs HashMap](https://www.baeldung.com/java-treemap-vs-hashmap)
|
||||
|
|
|
@ -41,6 +41,22 @@
|
|||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>${commons-collections4.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>one.util</groupId>
|
||||
<artifactId>streamex</artifactId>
|
||||
<version>${streamex.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<version>${avaitility.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
|
@ -50,6 +66,9 @@
|
|||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<streamex.version>0.6.5</streamex.version>
|
||||
<commons-collections4.version>4.1</commons-collections4.version>
|
||||
<avaitility.version>1.7.0</avaitility.version>
|
||||
<eclipse-collections.version>8.2.0</eclipse-collections.version>
|
||||
<trove4j.version>3.0.2</trove4j.version>
|
||||
<fastutil.version>8.1.0</fastutil.version>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.convert;
|
||||
package com.baeldung.map.convert;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import org.apache.commons.lang3.StringUtils;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.convert;
|
||||
package com.baeldung.map.convert;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
package com.baeldung.map;
|
||||
package com.baeldung.map.copyhashmap;
|
||||
|
||||
import org.apache.commons.lang3.SerializationUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -6,8 +8,6 @@ import java.util.Map.Entry;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.SerializationUtils;
|
||||
|
||||
public class CopyHashMap {
|
||||
|
||||
public static <String, Employee> HashMap<String, Employee> copyUsingConstructor(HashMap<String, Employee> originalMap) {
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.map.initialize;
|
||||
package com.baeldung.map.initialize;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Collections;
|
|
@ -1,11 +1,7 @@
|
|||
package com.baeldung.map.util;
|
||||
package com.baeldung.map.mapmax;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
|
||||
public class MapMax {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.sort;
|
||||
package com.baeldung.map.mergemaps;
|
||||
|
||||
public class Employee implements Comparable<Employee> {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.baeldung.map.java_8;
|
||||
package com.baeldung.map.mergemaps;
|
||||
|
||||
import com.baeldung.sort.Employee;
|
||||
import one.util.streamex.EntryStream;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.map;
|
||||
package com.baeldung.map.primitives;
|
||||
|
||||
import cern.colt.map.AbstractIntDoubleMap;
|
||||
import cern.colt.map.OpenIntDoubleHashMap;
|
|
@ -1,8 +1,8 @@
|
|||
package com.baeldung.sort;
|
||||
package com.baeldung.map.sort;
|
||||
|
||||
import com.baeldung.map.mergemaps.Employee;
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Ordering;
|
||||
|
||||
import java.util.*;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.convert;
|
||||
package com.baeldung.map.convert;
|
||||
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.junit.Assert;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.convert;
|
||||
package com.baeldung.map.convert;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.jupiter.api.Test;
|
|
@ -1,13 +1,12 @@
|
|||
package com.baeldung.map;
|
||||
package com.baeldung.map.copyhashmap;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class CopyHashMapUnitTest {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.map;
|
||||
package com.baeldung.map.copyhashmap;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package com.baeldung.java.map.initialize;
|
||||
package com.baeldung.map.initialize;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class MapInitializerUnitTest {
|
||||
|
|
@ -1,14 +1,13 @@
|
|||
package com.baeldung.map.util;
|
||||
package com.baeldung.map.mapmax;
|
||||
|
||||
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class MapMaxUnitTest {
|
||||
|
|
@ -1,16 +1,14 @@
|
|||
package com.baeldung.collection;
|
||||
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
package com.baeldung.map.treemaphashmap;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class WhenComparingTreeMapVsHashMap {
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class TreeMapVsHashMapUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenInsertObjectsTreeMap_thenNaturalOrder() {
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.weakhashmap;
|
||||
package com.baeldung.map.weakhashmap;
|
||||
|
||||
|
||||
import org.junit.Test;
|
|
@ -3,21 +3,13 @@
|
|||
## Java Collections Cookbooks and Examples
|
||||
|
||||
### Relevant Articles:
|
||||
- [Guide to WeakHashMap in Java](http://www.baeldung.com/java-weakhashmap)
|
||||
- [Guide to the Guava BiMap](http://www.baeldung.com/guava-bimap)
|
||||
- [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap)
|
||||
- [A Guide to LinkedHashMap in Java](http://www.baeldung.com/java-linked-hashmap)
|
||||
- [A Guide to TreeMap in Java](http://www.baeldung.com/java-treemap)
|
||||
- [Iterate over a Map in Java](http://www.baeldung.com/java-iterate-map)
|
||||
- [Java TreeMap vs HashMap](http://www.baeldung.com/java-treemap-vs-hashmap)
|
||||
- [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys)
|
||||
- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
|
||||
- [Guide to the Guava BiMap](https://www.baeldung.com/guava-bimap)
|
||||
- [The Java HashMap Under the Hood](https://www.baeldung.com/java-hashmap)
|
||||
- [A Guide to LinkedHashMap in Java](https://www.baeldung.com/java-linked-hashmap)
|
||||
- [A Guide to TreeMap in Java](https://www.baeldung.com/java-treemap)
|
||||
- [How to Store Duplicate Keys in a Map in Java?](https://www.baeldung.com/java-map-duplicate-keys)
|
||||
- [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value)
|
||||
- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort)
|
||||
- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max)
|
||||
- [Merging Two Maps with Java 8](https://www.baeldung.com/java-merge-maps)
|
||||
- [How to Check If a Key Exists in a Map](https://www.baeldung.com/java-map-key-exists)
|
||||
- [Comparing Two HashMaps in Java](https://www.baeldung.com/java-compare-hashmaps)
|
||||
- [Immutable Map Implementations in Java](https://www.baeldung.com/java-immutable-maps)
|
||||
- [Map to String Conversion in Java](https://www.baeldung.com/java-map-to-string-conversion)
|
||||
- [Guide to Apache Commons MultiValuedMap](https://www.baeldung.com/apache-commons-multi-valued-map)
|
||||
|
|
|
@ -36,11 +36,6 @@
|
|||
<version>${assertj.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>one.util</groupId>
|
||||
<artifactId>streamex</artifactId>
|
||||
<version>${streamex.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
@ -49,6 +44,5 @@
|
|||
<avaitility.version>1.7.0</avaitility.version>
|
||||
<assertj.version>3.6.1</assertj.version>
|
||||
<eclipse.collections.version>7.1.0</eclipse.collections.version>
|
||||
<streamex.version>0.6.5</streamex.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.baeldung.java.map;
|
||||
package com.baeldung.map;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.map;
|
||||
package com.baeldung.map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.map;
|
||||
package com.baeldung.map;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
|
@ -1,16 +1,13 @@
|
|||
package com.baeldung.java.map;
|
||||
package com.baeldung.map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
|
||||
public class ImmutableMapUnitTest {
|
|
@ -1,13 +1,11 @@
|
|||
package com.baeldung.java.map;
|
||||
package com.baeldung.map;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class KeyCheckUnitTest {
|
||||
|
|
@ -1,13 +1,9 @@
|
|||
package com.baeldung.java.map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
package com.baeldung.map;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.LinkedHashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.TreeMultimap;
|
||||
import org.apache.commons.collections4.MultiMap;
|
||||
import org.apache.commons.collections4.MultiMapUtils;
|
||||
import org.apache.commons.collections4.MultiValuedMap;
|
||||
|
@ -18,10 +14,9 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.LinkedHashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.TreeMultimap;
|
||||
import java.util.*;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class MapMultipleValuesUnitTest {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MapMultipleValuesUnitTest.class);
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.map;
|
||||
package com.baeldung.map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
|
@ -1,9 +1,12 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.baeldung.java.map;
|
||||
package com.baeldung.map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import org.apache.commons.collections4.BidiMap;
|
||||
import org.apache.commons.collections4.bidimap.DualHashBidiMap;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -11,11 +14,7 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.collections4.BidiMap;
|
||||
import org.apache.commons.collections4.bidimap.DualHashBidiMap;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author swpraman
|
|
@ -1,15 +1,4 @@
|
|||
package com.baeldung.java.map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
package com.baeldung.map;
|
||||
|
||||
import org.apache.commons.collections4.MultiMapUtils;
|
||||
import org.apache.commons.collections4.MultiSet;
|
||||
|
@ -18,6 +7,17 @@ import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
|
|||
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
public class MultiValuedMapUnitTest {
|
||||
|
||||
@Test
|
|
@ -1,24 +1,21 @@
|
|||
package com.baeldung.java.map.compare;
|
||||
package com.baeldung.map.compare;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.collection.IsMapContaining.hasEntry;
|
||||
import static org.hamcrest.collection.IsMapContaining.hasKey;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import com.google.common.base.Equivalence;
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.collect.MapDifference.ValueDifference;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.base.Equivalence;
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.collect.MapDifference.ValueDifference;
|
||||
import com.google.common.collect.Maps;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.collection.IsMapContaining.hasEntry;
|
||||
import static org.hamcrest.collection.IsMapContaining.hasKey;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HashMapComparisonUnitTest {
|
||||
|
Loading…
Reference in New Issue