Merge branch 'master' into JAVA-18133
This commit is contained in:
commit
3d93c55d44
|
@ -118,11 +118,6 @@
|
||||||
<artifactId>curator-recipes</artifactId>
|
<artifactId>curator-recipes</artifactId>
|
||||||
<version>${curator.version}</version>
|
<version>${curator.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.zookeeper</groupId>
|
|
||||||
<artifactId>zookeeper</artifactId>
|
|
||||||
<version>${zookeeper.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
|
@ -191,10 +186,8 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
|
||||||
<avro.version>1.8.2</avro.version>
|
<avro.version>1.8.2</avro.version>
|
||||||
<beam.version>2.19.0</beam.version>
|
<beam.version>2.45.0</beam.version>
|
||||||
<bval.version>1.1.2</bval.version>
|
<bval.version>1.1.2</bval.version>
|
||||||
<javax.validation.validation-api.version>1.1.0.Final</javax.validation.validation-api.version>
|
<javax.validation.validation-api.version>1.1.0.Final</javax.validation.validation-api.version>
|
||||||
<meecrowave-junit.version>1.2.0</meecrowave-junit.version>
|
<meecrowave-junit.version>1.2.0</meecrowave-junit.version>
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.groovy</groupId>
|
<groupId>org.codehaus.groovy</groupId>
|
||||||
<artifactId>groovy-eclipse-batch</artifactId>
|
<artifactId>groovy-eclipse-batch</artifactId>
|
||||||
<version>${groovy.version}-01</version>
|
<version>${groovy-eclipse-batch.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -163,9 +163,10 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<groovy-wslite.version>1.1.3</groovy-wslite.version>
|
<groovy-wslite.version>1.1.3</groovy-wslite.version>
|
||||||
<assembly.plugin.version>3.1.0</assembly.plugin.version>
|
<assembly.plugin.version>3.4.2</assembly.plugin.version>
|
||||||
<compiler.plugin.version>3.8.0</compiler.plugin.version>
|
<compiler.plugin.version>3.8.1</compiler.plugin.version>
|
||||||
<groovy.compiler.version>3.3.0-01</groovy.compiler.version>
|
<groovy.compiler.version>3.7.0</groovy.compiler.version>
|
||||||
|
<groovy-eclipse-batch.version>3.0.8-01</groovy-eclipse-batch.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<groovy.version>3.0.8</groovy.version>
|
<groovy.version>3.0.15</groovy.version>
|
||||||
<groovy-all.version>3.0.8</groovy-all.version>
|
<groovy-all.version>3.0.15</groovy-all.version>
|
||||||
<groovy-sql.version>3.0.8</groovy-sql.version>
|
<groovy-sql.version>3.0.15</groovy-sql.version>
|
||||||
<hsqldb.version>2.4.0</hsqldb.version>
|
<hsqldb.version>2.7.1</hsqldb.version>
|
||||||
<spock-core.version>2.3-groovy-3.0</spock-core.version>
|
<spock-core.version>2.3-groovy-3.0</spock-core.version>
|
||||||
<gmavenplus-plugin.version>1.6</gmavenplus-plugin.version>
|
<gmavenplus-plugin.version>2.1.0</gmavenplus-plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
=========
|
||||||
|
|
||||||
|
## Core Java Collections Cookbooks and Examples
|
||||||
|
|
||||||
|
### Relevant Articles:
|
||||||
|
|
||||||
|
- More articles: [[<-- prev]](/core-java-modules/core-java-collections-4)
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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>core-java-collections-5</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>core-java-collections-5</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung.core-java-modules</groupId>
|
||||||
|
<artifactId>core-java-modules</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.platform</groupId>
|
||||||
|
<artifactId>junit-platform-runner</artifactId>
|
||||||
|
<version>${junit-platform.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
<version>${junit.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${junit.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.roaringbitmap</groupId>
|
||||||
|
<artifactId>RoaringBitmap</artifactId>
|
||||||
|
<version>${roaringbitmap.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjdk.jmh</groupId>
|
||||||
|
<artifactId>jmh-generator-annprocess</artifactId>
|
||||||
|
<version>${jmh.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjdk.jmh</groupId>
|
||||||
|
<artifactId>jmh-core</artifactId>
|
||||||
|
<version>${jmh.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<junit.version>5.9.2</junit.version>
|
||||||
|
<roaringbitmap.version>0.9.38</roaringbitmap.version>
|
||||||
|
<jmh.version>1.36</jmh.version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
|
@ -0,0 +1,82 @@
|
||||||
|
package com.baeldung.roaringbitmap;
|
||||||
|
|
||||||
|
import java.util.BitSet;
|
||||||
|
|
||||||
|
import org.openjdk.jmh.annotations.Benchmark;
|
||||||
|
import org.openjdk.jmh.annotations.Scope;
|
||||||
|
import org.openjdk.jmh.annotations.Setup;
|
||||||
|
import org.openjdk.jmh.annotations.State;
|
||||||
|
import org.roaringbitmap.RoaringBitmap;
|
||||||
|
|
||||||
|
@State(Scope.Thread)
|
||||||
|
public class BitSetsBenchmark {
|
||||||
|
private RoaringBitmap rb1;
|
||||||
|
private BitSet bs1;
|
||||||
|
private RoaringBitmap rb2;
|
||||||
|
private BitSet bs2;
|
||||||
|
private final static int SIZE = 10_000_000;
|
||||||
|
|
||||||
|
@Setup
|
||||||
|
public void setup() {
|
||||||
|
rb1 = new RoaringBitmap();
|
||||||
|
bs1 = new BitSet(SIZE);
|
||||||
|
rb2 = new RoaringBitmap();
|
||||||
|
bs2 = new BitSet(SIZE);
|
||||||
|
for (int i = 0; i < SIZE / 2; i++) {
|
||||||
|
rb1.add(i);
|
||||||
|
bs1.set(i);
|
||||||
|
}
|
||||||
|
for (int i = SIZE / 2; i < SIZE; i++) {
|
||||||
|
rb2.add(i);
|
||||||
|
bs2.set(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public RoaringBitmap roaringBitmapUnion() {
|
||||||
|
return RoaringBitmap.or(rb1, rb2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public BitSet bitSetUnion() {
|
||||||
|
BitSet result = (BitSet) bs1.clone();
|
||||||
|
result.or(bs2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public RoaringBitmap roaringBitmapIntersection() {
|
||||||
|
return RoaringBitmap.and(rb1, rb2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public BitSet bitSetIntersection() {
|
||||||
|
BitSet result = (BitSet) bs1.clone();
|
||||||
|
result.and(bs2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public RoaringBitmap roaringBitmapDifference() {
|
||||||
|
return RoaringBitmap.andNot(rb1, rb2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public BitSet bitSetDifference() {
|
||||||
|
BitSet result = (BitSet) bs1.clone();
|
||||||
|
result.andNot(bs2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public RoaringBitmap roaringBitmapXOR() {
|
||||||
|
return RoaringBitmap.xor(rb1, rb2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public BitSet bitSetXOR() {
|
||||||
|
BitSet result = (BitSet) bs1.clone();
|
||||||
|
result.xor(bs2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.baeldung.roaringbitmap;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class BitSetsBenchmarkRunner {
|
||||||
|
public static void main(String... args) throws IOException {
|
||||||
|
org.openjdk.jmh.Main.main(args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.baeldung.roaringbitmap;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.roaringbitmap.RoaringBitmap;
|
||||||
|
|
||||||
|
class RoaringBitmapBenchmarkUnitTest {
|
||||||
|
@Test
|
||||||
|
public void givenTwoRoaringBitmap_whenUsingOr_thenWillGetSetsUnion() {
|
||||||
|
RoaringBitmap expected = RoaringBitmap.bitmapOf(1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
|
RoaringBitmap A = RoaringBitmap.bitmapOf(1, 2, 3, 4, 5);
|
||||||
|
RoaringBitmap B = RoaringBitmap.bitmapOf(4, 5, 6, 7, 8);
|
||||||
|
RoaringBitmap union = RoaringBitmap.or(A, B);
|
||||||
|
assertEquals(expected, union);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenTwoRoaringBitmap_whenUsingAnd_thenWillGetSetsIntersection() {
|
||||||
|
RoaringBitmap expected = RoaringBitmap.bitmapOf(4, 5);
|
||||||
|
RoaringBitmap A = RoaringBitmap.bitmapOfRange(1, 6);
|
||||||
|
RoaringBitmap B = RoaringBitmap.bitmapOf(4, 5, 6, 7, 8);
|
||||||
|
RoaringBitmap intersection = RoaringBitmap.and(A, B);
|
||||||
|
assertEquals(expected, intersection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenTwoRoaringBitmap_whenUsingAndNot_thenWillGetSetsDifference() {
|
||||||
|
RoaringBitmap expected = RoaringBitmap.bitmapOf(1, 2, 3);
|
||||||
|
RoaringBitmap A = new RoaringBitmap();
|
||||||
|
A.add(1L, 6L);
|
||||||
|
RoaringBitmap B = RoaringBitmap.bitmapOf(4, 5, 6, 7, 8);
|
||||||
|
RoaringBitmap difference = RoaringBitmap.andNot(A, B);
|
||||||
|
assertEquals(expected, difference);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenTwoRoaringBitmap_whenUsingXOR_thenWillGetSetsSymmetricDifference() {
|
||||||
|
RoaringBitmap expected = RoaringBitmap.bitmapOf(1, 2, 3, 6, 7, 8);
|
||||||
|
RoaringBitmap A = RoaringBitmap.bitmapOfRange(1, 6);
|
||||||
|
RoaringBitmap B = RoaringBitmap.bitmapOfRange(4, 9);
|
||||||
|
RoaringBitmap xor = RoaringBitmap.xor(A, B);
|
||||||
|
assertEquals(expected, xor);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.baeldung.listduplicate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class ListDuplicate {
|
||||||
|
public List<Integer> listDuplicateUsingSet(List<Integer> list) {
|
||||||
|
List<Integer> duplicates = new ArrayList<>();
|
||||||
|
Set<Integer> set = new HashSet<>();
|
||||||
|
for (Integer i : list) {
|
||||||
|
if (set.contains(i)) {
|
||||||
|
duplicates.add(i);
|
||||||
|
} else {
|
||||||
|
set.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return duplicates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> listDuplicateUsingMap(List<Integer> list) {
|
||||||
|
List<Integer> duplicates = new ArrayList<>();
|
||||||
|
Map<Integer, Integer> frequencyMap = new HashMap<>();
|
||||||
|
for (Integer number : list) {
|
||||||
|
frequencyMap.put(number, frequencyMap.getOrDefault(number, 0) + 1);
|
||||||
|
}
|
||||||
|
for (int number : frequencyMap.keySet()) {
|
||||||
|
if (frequencyMap.get(number) != 1) {
|
||||||
|
duplicates.add(number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return duplicates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> listDuplicateUsingFilterAndSetAdd(List<Integer> list) {
|
||||||
|
Set<Integer> elements = new HashSet<Integer>();
|
||||||
|
return list.stream()
|
||||||
|
.filter(n -> !elements.add(n))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> listDuplicateUsingCollectionsFrequency(List<Integer> list) {
|
||||||
|
List<Integer> duplicates = new ArrayList<>();
|
||||||
|
Set<Integer> set = list.stream()
|
||||||
|
.filter(i -> Collections.frequency(list, i) > 1)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
duplicates.addAll(set);
|
||||||
|
return duplicates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> listDuplicateUsingMapAndCollectorsGroupingBy(List<Integer> list) {
|
||||||
|
List<Integer> duplicates = new ArrayList<>();
|
||||||
|
Set<Integer> set = list.stream()
|
||||||
|
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
|
||||||
|
.entrySet()
|
||||||
|
.stream()
|
||||||
|
.filter(m -> m.getValue() > 1)
|
||||||
|
.map(Map.Entry::getKey)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
duplicates.addAll(set);
|
||||||
|
return duplicates;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.baeldung.listduplicate;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class ListDuplicateUnitTest {
|
||||||
|
private static ListDuplicate listDuplicate;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setup() {
|
||||||
|
listDuplicate = new ListDuplicate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenList_whenUsingSet_thenReturnDuplicateElements() {
|
||||||
|
List<Integer> list = Arrays.asList(1, 2, 3, 3, 4, 4, 5);
|
||||||
|
List<Integer> duplicates = listDuplicate.listDuplicateUsingSet(list);
|
||||||
|
Assert.assertEquals(duplicates.size(), 2);
|
||||||
|
Assert.assertEquals(duplicates.contains(3), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(4), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(1), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenList_whenUsingFrequencyMap_thenReturnDuplicateElements() {
|
||||||
|
List<Integer> list = Arrays.asList(1, 2, 3, 3, 4, 4, 5);
|
||||||
|
List<Integer> duplicates = listDuplicate.listDuplicateUsingMap(list);
|
||||||
|
Assert.assertEquals(duplicates.size(), 2);
|
||||||
|
Assert.assertEquals(duplicates.contains(3), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(4), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(1), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenList_whenUsingFilterAndSetAdd_thenReturnDuplicateElements() {
|
||||||
|
List<Integer> list = Arrays.asList(1, 2, 3, 3, 4, 4, 5);
|
||||||
|
List<Integer> duplicates = listDuplicate.listDuplicateUsingFilterAndSetAdd(list);
|
||||||
|
Assert.assertEquals(duplicates.size(), 2);
|
||||||
|
Assert.assertEquals(duplicates.contains(3), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(4), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(1), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenList_whenUsingCollectionsFrequency_thenReturnDuplicateElements() {
|
||||||
|
List<Integer> list = Arrays.asList(1, 2, 3, 3, 4, 4, 5);
|
||||||
|
List<Integer> duplicates = listDuplicate.listDuplicateUsingCollectionsFrequency(list);
|
||||||
|
Assert.assertEquals(duplicates.size(), 2);
|
||||||
|
Assert.assertEquals(duplicates.contains(3), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(4), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(1), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenList_whenUsingMapAndCollectorsGroupingBy_thenReturnDuplicateElements() {
|
||||||
|
List<Integer> list = Arrays.asList(1, 2, 3, 3, 4, 4, 5);
|
||||||
|
List<Integer> duplicates = listDuplicate.listDuplicateUsingCollectionsFrequency(list);
|
||||||
|
Assert.assertEquals(duplicates.size(), 2);
|
||||||
|
Assert.assertEquals(duplicates.contains(3), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(4), true);
|
||||||
|
Assert.assertEquals(duplicates.contains(1), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,6 +31,7 @@
|
||||||
<module>core-java-collections-2</module>
|
<module>core-java-collections-2</module>
|
||||||
<module>core-java-collections-3</module>
|
<module>core-java-collections-3</module>
|
||||||
<module>core-java-collections-4</module>
|
<module>core-java-collections-4</module>
|
||||||
|
<module>core-java-collections-5</module>
|
||||||
<module>core-java-collections-conversions</module>
|
<module>core-java-collections-conversions</module>
|
||||||
<module>core-java-collections-conversions-2</module>
|
<module>core-java-collections-conversions-2</module>
|
||||||
<module>core-java-collections-set-2</module>
|
<module>core-java-collections-set-2</module>
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>core-java-exclusions</artifactId>
|
||||||
|
<version>0.0.0-SNAPSHOT</version>
|
||||||
|
<name>core-java-exclusions</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung.dependency-exclusion</groupId>
|
||||||
|
<artifactId>dependency-exclusion</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${surefire-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<runOrder>alphabetical</runOrder>
|
||||||
|
<threadCount>1</threadCount>
|
||||||
|
<properties>
|
||||||
|
<property>
|
||||||
|
<name>junit</name>
|
||||||
|
<value>false</value>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
</configuration>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<!-- Deactivate JUnit 4.7 engine by overriding it with an empty dummy -->
|
||||||
|
<groupId>org.apache.maven.surefire</groupId>
|
||||||
|
<artifactId>surefire-junit47</artifactId>
|
||||||
|
<version>dummy</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.sample.project.tests;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class ExcludeDirectDependencyUnitTest {
|
||||||
|
@Test
|
||||||
|
public void basicUnitTest() {
|
||||||
|
assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>org.apache.maven.surefire</groupId>
|
||||||
|
<artifactId>surefire-junit47</artifactId>
|
||||||
|
<version>dummy</version>
|
||||||
|
</project>
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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.dependency-exclusion</groupId>
|
||||||
|
<artifactId>dependency-exclusion</artifactId>
|
||||||
|
<name>dependency-exclusion</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>parent-java</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<relativePath>../parent-java</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<surefire-version>2.22.2</surefire-version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>dummy-surefire-junit47</module>
|
||||||
|
<module>core-java-exclusions</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.7.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>-parameters</arg>
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${surefire-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<threadCount>1</threadCount>
|
||||||
|
</configuration>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.surefire</groupId>
|
||||||
|
<artifactId>surefire-junit-platform</artifactId>
|
||||||
|
<version>${surefire-version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.13</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
</project>
|
|
@ -37,6 +37,7 @@
|
||||||
<version>${java-hamcrest.version}</version>
|
<version>${java-hamcrest.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
35
pom.xml
35
pom.xml
|
@ -331,13 +331,11 @@
|
||||||
<module>parent-java</module>
|
<module>parent-java</module>
|
||||||
|
|
||||||
<module>apache-cxf-modules</module>
|
<module>apache-cxf-modules</module>
|
||||||
<module>apache-libraries</module>
|
|
||||||
|
|
||||||
<module>azure</module>
|
<module>azure</module>
|
||||||
<module>checker-plugin</module>
|
<module>checker-plugin</module>
|
||||||
<!-- <module>clojure</module> --> <!-- Not a maven project -->
|
<!-- <module>clojure</module> --> <!-- Not a maven project -->
|
||||||
|
|
||||||
<module>core-groovy-modules</module>
|
|
||||||
<module>core-java-modules</module>
|
<module>core-java-modules</module>
|
||||||
<module>couchbase</module>
|
<module>couchbase</module>
|
||||||
|
|
||||||
|
@ -346,7 +344,6 @@
|
||||||
<module>gradle-modules/gradle/maven-to-gradle</module>
|
<module>gradle-modules/gradle/maven-to-gradle</module>
|
||||||
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
||||||
|
|
||||||
<module>guava-modules</module>
|
|
||||||
<!-- <module>guest</module> --> <!-- not to be built as its for guest articles -->
|
<!-- <module>guest</module> --> <!-- not to be built as its for guest articles -->
|
||||||
|
|
||||||
<module>apache-httpclient</module>
|
<module>apache-httpclient</module>
|
||||||
|
@ -402,13 +399,8 @@
|
||||||
<module>performance-tests</module>
|
<module>performance-tests</module>
|
||||||
<module>persistence-modules</module>
|
<module>persistence-modules</module>
|
||||||
|
|
||||||
|
|
||||||
<module>quarkus-modules</module>
|
|
||||||
|
|
||||||
<module>rule-engines-modules</module>
|
<module>rule-engines-modules</module>
|
||||||
<module>rxjava-modules</module>
|
|
||||||
|
|
||||||
<module>reactive-systems</module>
|
|
||||||
<module>security-modules</module>
|
<module>security-modules</module>
|
||||||
|
|
||||||
<module>vavr-modules</module>
|
<module>vavr-modules</module>
|
||||||
|
@ -598,13 +590,11 @@
|
||||||
<module>parent-java</module>
|
<module>parent-java</module>
|
||||||
|
|
||||||
<module>apache-cxf-modules</module>
|
<module>apache-cxf-modules</module>
|
||||||
<module>apache-libraries</module>
|
|
||||||
|
|
||||||
<module>azure</module>
|
<module>azure</module>
|
||||||
<module>checker-plugin</module>
|
<module>checker-plugin</module>
|
||||||
<!-- <module>clojure</module> --> <!-- Not a maven project -->
|
<!-- <module>clojure</module> --> <!-- Not a maven project -->
|
||||||
|
|
||||||
<module>core-groovy-modules</module>
|
|
||||||
<module>core-java-modules</module>
|
<module>core-java-modules</module>
|
||||||
<module>couchbase</module>
|
<module>couchbase</module>
|
||||||
<module>custom-pmd</module>
|
<module>custom-pmd</module>
|
||||||
|
@ -613,8 +603,6 @@
|
||||||
<!-- <module>gradle-modules</module> --> <!-- Not a maven project -->
|
<!-- <module>gradle-modules</module> --> <!-- Not a maven project -->
|
||||||
<module>gradle-modules/gradle/maven-to-gradle</module>
|
<module>gradle-modules/gradle/maven-to-gradle</module>
|
||||||
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
||||||
|
|
||||||
<module>guava-modules</module>
|
|
||||||
<!-- <module>guest</module> --> <!-- not to be built as its for guest articles -->
|
<!-- <module>guest</module> --> <!-- not to be built as its for guest articles -->
|
||||||
|
|
||||||
<module>apache-httpclient</module>
|
<module>apache-httpclient</module>
|
||||||
|
@ -659,7 +647,6 @@
|
||||||
<module>microservices-modules</module>
|
<module>microservices-modules</module>
|
||||||
<module>muleesb</module>
|
<module>muleesb</module>
|
||||||
|
|
||||||
|
|
||||||
<module>netflix-modules</module>
|
<module>netflix-modules</module>
|
||||||
|
|
||||||
<module>osgi</module>
|
<module>osgi</module>
|
||||||
|
@ -670,13 +657,8 @@
|
||||||
<module>performance-tests</module>
|
<module>performance-tests</module>
|
||||||
<module>persistence-modules</module>
|
<module>persistence-modules</module>
|
||||||
|
|
||||||
|
|
||||||
<module>quarkus-modules</module>
|
|
||||||
|
|
||||||
<module>rule-engines-modules</module>
|
<module>rule-engines-modules</module>
|
||||||
<module>rxjava-modules</module>
|
|
||||||
|
|
||||||
<module>reactive-systems</module>
|
|
||||||
<module>security-modules</module>
|
<module>security-modules</module>
|
||||||
|
|
||||||
<module>vavr-modules</module>
|
<module>vavr-modules</module>
|
||||||
|
@ -878,11 +860,13 @@
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>algorithms-modules</module>
|
<module>algorithms-modules</module>
|
||||||
|
<module>apache-libraries</module>
|
||||||
<module>apache-poi</module>
|
<module>apache-poi</module>
|
||||||
<module>apache-velocity</module>
|
<module>apache-velocity</module>
|
||||||
<module>di-modules</module>
|
<module>di-modules</module>
|
||||||
<module>asciidoctor</module>
|
<module>asciidoctor</module>
|
||||||
<module>aws-modules</module>
|
<module>aws-modules</module>
|
||||||
|
<module>core-groovy-modules</module>
|
||||||
<module>core-java-modules/core-java-9</module>
|
<module>core-java-modules/core-java-9</module>
|
||||||
<module>core-java-modules/core-java-9-improvements</module>
|
<module>core-java-modules/core-java-9-improvements</module>
|
||||||
<module>core-java-modules/core-java-9-jigsaw</module>
|
<module>core-java-modules/core-java-9-jigsaw</module>
|
||||||
|
@ -927,6 +911,7 @@
|
||||||
<module>deeplearning4j</module>
|
<module>deeplearning4j</module>
|
||||||
<module>docker-modules</module>
|
<module>docker-modules</module>
|
||||||
<module>drools</module>
|
<module>drools</module>
|
||||||
|
<module>guava-modules</module>
|
||||||
<module>apache-httpclient-2</module>
|
<module>apache-httpclient-2</module>
|
||||||
<module>kubernetes-modules/kubernetes-spring</module>
|
<module>kubernetes-modules/kubernetes-spring</module>
|
||||||
<module>libraries-concurrency</module>
|
<module>libraries-concurrency</module>
|
||||||
|
@ -936,8 +921,7 @@
|
||||||
<module>optaplanner</module>
|
<module>optaplanner</module>
|
||||||
<module>persistence-modules/sirix</module>
|
<module>persistence-modules/sirix</module>
|
||||||
<module>persistence-modules/spring-data-cassandra-2</module>
|
<module>persistence-modules/spring-data-cassandra-2</module>
|
||||||
<module>quarkus-modules/quarkus-vs-springboot</module>
|
<module>quarkus-modules</module>
|
||||||
<module>quarkus-modules/quarkus-jandex</module>
|
|
||||||
<module>spring-boot-modules/spring-boot-cassandre</module>
|
<module>spring-boot-modules/spring-boot-cassandre</module>
|
||||||
<module>spring-boot-modules/spring-boot-3</module>
|
<module>spring-boot-modules/spring-boot-3</module>
|
||||||
<module>spring-boot-modules/spring-boot-3-native</module>
|
<module>spring-boot-modules/spring-boot-3-native</module>
|
||||||
|
@ -947,6 +931,8 @@
|
||||||
<module>spring-swagger-codegen/custom-validations-opeanpi-codegen</module>
|
<module>spring-swagger-codegen/custom-validations-opeanpi-codegen</module>
|
||||||
<module>testing-modules/testing-assertions</module>
|
<module>testing-modules/testing-assertions</module>
|
||||||
<module>persistence-modules/fauna</module>
|
<module>persistence-modules/fauna</module>
|
||||||
|
<module>reactive-systems</module>
|
||||||
|
<module>rxjava-modules</module>
|
||||||
<module>lightrun</module>
|
<module>lightrun</module>
|
||||||
<module>tablesaw</module>
|
<module>tablesaw</module>
|
||||||
<module>geotools</module>
|
<module>geotools</module>
|
||||||
|
@ -1088,12 +1074,13 @@
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>algorithms-modules</module>
|
<module>algorithms-modules</module>
|
||||||
|
<module>apache-libraries</module>
|
||||||
<module>apache-poi</module>
|
<module>apache-poi</module>
|
||||||
<module>apache-velocity</module>
|
<module>apache-velocity</module>
|
||||||
<module>di-modules</module>
|
<module>di-modules</module>
|
||||||
<module>asciidoctor</module>
|
<module>asciidoctor</module>
|
||||||
<module>aws-modules</module>
|
<module>aws-modules</module>
|
||||||
|
<module>core-groovy-modules</module>
|
||||||
<module>core-java-modules/core-java-9</module>
|
<module>core-java-modules/core-java-9</module>
|
||||||
<module>core-java-modules/core-java-9-improvements</module>
|
<module>core-java-modules/core-java-9-improvements</module>
|
||||||
<module>core-java-modules/core-java-9-jigsaw</module>
|
<module>core-java-modules/core-java-9-jigsaw</module>
|
||||||
|
@ -1138,6 +1125,7 @@
|
||||||
<module>deeplearning4j</module>
|
<module>deeplearning4j</module>
|
||||||
<module>docker-modules</module>
|
<module>docker-modules</module>
|
||||||
<module>drools</module>
|
<module>drools</module>
|
||||||
|
<module>guava-modules</module>
|
||||||
<module>apache-httpclient-2</module>
|
<module>apache-httpclient-2</module>
|
||||||
<module>kubernetes-modules/kubernetes-spring</module>
|
<module>kubernetes-modules/kubernetes-spring</module>
|
||||||
<module>libraries-concurrency</module>
|
<module>libraries-concurrency</module>
|
||||||
|
@ -1147,8 +1135,7 @@
|
||||||
<module>optaplanner</module>
|
<module>optaplanner</module>
|
||||||
<module>persistence-modules/sirix</module>
|
<module>persistence-modules/sirix</module>
|
||||||
<module>persistence-modules/spring-data-cassandra-2</module>
|
<module>persistence-modules/spring-data-cassandra-2</module>
|
||||||
<module>quarkus-modules/quarkus-vs-springboot</module>
|
<module>quarkus-modules</module>
|
||||||
<module>quarkus-modules/quarkus-jandex</module>
|
|
||||||
<module>spring-boot-modules/spring-boot-cassandre</module>
|
<module>spring-boot-modules/spring-boot-cassandre</module>
|
||||||
<module>spring-boot-modules/spring-boot-3</module>
|
<module>spring-boot-modules/spring-boot-3</module>
|
||||||
<module>spring-boot-modules/spring-boot-3-native</module>
|
<module>spring-boot-modules/spring-boot-3-native</module>
|
||||||
|
@ -1158,6 +1145,8 @@
|
||||||
<module>spring-swagger-codegen/custom-validations-opeanpi-codegen</module>
|
<module>spring-swagger-codegen/custom-validations-opeanpi-codegen</module>
|
||||||
<module>testing-modules/testing-assertions</module>
|
<module>testing-modules/testing-assertions</module>
|
||||||
<module>persistence-modules/fauna</module>
|
<module>persistence-modules/fauna</module>
|
||||||
|
<module>reactive-systems</module>
|
||||||
|
<module>rxjava-modules</module>
|
||||||
<module>lightrun</module>
|
<module>lightrun</module>
|
||||||
<module>tablesaw</module>
|
<module>tablesaw</module>
|
||||||
<module>geotools</module>
|
<module>geotools</module>
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>quarkus</module>
|
<module>quarkus</module>
|
||||||
<module>quarkus-extension</module>
|
<module>quarkus-extension</module>
|
||||||
<!--Disabled because requires Java-9 <module>quarkus-jandex</module> <module>quarkus-vs-springboot</module> -->
|
<module>quarkus-jandex</module>
|
||||||
|
<module>quarkus-vs-springboot</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -182,7 +182,7 @@
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<quarkus.version>1.7.0.Final</quarkus.version>
|
<quarkus.version>2.16.3.Final</quarkus.version>
|
||||||
<mockito.version>3.3.0</mockito.version>
|
<mockito.version>3.3.0</mockito.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>rxjava-core</module>
|
<module>rxjava-core</module>
|
||||||
|
<module>rxjava-core-2</module>
|
||||||
<module>rxjava-libraries</module>
|
<module>rxjava-libraries</module>
|
||||||
<module>rxjava-observables</module>
|
<module>rxjava-observables</module>
|
||||||
<module>rxjava-operators</module>
|
<module>rxjava-operators</module>
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.mockito.Mockito;
|
||||||
import rx.Single;
|
import rx.Single;
|
||||||
import rx.observers.TestSubscriber;
|
import rx.observers.TestSubscriber;
|
||||||
|
|
||||||
class SingleJustVsFromCallableTest {
|
class SingleJustVsFromCallableUnitTest {
|
||||||
|
|
||||||
public EmployeeRepository repository = mock(EmployeeRepository.class);
|
public EmployeeRepository repository = mock(EmployeeRepository.class);
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<instancio.version>2.6.0</instancio.version>
|
<instancio.version>2.9.0</instancio.version>
|
||||||
<jackson.version>2.14.1</jackson.version>
|
<jackson.version>2.14.1</jackson.version>
|
||||||
<junit-jupiter.version>5.9.2</junit-jupiter.version>
|
<junit-jupiter.version>5.9.2</junit-jupiter.version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue