Dependency clash resolved (#2235)
This commit is contained in:
parent
9ad123a655
commit
fe2d2a6604
|
@ -4,8 +4,7 @@
|
|||
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>
|
||||
|
||||
<groupId>com.baeldung.guava</groupId>
|
||||
<artifactId>tutorial</artifactId>
|
||||
<artifactId>guava21</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
|
@ -15,12 +14,17 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>21.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jool</artifactId>
|
||||
<version>0.9.12</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.zip;
|
||||
package com.baeldung.guava.zip;
|
||||
|
||||
import com.google.common.collect.Streams;
|
||||
import org.jooq.lambda.Seq;
|
||||
|
@ -15,9 +15,9 @@ import static org.junit.Assert.assertEquals;
|
|||
|
||||
public class ZipCollectionTest {
|
||||
|
||||
List<String> names;
|
||||
List<Integer> ages;
|
||||
List<String> expectedOutput;
|
||||
private List<String> names;
|
||||
private List<Integer> ages;
|
||||
private List<String> expectedOutput;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
|
@ -1,3 +1,5 @@
|
|||
package com.baeldung.guava.tutorial;
|
||||
|
||||
import com.google.common.util.concurrent.AtomicLongMap;
|
||||
import org.junit.Test;
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
package com.baeldung.guava.tutorial;
|
||||
|
||||
import com.google.common.collect.Comparators;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
|
@ -1,3 +1,5 @@
|
|||
package com.baeldung.guava.tutorial;
|
||||
|
||||
import com.google.common.collect.Streams;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
|
@ -1,3 +1,5 @@
|
|||
package com.baeldung.guava.tutorial;
|
||||
|
||||
import com.google.common.collect.Interner;
|
||||
import com.google.common.collect.Interners;
|
||||
import org.junit.Assert;
|
|
@ -1,3 +1,5 @@
|
|||
package com.baeldung.guava.tutorial;
|
||||
|
||||
import com.google.common.util.concurrent.Monitor;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
|
@ -1,3 +1,5 @@
|
|||
package com.baeldung.guava.tutorial;
|
||||
|
||||
import com.google.common.collect.MoreCollectors;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
|
@ -1,3 +1,5 @@
|
|||
package com.baeldung.guava.tutorial;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.Iterator;
|
|
@ -349,12 +349,6 @@
|
|||
<artifactId>java-lsh</artifactId>
|
||||
<version>${java-lsh.version}</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>21.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>au.com.dius</groupId>
|
||||
<artifactId>pact-jvm-consumer-junit_2.11</artifactId>
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package com.baeldung.zip;
|
||||
|
||||
import com.google.common.collect.Streams;
|
||||
import org.jooq.lambda.Seq;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class ZipCollectionExample {
|
||||
static List<String> names = Arrays.asList("John", "Jane", "Jack", "Dennis");
|
||||
|
||||
static List<Integer> ages = Arrays.asList(24, 25, 27);
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Using Streams API from Guava 21
|
||||
Streams
|
||||
.zip(names.stream(), ages.stream(), (name, age) -> name + ":" + age)
|
||||
.forEach(System.out::println);
|
||||
|
||||
// Using native Java 8 Int Stream
|
||||
IntStream
|
||||
.range(0, Math.min(names.size(), ages.size()))
|
||||
.mapToObj(i -> names.get(i) + ":" + ages.get(i))
|
||||
.forEach(System.out::println);
|
||||
|
||||
// Using jOOL
|
||||
Seq
|
||||
.of("John", "Jane", "Dennis")
|
||||
.zip(Seq.of(24, 25, 27));
|
||||
|
||||
Seq
|
||||
.of("John", "Jane", "Dennis")
|
||||
.zip(Seq.of(24, 25, 27), (x, y) -> x + ":" + y);
|
||||
|
||||
Seq
|
||||
.of("a", "b", "c")
|
||||
.zipWithIndex();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue