Merge pull request #8042 from catalin-burcea/BAEL-16644

[BAEL-16644] Split or move java-collections-conversions module
This commit is contained in:
Josh Cummings
2019-10-26 10:33:39 -06:00
committed by GitHub
11 changed files with 70 additions and 16 deletions

View File

@@ -0,0 +1,7 @@
## Java Collections Cookbooks and Examples
This module contains articles about conversions among Collection types and arrays in Java.
### Relevant Articles:
- [Array to String Conversions](https://www.baeldung.com/java-array-to-string)
- More articles: [[<-- prev]](../java-collections-conversions)

View File

@@ -0,0 +1,36 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>java-collections-conversions-2</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>java-collections-conversions-2</name>
<packaging>jar</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-java</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
</dependencies>
<build>
<finalName>java-collections-conversions-2</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
</properties>
</project>

View File

@@ -1,15 +1,14 @@
package org.baeldung.convertarraytostring; package com.baeldung.convertarraytostring;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;

View File

@@ -9,8 +9,8 @@ This module contains articles about conversions among Collection types and array
- [Convert a Map to an Array, List or Set in Java](https://www.baeldung.com/convert-map-values-to-array-list-set) - [Convert a Map to an Array, List or Set in Java](https://www.baeldung.com/convert-map-values-to-array-list-set)
- [Converting a List to String in Java](https://www.baeldung.com/java-list-to-string) - [Converting a List to String in Java](https://www.baeldung.com/java-list-to-string)
- [How to Convert List to Map in Java](https://www.baeldung.com/java-list-to-map) - [How to Convert List to Map in Java](https://www.baeldung.com/java-list-to-map)
- [Array to String Conversions](https://www.baeldung.com/java-array-to-string)
- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) - [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist)
- [Java 8 Collectors toMap](https://www.baeldung.com/java-collectors-tomap) - [Java 8 Collectors toMap](https://www.baeldung.com/java-collectors-tomap)
- [Converting Iterable to Collection in Java](https://www.baeldung.com/java-iterable-to-collection) - [Converting Iterable to Collection in Java](https://www.baeldung.com/java-iterable-to-collection)
- [Converting Iterator to List](https://www.baeldung.com/java-convert-iterator-to-list) - [Converting Iterator to List](https://www.baeldung.com/java-convert-iterator-to-list)
- More articles: [[next -->]](../java-collections-conversions-2)

View File

@@ -32,6 +32,16 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<finalName>java-collections-conversions-2</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties> <properties>
<commons-collections4.version>4.1</commons-collections4.version> <commons-collections4.version>4.1</commons-collections4.version>
<assertj.version>3.6.1</assertj.version> <assertj.version>3.6.1</assertj.version>

View File

@@ -14,10 +14,10 @@ import static org.junit.Assert.*;
* *
* @author chris * @author chris
*/ */
public class FooUnitTest { public class CollectionToArrayListUnitTest {
private static Collection<Foo> srcCollection = new HashSet<>(); private static Collection<Foo> srcCollection = new HashSet<>();
public FooUnitTest() { public CollectionToArrayListUnitTest() {
} }
@BeforeClass @BeforeClass

View File

@@ -1,4 +1,4 @@
package com.baeldung.convert.iteratortolist; package com.baeldung.convertiteratortolist;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.hamcrest.collection.IsCollectionWithSize.hasSize;

View File

@@ -11,7 +11,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
public class ConvertListWithDiplicatedIdToMapServiceUnitTest { public class ConvertListWithDuplicatedIdToMapServiceUnitTest {
List<Animal> duplicatedIdList; List<Animal> duplicatedIdList;
private ConvertListToMapService convertListService = new ConvertListToMapService(); private ConvertListToMapService convertListService = new ConvertListToMapService();

View File

@@ -1,4 +1,4 @@
package org.baeldung.java.collections; package com.baeldung.java.collections;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@@ -1,4 +1,4 @@
package org.baeldung.java.lists; package com.baeldung.java.lists;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -7,7 +7,7 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.Test; import org.junit.Test;
public class ListToSTring { public class ListToStringUnitTest {
@Test @Test
public void whenListToString_thenPrintDefault() { public void whenListToString_thenPrintDefault() {

View File

@@ -482,6 +482,7 @@
<module>jackson-2</module> <module>jackson-2</module>
<module>jackson-simple</module> <module>jackson-simple</module>
<module>java-collections-conversions</module> <module>java-collections-conversions</module>
<module>java-collections-conversions-2</module>
<module>java-collections-maps</module> <module>java-collections-maps</module>
<module>java-collections-maps-2</module> <module>java-collections-maps-2</module>
<module>java-jdi</module> <module>java-jdi</module>
@@ -1241,6 +1242,7 @@
<module>jackson-2</module> <module>jackson-2</module>
<module>jackson-simple</module> <module>jackson-simple</module>
<module>java-collections-conversions</module> <module>java-collections-conversions</module>
<module>java-collections-conversions-2</module>
<module>java-collections-maps</module> <module>java-collections-maps</module>
<module>java-collections-maps-2</module> <module>java-collections-maps-2</module>
<module>java-jdi</module> <module>java-jdi</module>