diff --git a/core-java-lang/native/nativedatetimeutils.dll b/core-java-lang/native/nativedatetimeutils.dll
deleted file mode 100644
index ecdd388380..0000000000
Binary files a/core-java-lang/native/nativedatetimeutils.dll and /dev/null differ
diff --git a/core-java-10/README.md b/core-java-modules/core-java-10/README.md
similarity index 100%
rename from core-java-10/README.md
rename to core-java-modules/core-java-10/README.md
diff --git a/core-java-10/pom.xml b/core-java-modules/core-java-10/pom.xml
similarity index 96%
rename from core-java-10/pom.xml
rename to core-java-modules/core-java-10/pom.xml
index b15f8b5d63..7163619679 100644
--- a/core-java-10/pom.xml
+++ b/core-java-modules/core-java-10/pom.xml
@@ -12,6 +12,7 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
+ ../../
diff --git a/core-java-10/src/main/java/com/baeldung/App.java b/core-java-modules/core-java-10/src/main/java/com/baeldung/App.java
similarity index 100%
rename from core-java-10/src/main/java/com/baeldung/App.java
rename to core-java-modules/core-java-10/src/main/java/com/baeldung/App.java
diff --git a/core-java-10/src/main/java/com/baeldung/graal/CountUppercase.java b/core-java-modules/core-java-10/src/main/java/com/baeldung/graal/CountUppercase.java
similarity index 100%
rename from core-java-10/src/main/java/com/baeldung/graal/CountUppercase.java
rename to core-java-modules/core-java-10/src/main/java/com/baeldung/graal/CountUppercase.java
diff --git a/core-java-10/src/main/resources/logback.xml b/core-java-modules/core-java-10/src/main/resources/logback.xml
similarity index 100%
rename from core-java-10/src/main/resources/logback.xml
rename to core-java-modules/core-java-10/src/main/resources/logback.xml
diff --git a/core-java-10/src/test/java/com/baeldung/AppTest.java b/core-java-modules/core-java-10/src/test/java/com/baeldung/AppTest.java
similarity index 100%
rename from core-java-10/src/test/java/com/baeldung/AppTest.java
rename to core-java-modules/core-java-10/src/test/java/com/baeldung/AppTest.java
diff --git a/core-java-10/src/test/java/com/baeldung/java10/Java10FeaturesUnitTest.java b/core-java-modules/core-java-10/src/test/java/com/baeldung/java10/Java10FeaturesUnitTest.java
similarity index 100%
rename from core-java-10/src/test/java/com/baeldung/java10/Java10FeaturesUnitTest.java
rename to core-java-modules/core-java-10/src/test/java/com/baeldung/java10/Java10FeaturesUnitTest.java
diff --git a/core-java-10/src/test/java/com/baeldung/java10/list/CopyListServiceUnitTest.java b/core-java-modules/core-java-10/src/test/java/com/baeldung/java10/list/CopyListServiceUnitTest.java
similarity index 100%
rename from core-java-10/src/test/java/com/baeldung/java10/list/CopyListServiceUnitTest.java
rename to core-java-modules/core-java-10/src/test/java/com/baeldung/java10/list/CopyListServiceUnitTest.java
diff --git a/core-java-11/README.md b/core-java-modules/core-java-11/README.md
similarity index 100%
rename from core-java-11/README.md
rename to core-java-modules/core-java-11/README.md
diff --git a/core-java-11/pom.xml b/core-java-modules/core-java-11/pom.xml
similarity index 97%
rename from core-java-11/pom.xml
rename to core-java-modules/core-java-11/pom.xml
index 933acdbecc..b78c141552 100644
--- a/core-java-11/pom.xml
+++ b/core-java-modules/core-java-11/pom.xml
@@ -12,6 +12,7 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
+ ../../
diff --git a/core-java-11/src/main/java/com/baeldung/App.java b/core-java-modules/core-java-11/src/main/java/com/baeldung/App.java
similarity index 100%
rename from core-java-11/src/main/java/com/baeldung/App.java
rename to core-java-modules/core-java-11/src/main/java/com/baeldung/App.java
diff --git a/core-java-11/src/main/java/com/baeldung/Outer.java b/core-java-modules/core-java-11/src/main/java/com/baeldung/Outer.java
similarity index 100%
rename from core-java-11/src/main/java/com/baeldung/Outer.java
rename to core-java-modules/core-java-11/src/main/java/com/baeldung/Outer.java
diff --git a/core-java-11/src/main/java/com/baeldung/add b/core-java-modules/core-java-11/src/main/java/com/baeldung/add
old mode 100755
new mode 100644
similarity index 100%
rename from core-java-11/src/main/java/com/baeldung/add
rename to core-java-modules/core-java-11/src/main/java/com/baeldung/add
diff --git a/core-java-11/src/main/java/com/baeldung/epsilongc/MemoryPolluter.java b/core-java-modules/core-java-11/src/main/java/com/baeldung/epsilongc/MemoryPolluter.java
similarity index 100%
rename from core-java-11/src/main/java/com/baeldung/epsilongc/MemoryPolluter.java
rename to core-java-modules/core-java-11/src/main/java/com/baeldung/epsilongc/MemoryPolluter.java
diff --git a/core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java b/core-java-modules/core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java
similarity index 97%
rename from core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java
rename to core-java-modules/core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java
index fb4abd3bb6..725f969596 100644
--- a/core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java
+++ b/core-java-modules/core-java-11/src/main/java/com/baeldung/java11/httpclient/HttpClientExample.java
@@ -1,132 +1,132 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.baeldung.java11.httpclient;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.http.HttpClient;
-import java.net.http.HttpClient.Version;
-import java.net.http.HttpRequest;
-import java.net.http.HttpRequest.BodyPublishers;
-import java.net.http.HttpResponse;
-import java.net.http.HttpResponse.BodyHandlers;
-import java.net.http.HttpResponse.PushPromiseHandler;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-public class HttpClientExample {
-
- public static void main(String[] args) throws Exception {
- httpGetRequest();
- httpPostRequest();
- asynchronousGetRequest();
- asynchronousMultipleRequests();
- pushRequest();
- }
-
- public static void httpGetRequest() throws URISyntaxException, IOException, InterruptedException {
- HttpClient client = HttpClient.newHttpClient();
- HttpRequest request = HttpRequest.newBuilder()
- .version(HttpClient.Version.HTTP_2)
- .uri(URI.create("http://jsonplaceholder.typicode.com/posts/1"))
- .headers("Accept-Enconding", "gzip, deflate")
- .build();
- HttpResponse response = client.send(request, BodyHandlers.ofString());
-
- String responseBody = response.body();
- int responseStatusCode = response.statusCode();
-
- System.out.println("httpGetRequest: " + responseBody);
- System.out.println("httpGetRequest status code: " + responseStatusCode);
- }
-
- public static void httpPostRequest() throws URISyntaxException, IOException, InterruptedException {
- HttpClient client = HttpClient.newBuilder()
- .version(HttpClient.Version.HTTP_2)
- .build();
- HttpRequest request = HttpRequest.newBuilder(new URI("http://jsonplaceholder.typicode.com/posts"))
- .version(HttpClient.Version.HTTP_2)
- .POST(BodyPublishers.ofString("Sample Post Request"))
- .build();
- HttpResponse response = client.send(request, BodyHandlers.ofString());
- String responseBody = response.body();
- System.out.println("httpPostRequest : " + responseBody);
- }
-
- public static void asynchronousGetRequest() throws URISyntaxException {
- HttpClient client = HttpClient.newHttpClient();
- URI httpURI = new URI("http://jsonplaceholder.typicode.com/posts/1");
- HttpRequest request = HttpRequest.newBuilder(httpURI)
- .version(HttpClient.Version.HTTP_2)
- .build();
- CompletableFuture futureResponse = client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
- .thenAccept(resp -> {
- System.out.println("Got pushed response " + resp.uri());
- System.out.println("Response statuscode: " + resp.statusCode());
- System.out.println("Response body: " + resp.body());
- });
- System.out.println("futureResponse" + futureResponse);
-
- }
-
- public static void asynchronousMultipleRequests() throws URISyntaxException {
- HttpClient client = HttpClient.newHttpClient();
- List uris = Arrays.asList(new URI("http://jsonplaceholder.typicode.com/posts/1"), new URI("http://jsonplaceholder.typicode.com/posts/2"));
- List requests = uris.stream()
- .map(HttpRequest::newBuilder)
- .map(reqBuilder -> reqBuilder.build())
- .collect(Collectors.toList());
- System.out.println("Got pushed response1 " + requests);
- CompletableFuture.allOf(requests.stream()
- .map(request -> client.sendAsync(request, BodyHandlers.ofString()))
- .toArray(CompletableFuture>[]::new))
- .thenAccept(System.out::println)
- .join();
- }
-
- public static void pushRequest() throws URISyntaxException, InterruptedException {
- System.out.println("Running HTTP/2 Server Push example...");
-
- HttpClient httpClient = HttpClient.newBuilder()
- .version(Version.HTTP_2)
- .build();
-
- HttpRequest pageRequest = HttpRequest.newBuilder()
- .uri(URI.create("https://http2.golang.org/serverpush"))
- .build();
-
- // Interface HttpResponse.PushPromiseHandler
- // void applyPushPromise(HttpRequest initiatingRequest, HttpRequest pushPromiseRequest, Function,CompletableFuture>> acceptor)
- httpClient.sendAsync(pageRequest, BodyHandlers.ofString(), pushPromiseHandler())
- .thenAccept(pageResponse -> {
- System.out.println("Page response status code: " + pageResponse.statusCode());
- System.out.println("Page response headers: " + pageResponse.headers());
- String responseBody = pageResponse.body();
- System.out.println(responseBody);
- }).join();
-
- Thread.sleep(1000); // waiting for full response
- }
-
- private static PushPromiseHandler pushPromiseHandler() {
- return (HttpRequest initiatingRequest,
- HttpRequest pushPromiseRequest,
- Function,
- CompletableFuture>> acceptor) -> {
- acceptor.apply(BodyHandlers.ofString())
- .thenAccept(resp -> {
- System.out.println(" Pushed response: " + resp.uri() + ", headers: " + resp.headers());
- });
- System.out.println("Promise request: " + pushPromiseRequest.uri());
- System.out.println("Promise request: " + pushPromiseRequest.headers());
- };
- }
-
-}
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.baeldung.java11.httpclient;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.http.HttpClient;
+import java.net.http.HttpClient.Version;
+import java.net.http.HttpRequest;
+import java.net.http.HttpRequest.BodyPublishers;
+import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodyHandlers;
+import java.net.http.HttpResponse.PushPromiseHandler;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class HttpClientExample {
+
+ public static void main(String[] args) throws Exception {
+ httpGetRequest();
+ httpPostRequest();
+ asynchronousGetRequest();
+ asynchronousMultipleRequests();
+ pushRequest();
+ }
+
+ public static void httpGetRequest() throws URISyntaxException, IOException, InterruptedException {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest.newBuilder()
+ .version(HttpClient.Version.HTTP_2)
+ .uri(URI.create("http://jsonplaceholder.typicode.com/posts/1"))
+ .headers("Accept-Enconding", "gzip, deflate")
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+
+ String responseBody = response.body();
+ int responseStatusCode = response.statusCode();
+
+ System.out.println("httpGetRequest: " + responseBody);
+ System.out.println("httpGetRequest status code: " + responseStatusCode);
+ }
+
+ public static void httpPostRequest() throws URISyntaxException, IOException, InterruptedException {
+ HttpClient client = HttpClient.newBuilder()
+ .version(HttpClient.Version.HTTP_2)
+ .build();
+ HttpRequest request = HttpRequest.newBuilder(new URI("http://jsonplaceholder.typicode.com/posts"))
+ .version(HttpClient.Version.HTTP_2)
+ .POST(BodyPublishers.ofString("Sample Post Request"))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ String responseBody = response.body();
+ System.out.println("httpPostRequest : " + responseBody);
+ }
+
+ public static void asynchronousGetRequest() throws URISyntaxException {
+ HttpClient client = HttpClient.newHttpClient();
+ URI httpURI = new URI("http://jsonplaceholder.typicode.com/posts/1");
+ HttpRequest request = HttpRequest.newBuilder(httpURI)
+ .version(HttpClient.Version.HTTP_2)
+ .build();
+ CompletableFuture futureResponse = client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
+ .thenAccept(resp -> {
+ System.out.println("Got pushed response " + resp.uri());
+ System.out.println("Response statuscode: " + resp.statusCode());
+ System.out.println("Response body: " + resp.body());
+ });
+ System.out.println("futureResponse" + futureResponse);
+
+ }
+
+ public static void asynchronousMultipleRequests() throws URISyntaxException {
+ HttpClient client = HttpClient.newHttpClient();
+ List uris = Arrays.asList(new URI("http://jsonplaceholder.typicode.com/posts/1"), new URI("http://jsonplaceholder.typicode.com/posts/2"));
+ List requests = uris.stream()
+ .map(HttpRequest::newBuilder)
+ .map(reqBuilder -> reqBuilder.build())
+ .collect(Collectors.toList());
+ System.out.println("Got pushed response1 " + requests);
+ CompletableFuture.allOf(requests.stream()
+ .map(request -> client.sendAsync(request, BodyHandlers.ofString()))
+ .toArray(CompletableFuture>[]::new))
+ .thenAccept(System.out::println)
+ .join();
+ }
+
+ public static void pushRequest() throws URISyntaxException, InterruptedException {
+ System.out.println("Running HTTP/2 Server Push example...");
+
+ HttpClient httpClient = HttpClient.newBuilder()
+ .version(Version.HTTP_2)
+ .build();
+
+ HttpRequest pageRequest = HttpRequest.newBuilder()
+ .uri(URI.create("https://http2.golang.org/serverpush"))
+ .build();
+
+ // Interface HttpResponse.PushPromiseHandler
+ // void applyPushPromise(HttpRequest initiatingRequest, HttpRequest pushPromiseRequest, Function,CompletableFuture>> acceptor)
+ httpClient.sendAsync(pageRequest, BodyHandlers.ofString(), pushPromiseHandler())
+ .thenAccept(pageResponse -> {
+ System.out.println("Page response status code: " + pageResponse.statusCode());
+ System.out.println("Page response headers: " + pageResponse.headers());
+ String responseBody = pageResponse.body();
+ System.out.println(responseBody);
+ }).join();
+
+ Thread.sleep(1000); // waiting for full response
+ }
+
+ private static PushPromiseHandler pushPromiseHandler() {
+ return (HttpRequest initiatingRequest,
+ HttpRequest pushPromiseRequest,
+ Function,
+ CompletableFuture>> acceptor) -> {
+ acceptor.apply(BodyHandlers.ofString())
+ .thenAccept(resp -> {
+ System.out.println(" Pushed response: " + resp.uri() + ", headers: " + resp.headers());
+ });
+ System.out.println("Promise request: " + pushPromiseRequest.uri());
+ System.out.println("Promise request: " + pushPromiseRequest.headers());
+ };
+ }
+
+}
diff --git a/core-java-11/src/main/resources/logback.xml b/core-java-modules/core-java-11/src/main/resources/logback.xml
similarity index 100%
rename from core-java-11/src/main/resources/logback.xml
rename to core-java-modules/core-java-11/src/main/resources/logback.xml
diff --git a/core-java-11/src/modules/jlinkModule/com/baeldung/jlink/HelloWorld.java b/core-java-modules/core-java-11/src/modules/jlinkModule/com/baeldung/jlink/HelloWorld.java
similarity index 100%
rename from core-java-11/src/modules/jlinkModule/com/baeldung/jlink/HelloWorld.java
rename to core-java-modules/core-java-11/src/modules/jlinkModule/com/baeldung/jlink/HelloWorld.java
diff --git a/core-java-11/src/modules/jlinkModule/module-info.java b/core-java-modules/core-java-11/src/modules/jlinkModule/module-info.java
similarity index 100%
rename from core-java-11/src/modules/jlinkModule/module-info.java
rename to core-java-modules/core-java-11/src/modules/jlinkModule/module-info.java
diff --git a/core-java-11/src/test/java/com/baeldung/AppTest.java b/core-java-modules/core-java-11/src/test/java/com/baeldung/AppTest.java
similarity index 100%
rename from core-java-11/src/test/java/com/baeldung/AppTest.java
rename to core-java-modules/core-java-11/src/test/java/com/baeldung/AppTest.java
diff --git a/core-java-11/src/test/java/com/baeldung/EmptyStringToEmptyOptionalUnitTest.java b/core-java-modules/core-java-11/src/test/java/com/baeldung/EmptyStringToEmptyOptionalUnitTest.java
similarity index 100%
rename from core-java-11/src/test/java/com/baeldung/EmptyStringToEmptyOptionalUnitTest.java
rename to core-java-modules/core-java-11/src/test/java/com/baeldung/EmptyStringToEmptyOptionalUnitTest.java
diff --git a/core-java-11/src/test/java/com/baeldung/NewStringAPIUnitTest.java b/core-java-modules/core-java-11/src/test/java/com/baeldung/NewStringAPIUnitTest.java
similarity index 100%
rename from core-java-11/src/test/java/com/baeldung/NewStringAPIUnitTest.java
rename to core-java-modules/core-java-11/src/test/java/com/baeldung/NewStringAPIUnitTest.java
diff --git a/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java b/core-java-modules/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java
similarity index 100%
rename from core-java-11/src/test/java/com/baeldung/OuterUnitTest.java
rename to core-java-modules/core-java-11/src/test/java/com/baeldung/OuterUnitTest.java
diff --git a/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java b/core-java-modules/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java
similarity index 97%
rename from core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java
rename to core-java-modules/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java
index bade666636..0e9c12675c 100644
--- a/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java
+++ b/core-java-modules/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpClientTest.java
@@ -1,240 +1,240 @@
-package com.baeldung.java11.httpclient.test;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.net.Authenticator;
-import java.net.CookieManager;
-import java.net.CookiePolicy;
-import java.net.HttpURLConnection;
-import java.net.PasswordAuthentication;
-import java.net.ProxySelector;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.http.HttpClient;
-import java.net.http.HttpRequest;
-import java.net.http.HttpResponse;
-import java.net.http.HttpResponse.BodyHandlers;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CompletionException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-
-import org.junit.jupiter.api.Test;
-
-public class HttpClientTest {
-
- @Test
- public void shouldReturnSampleDataContentWhenConnectViaSystemProxy() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/post"))
- .headers("Content-Type", "text/plain;charset=UTF-8")
- .POST(HttpRequest.BodyPublishers.ofString("Sample body"))
- .build();
-
-
- HttpResponse response = HttpClient.newBuilder()
- .proxy(ProxySelector.getDefault())
- .build()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertThat(response.body(), containsString("Sample body"));
- }
-
- @Test
- public void shouldNotFollowRedirectWhenSetToDefaultNever() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("http://stackoverflow.com"))
- .version(HttpClient.Version.HTTP_1_1)
- .GET()
- .build();
- HttpResponse response = HttpClient.newBuilder()
- .build()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_MOVED_PERM));
- assertThat(response.body(), containsString("https://stackoverflow.com/"));
- }
-
- @Test
- public void shouldFollowRedirectWhenSetToAlways() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("http://stackoverflow.com"))
- .version(HttpClient.Version.HTTP_1_1)
- .GET()
- .build();
- HttpResponse response = HttpClient.newBuilder()
- .followRedirects(HttpClient.Redirect.ALWAYS)
- .build()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertThat(response.request()
- .uri()
- .toString(), equalTo("https://stackoverflow.com/"));
- }
-
- @Test
- public void shouldReturnOKStatusForAuthenticatedAccess() throws URISyntaxException, IOException, InterruptedException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/basic-auth"))
- .GET()
- .build();
- HttpResponse response = HttpClient.newBuilder()
- .authenticator(new Authenticator() {
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication("postman", "password".toCharArray());
- }
- })
- .build()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- }
-
- @Test
- public void shouldSendRequestAsync() throws URISyntaxException, InterruptedException, ExecutionException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/post"))
- .headers("Content-Type", "text/plain;charset=UTF-8")
- .POST(HttpRequest.BodyPublishers.ofString("Sample body"))
- .build();
- CompletableFuture> response = HttpClient.newBuilder()
- .build()
- .sendAsync(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.get()
- .statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- }
-
- @Test
- public void shouldUseJustTwoThreadWhenProcessingSendAsyncRequest() throws URISyntaxException, InterruptedException, ExecutionException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/get"))
- .GET()
- .build();
-
- ExecutorService executorService = Executors.newFixedThreadPool(2);
-
- CompletableFuture> response1 = HttpClient.newBuilder()
- .executor(executorService)
- .build()
- .sendAsync(request, HttpResponse.BodyHandlers.ofString());
-
- CompletableFuture> response2 = HttpClient.newBuilder()
- .executor(executorService)
- .build()
- .sendAsync(request, HttpResponse.BodyHandlers.ofString());
-
- CompletableFuture> response3 = HttpClient.newBuilder()
- .executor(executorService)
- .build()
- .sendAsync(request, HttpResponse.BodyHandlers.ofString());
-
- CompletableFuture.allOf(response1, response2, response3)
- .join();
-
- assertThat(response1.get()
- .statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertThat(response2.get()
- .statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertThat(response3.get()
- .statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- }
-
- @Test
- public void shouldNotStoreCookieWhenPolicyAcceptNone() throws URISyntaxException, IOException, InterruptedException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/get"))
- .GET()
- .build();
-
- HttpClient httpClient = HttpClient.newBuilder()
- .cookieHandler(new CookieManager(null, CookiePolicy.ACCEPT_NONE))
- .build();
-
- httpClient.send(request, HttpResponse.BodyHandlers.ofString());
-
- assertTrue(httpClient.cookieHandler()
- .isPresent());
- }
-
- @Test
- public void shouldStoreCookieWhenPolicyAcceptAll() throws URISyntaxException, IOException, InterruptedException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/get"))
- .GET()
- .build();
-
- HttpClient httpClient = HttpClient.newBuilder()
- .cookieHandler(new CookieManager(null, CookiePolicy.ACCEPT_ALL))
- .build();
-
- httpClient.send(request, HttpResponse.BodyHandlers.ofString());
-
- assertTrue(httpClient.cookieHandler()
- .isPresent());
- }
-
- @Test
- public void shouldProcessMultipleRequestViaStream() throws URISyntaxException, ExecutionException, InterruptedException {
- List targets = Arrays.asList(new URI("https://postman-echo.com/get?foo1=bar1"), new URI("https://postman-echo.com/get?foo2=bar2"));
-
- HttpClient client = HttpClient.newHttpClient();
-
- List> futures = targets.stream()
- .map(target -> client.sendAsync(HttpRequest.newBuilder(target)
- .GET()
- .build(), HttpResponse.BodyHandlers.ofString())
- .thenApply(response -> response.body()))
- .collect(Collectors.toList());
-
- CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
- .join();
-
- if (futures.get(0)
- .get()
- .contains("foo1")) {
- assertThat(futures.get(0)
- .get(), containsString("bar1"));
- assertThat(futures.get(1)
- .get(), containsString("bar2"));
- } else {
- assertThat(futures.get(1)
- .get(), containsString("bar2"));
- assertThat(futures.get(1)
- .get(), containsString("bar1"));
- }
-
- }
-
- @Test
- public void completeExceptionallyExample() {
- CompletableFuture cf = CompletableFuture.completedFuture("message").thenApplyAsync(String::toUpperCase,
- CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS));
- CompletableFuture exceptionHandler = cf.handle((s, th) -> { return (th != null) ? "message upon cancel" : ""; });
- cf.completeExceptionally(new RuntimeException("completed exceptionally"));
- assertTrue("Was not completed exceptionally", cf.isCompletedExceptionally());
- try {
- cf.join();
- fail("Should have thrown an exception");
- } catch (CompletionException ex) { // just for testing
- assertEquals("completed exceptionally", ex.getCause().getMessage());
- }
-
- assertEquals("message upon cancel", exceptionHandler.join());
- }
-
-}
+package com.baeldung.java11.httpclient.test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.net.Authenticator;
+import java.net.CookieManager;
+import java.net.CookiePolicy;
+import java.net.HttpURLConnection;
+import java.net.PasswordAuthentication;
+import java.net.ProxySelector;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodyHandlers;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+import org.junit.jupiter.api.Test;
+
+public class HttpClientTest {
+
+ @Test
+ public void shouldReturnSampleDataContentWhenConnectViaSystemProxy() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/post"))
+ .headers("Content-Type", "text/plain;charset=UTF-8")
+ .POST(HttpRequest.BodyPublishers.ofString("Sample body"))
+ .build();
+
+
+ HttpResponse response = HttpClient.newBuilder()
+ .proxy(ProxySelector.getDefault())
+ .build()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertThat(response.body(), containsString("Sample body"));
+ }
+
+ @Test
+ public void shouldNotFollowRedirectWhenSetToDefaultNever() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("http://stackoverflow.com"))
+ .version(HttpClient.Version.HTTP_1_1)
+ .GET()
+ .build();
+ HttpResponse response = HttpClient.newBuilder()
+ .build()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_MOVED_PERM));
+ assertThat(response.body(), containsString("https://stackoverflow.com/"));
+ }
+
+ @Test
+ public void shouldFollowRedirectWhenSetToAlways() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("http://stackoverflow.com"))
+ .version(HttpClient.Version.HTTP_1_1)
+ .GET()
+ .build();
+ HttpResponse response = HttpClient.newBuilder()
+ .followRedirects(HttpClient.Redirect.ALWAYS)
+ .build()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertThat(response.request()
+ .uri()
+ .toString(), equalTo("https://stackoverflow.com/"));
+ }
+
+ @Test
+ public void shouldReturnOKStatusForAuthenticatedAccess() throws URISyntaxException, IOException, InterruptedException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/basic-auth"))
+ .GET()
+ .build();
+ HttpResponse response = HttpClient.newBuilder()
+ .authenticator(new Authenticator() {
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication("postman", "password".toCharArray());
+ }
+ })
+ .build()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ }
+
+ @Test
+ public void shouldSendRequestAsync() throws URISyntaxException, InterruptedException, ExecutionException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/post"))
+ .headers("Content-Type", "text/plain;charset=UTF-8")
+ .POST(HttpRequest.BodyPublishers.ofString("Sample body"))
+ .build();
+ CompletableFuture> response = HttpClient.newBuilder()
+ .build()
+ .sendAsync(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.get()
+ .statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ }
+
+ @Test
+ public void shouldUseJustTwoThreadWhenProcessingSendAsyncRequest() throws URISyntaxException, InterruptedException, ExecutionException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/get"))
+ .GET()
+ .build();
+
+ ExecutorService executorService = Executors.newFixedThreadPool(2);
+
+ CompletableFuture> response1 = HttpClient.newBuilder()
+ .executor(executorService)
+ .build()
+ .sendAsync(request, HttpResponse.BodyHandlers.ofString());
+
+ CompletableFuture> response2 = HttpClient.newBuilder()
+ .executor(executorService)
+ .build()
+ .sendAsync(request, HttpResponse.BodyHandlers.ofString());
+
+ CompletableFuture> response3 = HttpClient.newBuilder()
+ .executor(executorService)
+ .build()
+ .sendAsync(request, HttpResponse.BodyHandlers.ofString());
+
+ CompletableFuture.allOf(response1, response2, response3)
+ .join();
+
+ assertThat(response1.get()
+ .statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertThat(response2.get()
+ .statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertThat(response3.get()
+ .statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ }
+
+ @Test
+ public void shouldNotStoreCookieWhenPolicyAcceptNone() throws URISyntaxException, IOException, InterruptedException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/get"))
+ .GET()
+ .build();
+
+ HttpClient httpClient = HttpClient.newBuilder()
+ .cookieHandler(new CookieManager(null, CookiePolicy.ACCEPT_NONE))
+ .build();
+
+ httpClient.send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertTrue(httpClient.cookieHandler()
+ .isPresent());
+ }
+
+ @Test
+ public void shouldStoreCookieWhenPolicyAcceptAll() throws URISyntaxException, IOException, InterruptedException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/get"))
+ .GET()
+ .build();
+
+ HttpClient httpClient = HttpClient.newBuilder()
+ .cookieHandler(new CookieManager(null, CookiePolicy.ACCEPT_ALL))
+ .build();
+
+ httpClient.send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertTrue(httpClient.cookieHandler()
+ .isPresent());
+ }
+
+ @Test
+ public void shouldProcessMultipleRequestViaStream() throws URISyntaxException, ExecutionException, InterruptedException {
+ List targets = Arrays.asList(new URI("https://postman-echo.com/get?foo1=bar1"), new URI("https://postman-echo.com/get?foo2=bar2"));
+
+ HttpClient client = HttpClient.newHttpClient();
+
+ List> futures = targets.stream()
+ .map(target -> client.sendAsync(HttpRequest.newBuilder(target)
+ .GET()
+ .build(), HttpResponse.BodyHandlers.ofString())
+ .thenApply(response -> response.body()))
+ .collect(Collectors.toList());
+
+ CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
+ .join();
+
+ if (futures.get(0)
+ .get()
+ .contains("foo1")) {
+ assertThat(futures.get(0)
+ .get(), containsString("bar1"));
+ assertThat(futures.get(1)
+ .get(), containsString("bar2"));
+ } else {
+ assertThat(futures.get(1)
+ .get(), containsString("bar2"));
+ assertThat(futures.get(1)
+ .get(), containsString("bar1"));
+ }
+
+ }
+
+ @Test
+ public void completeExceptionallyExample() {
+ CompletableFuture cf = CompletableFuture.completedFuture("message").thenApplyAsync(String::toUpperCase,
+ CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS));
+ CompletableFuture exceptionHandler = cf.handle((s, th) -> { return (th != null) ? "message upon cancel" : ""; });
+ cf.completeExceptionally(new RuntimeException("completed exceptionally"));
+ assertTrue("Was not completed exceptionally", cf.isCompletedExceptionally());
+ try {
+ cf.join();
+ fail("Should have thrown an exception");
+ } catch (CompletionException ex) { // just for testing
+ assertEquals("completed exceptionally", ex.getCause().getMessage());
+ }
+
+ assertEquals("message upon cancel", exceptionHandler.join());
+ }
+
+}
diff --git a/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java b/core-java-modules/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java
similarity index 97%
rename from core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java
rename to core-java-modules/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java
index 7d138bd8d5..274d3a93fc 100644
--- a/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java
+++ b/core-java-modules/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpRequestTest.java
@@ -1,168 +1,168 @@
-package com.baeldung.java11.httpclient.test;
-
-import static java.time.temporal.ChronoUnit.SECONDS;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.http.HttpClient;
-import java.net.http.HttpRequest;
-import java.net.http.HttpResponse;
-import java.nio.file.Paths;
-import java.security.NoSuchAlgorithmException;
-import java.time.Duration;
-
-import org.junit.Test;
-
-public class HttpRequestTest {
-
- @Test
- public void shouldReturnStatusOKWhenSendGetRequest() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/get"))
- .GET()
- .build();
-
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- }
-
- @Test
- public void shouldUseHttp2WhenWebsiteUsesHttp2() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://stackoverflow.com"))
- .version(HttpClient.Version.HTTP_2)
- .GET()
- .build();
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertThat(response.version(), equalTo(HttpClient.Version.HTTP_2));
- }
-
- @Test
- public void shouldFallbackToHttp1_1WhenWebsiteDoesNotUseHttp2() throws IOException, InterruptedException, URISyntaxException, NoSuchAlgorithmException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/get"))
- .version(HttpClient.Version.HTTP_2)
- .GET()
- .build();
-
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.version(), equalTo(HttpClient.Version.HTTP_1_1));
- }
-
- @Test
- public void shouldReturnStatusOKWhenSendGetRequestWithDummyHeaders() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/get"))
- .headers("key1", "value1", "key2", "value2")
- .GET()
- .build();
-
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- }
-
- @Test
- public void shouldReturnStatusOKWhenSendGetRequestTimeoutSet() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/get"))
- .timeout(Duration.of(10, SECONDS))
- .GET()
- .build();
-
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- }
-
- @Test
- public void shouldReturnNoContentWhenPostWithNoBody() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/post"))
- .POST(HttpRequest.BodyPublishers.noBody())
- .build();
-
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- }
-
- @Test
- public void shouldReturnSampleDataContentWhenPostWithBodyText() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/post"))
- .headers("Content-Type", "text/plain;charset=UTF-8")
- .POST(HttpRequest.BodyPublishers.ofString("Sample request body"))
- .build();
-
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertThat(response.body(), containsString("Sample request body"));
- }
-
- @Test
- public void shouldReturnSampleDataContentWhenPostWithInputStream() throws IOException, InterruptedException, URISyntaxException {
- byte[] sampleData = "Sample request body".getBytes();
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/post"))
- .headers("Content-Type", "text/plain;charset=UTF-8")
- .POST(HttpRequest.BodyPublishers.ofInputStream(() -> new ByteArrayInputStream(sampleData)))
- .build();
-
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertThat(response.body(), containsString("Sample request body"));
- }
-
- @Test
- public void shouldReturnSampleDataContentWhenPostWithByteArrayProcessorStream() throws IOException, InterruptedException, URISyntaxException {
- byte[] sampleData = "Sample request body".getBytes();
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/post"))
- .headers("Content-Type", "text/plain;charset=UTF-8")
- .POST(HttpRequest.BodyPublishers.ofByteArray(sampleData))
- .build();
-
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertThat(response.body(), containsString("Sample request body"));
- }
-
- @Test
- public void shouldReturnSampleDataContentWhenPostWithFileProcessorStream() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/post"))
- .headers("Content-Type", "text/plain;charset=UTF-8")
- .POST(HttpRequest.BodyPublishers.ofFile(Paths.get("src/test/resources/sample.txt")))
- .build();
-
- HttpResponse response = HttpClient.newHttpClient()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertThat(response.body(), containsString("Sample file content"));
- }
-
-}
+package com.baeldung.java11.httpclient.test;
+
+import static java.time.temporal.ChronoUnit.SECONDS;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.nio.file.Paths;
+import java.security.NoSuchAlgorithmException;
+import java.time.Duration;
+
+import org.junit.Test;
+
+public class HttpRequestTest {
+
+ @Test
+ public void shouldReturnStatusOKWhenSendGetRequest() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/get"))
+ .GET()
+ .build();
+
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ }
+
+ @Test
+ public void shouldUseHttp2WhenWebsiteUsesHttp2() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://stackoverflow.com"))
+ .version(HttpClient.Version.HTTP_2)
+ .GET()
+ .build();
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertThat(response.version(), equalTo(HttpClient.Version.HTTP_2));
+ }
+
+ @Test
+ public void shouldFallbackToHttp1_1WhenWebsiteDoesNotUseHttp2() throws IOException, InterruptedException, URISyntaxException, NoSuchAlgorithmException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/get"))
+ .version(HttpClient.Version.HTTP_2)
+ .GET()
+ .build();
+
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.version(), equalTo(HttpClient.Version.HTTP_1_1));
+ }
+
+ @Test
+ public void shouldReturnStatusOKWhenSendGetRequestWithDummyHeaders() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/get"))
+ .headers("key1", "value1", "key2", "value2")
+ .GET()
+ .build();
+
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ }
+
+ @Test
+ public void shouldReturnStatusOKWhenSendGetRequestTimeoutSet() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/get"))
+ .timeout(Duration.of(10, SECONDS))
+ .GET()
+ .build();
+
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ }
+
+ @Test
+ public void shouldReturnNoContentWhenPostWithNoBody() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/post"))
+ .POST(HttpRequest.BodyPublishers.noBody())
+ .build();
+
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ }
+
+ @Test
+ public void shouldReturnSampleDataContentWhenPostWithBodyText() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/post"))
+ .headers("Content-Type", "text/plain;charset=UTF-8")
+ .POST(HttpRequest.BodyPublishers.ofString("Sample request body"))
+ .build();
+
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertThat(response.body(), containsString("Sample request body"));
+ }
+
+ @Test
+ public void shouldReturnSampleDataContentWhenPostWithInputStream() throws IOException, InterruptedException, URISyntaxException {
+ byte[] sampleData = "Sample request body".getBytes();
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/post"))
+ .headers("Content-Type", "text/plain;charset=UTF-8")
+ .POST(HttpRequest.BodyPublishers.ofInputStream(() -> new ByteArrayInputStream(sampleData)))
+ .build();
+
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertThat(response.body(), containsString("Sample request body"));
+ }
+
+ @Test
+ public void shouldReturnSampleDataContentWhenPostWithByteArrayProcessorStream() throws IOException, InterruptedException, URISyntaxException {
+ byte[] sampleData = "Sample request body".getBytes();
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/post"))
+ .headers("Content-Type", "text/plain;charset=UTF-8")
+ .POST(HttpRequest.BodyPublishers.ofByteArray(sampleData))
+ .build();
+
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertThat(response.body(), containsString("Sample request body"));
+ }
+
+ @Test
+ public void shouldReturnSampleDataContentWhenPostWithFileProcessorStream() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/post"))
+ .headers("Content-Type", "text/plain;charset=UTF-8")
+ .POST(HttpRequest.BodyPublishers.ofFile(Paths.get("src/test/resources/sample.txt")))
+ .build();
+
+ HttpResponse response = HttpClient.newHttpClient()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertThat(response.body(), containsString("Sample file content"));
+ }
+
+}
diff --git a/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java b/core-java-modules/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java
similarity index 97%
rename from core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java
rename to core-java-modules/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java
index 78d86fbf4e..abbc0233c1 100644
--- a/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java
+++ b/core-java-modules/core-java-11/src/test/java/com/baeldung/java11/httpclient/test/HttpResponseTest.java
@@ -1,54 +1,54 @@
-package com.baeldung.java11.httpclient.test;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.http.HttpClient;
-import java.net.http.HttpRequest;
-import java.net.http.HttpResponse;
-
-import org.junit.Test;
-
-public class HttpResponseTest {
-
- @Test
- public void shouldReturnStatusOKWhenSendGetRequest() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("https://postman-echo.com/get"))
- .version(HttpClient.Version.HTTP_2)
- .GET()
- .build();
-
- HttpResponse response = HttpClient.newBuilder()
- .followRedirects(HttpClient.Redirect.NORMAL)
- .build()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
- assertNotNull(response.body());
- }
-
- @Test
- public void shouldResponseURIDifferentThanRequestUIRWhenRedirect() throws IOException, InterruptedException, URISyntaxException {
- HttpRequest request = HttpRequest.newBuilder()
- .uri(new URI("http://stackoverflow.com"))
- .version(HttpClient.Version.HTTP_2)
- .GET()
- .build();
- HttpResponse response = HttpClient.newBuilder()
- .followRedirects(HttpClient.Redirect.NORMAL)
- .build()
- .send(request, HttpResponse.BodyHandlers.ofString());
-
- assertThat(request.uri()
- .toString(), equalTo("http://stackoverflow.com"));
- assertThat(response.uri()
- .toString(), equalTo("https://stackoverflow.com/"));
- }
-
-}
+package com.baeldung.java11.httpclient.test;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+
+import org.junit.Test;
+
+public class HttpResponseTest {
+
+ @Test
+ public void shouldReturnStatusOKWhenSendGetRequest() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("https://postman-echo.com/get"))
+ .version(HttpClient.Version.HTTP_2)
+ .GET()
+ .build();
+
+ HttpResponse response = HttpClient.newBuilder()
+ .followRedirects(HttpClient.Redirect.NORMAL)
+ .build()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
+ assertNotNull(response.body());
+ }
+
+ @Test
+ public void shouldResponseURIDifferentThanRequestUIRWhenRedirect() throws IOException, InterruptedException, URISyntaxException {
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(new URI("http://stackoverflow.com"))
+ .version(HttpClient.Version.HTTP_2)
+ .GET()
+ .build();
+ HttpResponse response = HttpClient.newBuilder()
+ .followRedirects(HttpClient.Redirect.NORMAL)
+ .build()
+ .send(request, HttpResponse.BodyHandlers.ofString());
+
+ assertThat(request.uri()
+ .toString(), equalTo("http://stackoverflow.com"));
+ assertThat(response.uri()
+ .toString(), equalTo("https://stackoverflow.com/"));
+ }
+
+}
diff --git a/core-java-11/src/test/java/com/baeldung/optional/OptionalUnitTest.java b/core-java-modules/core-java-11/src/test/java/com/baeldung/optional/OptionalUnitTest.java
similarity index 100%
rename from core-java-11/src/test/java/com/baeldung/optional/OptionalUnitTest.java
rename to core-java-modules/core-java-11/src/test/java/com/baeldung/optional/OptionalUnitTest.java
diff --git a/core-java-12/pom.xml b/core-java-modules/core-java-12/pom.xml
similarity index 97%
rename from core-java-12/pom.xml
rename to core-java-modules/core-java-12/pom.xml
index c5eec1a4bb..06c49a0021 100644
--- a/core-java-12/pom.xml
+++ b/core-java-modules/core-java-12/pom.xml
@@ -14,6 +14,7 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
+ ../../
diff --git a/core-java-12/src/test/java/com/baeldung/collectors/CollectorsUnitTest.java b/core-java-modules/core-java-12/src/test/java/com/baeldung/collectors/CollectorsUnitTest.java
similarity index 100%
rename from core-java-12/src/test/java/com/baeldung/collectors/CollectorsUnitTest.java
rename to core-java-modules/core-java-12/src/test/java/com/baeldung/collectors/CollectorsUnitTest.java
diff --git a/core-java-12/src/test/java/com/baeldung/switchExpression/SwitchUnitTest.java b/core-java-modules/core-java-12/src/test/java/com/baeldung/switchExpression/SwitchUnitTest.java
similarity index 100%
rename from core-java-12/src/test/java/com/baeldung/switchExpression/SwitchUnitTest.java
rename to core-java-modules/core-java-12/src/test/java/com/baeldung/switchExpression/SwitchUnitTest.java
diff --git a/core-java-8-2/.gitignore b/core-java-modules/core-java-8-2/.gitignore
similarity index 100%
rename from core-java-8-2/.gitignore
rename to core-java-modules/core-java-8-2/.gitignore
diff --git a/core-java-8-2/README.md b/core-java-modules/core-java-8-2/README.md
similarity index 100%
rename from core-java-8-2/README.md
rename to core-java-modules/core-java-8-2/README.md
diff --git a/core-java-8-2/pom.xml b/core-java-modules/core-java-8-2/pom.xml
similarity index 96%
rename from core-java-8-2/pom.xml
rename to core-java-modules/core-java-8-2/pom.xml
index 4692a0fca6..fbaf795b95 100644
--- a/core-java-8-2/pom.xml
+++ b/core-java-modules/core-java-8-2/pom.xml
@@ -14,7 +14,7 @@
com.baeldung
parent-java
0.0.1-SNAPSHOT
- ../parent-java
+ ../../parent-java
diff --git a/core-java-8-2/src/main/java/com/baeldung/jarArguments/JarExample.java b/core-java-modules/core-java-8-2/src/main/java/com/baeldung/jarArguments/JarExample.java
similarity index 100%
rename from core-java-8-2/src/main/java/com/baeldung/jarArguments/JarExample.java
rename to core-java-modules/core-java-8-2/src/main/java/com/baeldung/jarArguments/JarExample.java
diff --git a/core-java-8-2/src/main/java/com/baeldung/localization/App.java b/core-java-modules/core-java-8-2/src/main/java/com/baeldung/localization/App.java
similarity index 100%
rename from core-java-8-2/src/main/java/com/baeldung/localization/App.java
rename to core-java-modules/core-java-8-2/src/main/java/com/baeldung/localization/App.java
diff --git a/core-java-8-2/src/main/java/com/baeldung/localization/ICUFormat.java b/core-java-modules/core-java-8-2/src/main/java/com/baeldung/localization/ICUFormat.java
similarity index 100%
rename from core-java-8-2/src/main/java/com/baeldung/localization/ICUFormat.java
rename to core-java-modules/core-java-8-2/src/main/java/com/baeldung/localization/ICUFormat.java
diff --git a/core-java-8-2/src/main/java/com/baeldung/localization/JavaSEFormat.java b/core-java-modules/core-java-8-2/src/main/java/com/baeldung/localization/JavaSEFormat.java
similarity index 100%
rename from core-java-8-2/src/main/java/com/baeldung/localization/JavaSEFormat.java
rename to core-java-modules/core-java-8-2/src/main/java/com/baeldung/localization/JavaSEFormat.java
diff --git a/core-java-8-2/src/main/java/com/baeldung/localization/Localization.java b/core-java-modules/core-java-8-2/src/main/java/com/baeldung/localization/Localization.java
similarity index 100%
rename from core-java-8-2/src/main/java/com/baeldung/localization/Localization.java
rename to core-java-modules/core-java-8-2/src/main/java/com/baeldung/localization/Localization.java
diff --git a/core-java-8-2/src/main/resources/example_manifest.txt b/core-java-modules/core-java-8-2/src/main/resources/example_manifest.txt
similarity index 100%
rename from core-java-8-2/src/main/resources/example_manifest.txt
rename to core-java-modules/core-java-8-2/src/main/resources/example_manifest.txt
diff --git a/core-java-8-2/src/main/resources/formats_en.properties b/core-java-modules/core-java-8-2/src/main/resources/formats_en.properties
similarity index 100%
rename from core-java-8-2/src/main/resources/formats_en.properties
rename to core-java-modules/core-java-8-2/src/main/resources/formats_en.properties
diff --git a/core-java-8-2/src/main/resources/formats_fr.properties b/core-java-modules/core-java-8-2/src/main/resources/formats_fr.properties
similarity index 100%
rename from core-java-8-2/src/main/resources/formats_fr.properties
rename to core-java-modules/core-java-8-2/src/main/resources/formats_fr.properties
diff --git a/core-java-8-2/src/main/resources/formats_it.properties b/core-java-modules/core-java-8-2/src/main/resources/formats_it.properties
similarity index 100%
rename from core-java-8-2/src/main/resources/formats_it.properties
rename to core-java-modules/core-java-8-2/src/main/resources/formats_it.properties
diff --git a/core-java-8-2/src/main/resources/formats_pl.properties b/core-java-modules/core-java-8-2/src/main/resources/formats_pl.properties
similarity index 100%
rename from core-java-8-2/src/main/resources/formats_pl.properties
rename to core-java-modules/core-java-8-2/src/main/resources/formats_pl.properties
diff --git a/core-java-8-2/src/main/resources/messages_en.properties b/core-java-modules/core-java-8-2/src/main/resources/messages_en.properties
similarity index 100%
rename from core-java-8-2/src/main/resources/messages_en.properties
rename to core-java-modules/core-java-8-2/src/main/resources/messages_en.properties
diff --git a/core-java-8-2/src/main/resources/messages_fr.properties b/core-java-modules/core-java-8-2/src/main/resources/messages_fr.properties
similarity index 100%
rename from core-java-8-2/src/main/resources/messages_fr.properties
rename to core-java-modules/core-java-8-2/src/main/resources/messages_fr.properties
diff --git a/core-java-8-2/src/main/resources/messages_it.properties b/core-java-modules/core-java-8-2/src/main/resources/messages_it.properties
similarity index 100%
rename from core-java-8-2/src/main/resources/messages_it.properties
rename to core-java-modules/core-java-8-2/src/main/resources/messages_it.properties
diff --git a/core-java-8-2/src/main/resources/messages_pl.properties b/core-java-modules/core-java-8-2/src/main/resources/messages_pl.properties
similarity index 100%
rename from core-java-8-2/src/main/resources/messages_pl.properties
rename to core-java-modules/core-java-8-2/src/main/resources/messages_pl.properties
diff --git a/core-java-8-2/src/test/java/com/baeldung/localization/ICUFormatUnitTest.java b/core-java-modules/core-java-8-2/src/test/java/com/baeldung/localization/ICUFormatUnitTest.java
similarity index 100%
rename from core-java-8-2/src/test/java/com/baeldung/localization/ICUFormatUnitTest.java
rename to core-java-modules/core-java-8-2/src/test/java/com/baeldung/localization/ICUFormatUnitTest.java
diff --git a/core-java-8/.gitignore b/core-java-modules/core-java-8/.gitignore
similarity index 100%
rename from core-java-8/.gitignore
rename to core-java-modules/core-java-8/.gitignore
diff --git a/core-java-8/README.md b/core-java-modules/core-java-8/README.md
similarity index 100%
rename from core-java-8/README.md
rename to core-java-modules/core-java-8/README.md
diff --git a/core-java-8/pom.xml b/core-java-modules/core-java-8/pom.xml
similarity index 96%
rename from core-java-8/pom.xml
rename to core-java-modules/core-java-8/pom.xml
index b63afef7d4..c09c970e07 100644
--- a/core-java-8/pom.xml
+++ b/core-java-modules/core-java-8/pom.xml
@@ -1,199 +1,199 @@
-
- 4.0.0
- com.baeldung
- core-java-8
- 0.1.0-SNAPSHOT
- core-java-8
- jar
-
-
- com.baeldung
- parent-java
- 0.0.1-SNAPSHOT
- ../parent-java
-
-
-
-
- org.apache.commons
- commons-collections4
- ${commons-collections4.version}
-
-
- commons-io
- commons-io
- ${commons-io.version}
-
-
- org.apache.commons
- commons-lang3
- ${commons-lang3.version}
-
-
- org.apache.commons
- commons-math3
- ${commons-math3.version}
-
-
- log4j
- log4j
- ${log4j.version}
-
-
- commons-codec
- commons-codec
- ${commons-codec.version}
-
-
- org.projectlombok
- lombok
- ${lombok.version}
- provided
-
-
-
- org.assertj
- assertj-core
- ${assertj.version}
- test
-
-
- com.jayway.awaitility
- awaitility
- ${avaitility.version}
- test
-
-
- org.openjdk.jmh
- jmh-core
- ${jmh-core.version}
-
-
- org.openjdk.jmh
- jmh-generator-annprocess
- ${jmh-generator.version}
-
-
- org.openjdk.jmh
- jmh-generator-bytecode
- ${jmh-generator.version}
-
-
- com.codepoetics
- protonpack
- ${protonpack.version}
-
-
- io.vavr
- vavr
- ${vavr.version}
-
-
- joda-time
- joda-time
- ${joda.version}
-
-
- org.aspectj
- aspectjrt
- ${asspectj.version}
-
-
- org.aspectj
- aspectjweaver
- ${asspectj.version}
-
-
- org.powermock
- powermock-module-junit4
- ${powermock.version}
- test
-
-
- org.powermock
- powermock-api-mockito2
- ${powermock.version}
- test
-
-
- org.jmockit
- jmockit
- ${jmockit.version}
- test
-
-
-
-
- core-java-8
-
-
- src/main/resources
- true
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
-
- 1.8
- -parameters
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
- ${spring-boot-maven-plugin.version}
-
-
-
- repackage
-
-
- spring-boot
- org.baeldung.executable.ExecutableMavenJar
-
-
-
-
-
- maven-surefire-plugin
- ${maven-surefire-plugin.version}
-
-
- -javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
-
- true
-
-
-
-
-
-
-
- 3.5
- 3.6.1
- 4.1
- 4.01
- 1.10
- 0.9.0
- 1.13
- 2.10
-
- 3.6.1
- 1.8.9
- 2.0.0-RC.4
- 1.44
- 1.7.0
- 1.19
- 1.19
- 2.0.4.RELEASE
-
- 3.8.0
- 2.22.1
-
-
+
+ 4.0.0
+ com.baeldung
+ core-java-8
+ 0.1.0-SNAPSHOT
+ core-java-8
+ jar
+
+
+ com.baeldung
+ parent-java
+ 0.0.1-SNAPSHOT
+ ../../parent-java
+
+
+
+
+ org.apache.commons
+ commons-collections4
+ ${commons-collections4.version}
+
+
+ commons-io
+ commons-io
+ ${commons-io.version}
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
+ org.apache.commons
+ commons-math3
+ ${commons-math3.version}
+
+
+ log4j
+ log4j
+ ${log4j.version}
+
+
+ commons-codec
+ commons-codec
+ ${commons-codec.version}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+
+ org.assertj
+ assertj-core
+ ${assertj.version}
+ test
+
+
+ com.jayway.awaitility
+ awaitility
+ ${avaitility.version}
+ test
+
+
+ org.openjdk.jmh
+ jmh-core
+ ${jmh-core.version}
+
+
+ org.openjdk.jmh
+ jmh-generator-annprocess
+ ${jmh-generator.version}
+
+
+ org.openjdk.jmh
+ jmh-generator-bytecode
+ ${jmh-generator.version}
+
+
+ com.codepoetics
+ protonpack
+ ${protonpack.version}
+
+
+ io.vavr
+ vavr
+ ${vavr.version}
+
+
+ joda-time
+ joda-time
+ ${joda.version}
+
+
+ org.aspectj
+ aspectjrt
+ ${asspectj.version}
+
+
+ org.aspectj
+ aspectjweaver
+ ${asspectj.version}
+
+
+ org.powermock
+ powermock-module-junit4
+ ${powermock.version}
+ test
+
+
+ org.powermock
+ powermock-api-mockito2
+ ${powermock.version}
+ test
+
+
+ org.jmockit
+ jmockit
+ ${jmockit.version}
+ test
+
+
+
+
+ core-java-8
+
+
+ src/main/resources
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+ 1.8
+ -parameters
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot-maven-plugin.version}
+
+
+
+ repackage
+
+
+ spring-boot
+ org.baeldung.executable.ExecutableMavenJar
+
+
+
+
+
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+
+ -javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
+
+ true
+
+
+
+
+
+
+
+ 3.5
+ 3.6.1
+ 4.1
+ 4.01
+ 1.10
+ 0.9.0
+ 1.13
+ 2.10
+
+ 3.6.1
+ 1.8.9
+ 2.0.0-RC.4
+ 1.44
+ 1.7.0
+ 1.19
+ 1.19
+ 2.0.4.RELEASE
+
+ 3.8.0
+ 2.22.1
+
+
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/ClassWithAnnotation.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/ClassWithAnnotation.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/ClassWithAnnotation.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/ClassWithAnnotation.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/ClassWithDeprecatedMethod.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/ClassWithDeprecatedMethod.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/ClassWithDeprecatedMethod.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/ClassWithDeprecatedMethod.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/ClassWithSafeVarargs.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/ClassWithSafeVarargs.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/ClassWithSafeVarargs.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/ClassWithSafeVarargs.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/ClassWithSuppressWarnings.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/ClassWithSuppressWarnings.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/ClassWithSuppressWarnings.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/ClassWithSuppressWarnings.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/IntConsumer.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/IntConsumer.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/IntConsumer.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/IntConsumer.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/Interval.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/Interval.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/Interval.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/Interval.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/IntervalUsage.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/IntervalUsage.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/IntervalUsage.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/IntervalUsage.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/Intervals.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/Intervals.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/Intervals.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/Intervals.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/MyAnnotation.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/MyAnnotation.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/MyAnnotation.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/MyAnnotation.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/MyAnnotationTarget.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/MyAnnotationTarget.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/MyAnnotationTarget.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/MyAnnotationTarget.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/MyOperation.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/MyOperation.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/MyOperation.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/MyOperation.java
diff --git a/core-java-8/src/main/java/com/baeldung/annotations/MyOperationImpl.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/MyOperationImpl.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/annotations/MyOperationImpl.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/annotations/MyOperationImpl.java
diff --git a/core-java-8/src/main/java/com/baeldung/aspect/ChangeCallsToCurrentTimeInMillisMethod.aj b/core-java-modules/core-java-8/src/main/java/com/baeldung/aspect/ChangeCallsToCurrentTimeInMillisMethod.aj
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/aspect/ChangeCallsToCurrentTimeInMillisMethod.aj
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/aspect/ChangeCallsToCurrentTimeInMillisMethod.aj
diff --git a/core-java-8/src/main/java/com/baeldung/customannotations/Init.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/Init.java
similarity index 95%
rename from core-java-8/src/main/java/com/baeldung/customannotations/Init.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/Init.java
index 265e7ba1d6..c27d7d7980 100644
--- a/core-java-8/src/main/java/com/baeldung/customannotations/Init.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/Init.java
@@ -1,13 +1,13 @@
-package com.baeldung.customannotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-@Retention(RUNTIME)
-@Target(METHOD)
-public @interface Init {
-
-}
+package com.baeldung.customannotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target(METHOD)
+public @interface Init {
+
+}
diff --git a/core-java-8/src/main/java/com/baeldung/customannotations/JsonElement.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/JsonElement.java
similarity index 96%
rename from core-java-8/src/main/java/com/baeldung/customannotations/JsonElement.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/JsonElement.java
index e41a5b1e30..3c953f9081 100644
--- a/core-java-8/src/main/java/com/baeldung/customannotations/JsonElement.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/JsonElement.java
@@ -1,13 +1,13 @@
-package com.baeldung.customannotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-@Retention(RUNTIME)
-@Target({ FIELD })
-public @interface JsonElement {
- public String key() default "";
-}
+package com.baeldung.customannotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target({ FIELD })
+public @interface JsonElement {
+ public String key() default "";
+}
diff --git a/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializable.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializable.java
similarity index 95%
rename from core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializable.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializable.java
index 48eeb09a1b..f6feba1b7b 100644
--- a/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializable.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializable.java
@@ -1,13 +1,13 @@
-package com.baeldung.customannotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-@Retention(RUNTIME)
-@Target(TYPE)
-public @interface JsonSerializable {
-
-}
+package com.baeldung.customannotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target(TYPE)
+public @interface JsonSerializable {
+
+}
diff --git a/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializationException.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializationException.java
similarity index 96%
rename from core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializationException.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializationException.java
index f2c29855ac..544d1311aa 100644
--- a/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializationException.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/JsonSerializationException.java
@@ -1,10 +1,10 @@
-package com.baeldung.customannotations;
-
-public class JsonSerializationException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public JsonSerializationException(String message) {
- super(message);
- }
-}
+package com.baeldung.customannotations;
+
+public class JsonSerializationException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public JsonSerializationException(String message) {
+ super(message);
+ }
+}
diff --git a/core-java-8/src/main/java/com/baeldung/customannotations/ObjectToJsonConverter.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/ObjectToJsonConverter.java
similarity index 97%
rename from core-java-8/src/main/java/com/baeldung/customannotations/ObjectToJsonConverter.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/ObjectToJsonConverter.java
index dd126be8ed..b809ea0d1d 100644
--- a/core-java-8/src/main/java/com/baeldung/customannotations/ObjectToJsonConverter.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/ObjectToJsonConverter.java
@@ -1,67 +1,67 @@
-package com.baeldung.customannotations;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-public class ObjectToJsonConverter {
- public String convertToJson(Object object) throws JsonSerializationException {
- try {
-
- checkIfSerializable(object);
- initializeObject(object);
- return getJsonString(object);
-
- } catch (Exception e) {
- throw new JsonSerializationException(e.getMessage());
- }
- }
-
- private void checkIfSerializable(Object object) {
- if (Objects.isNull(object)) {
- throw new JsonSerializationException("Can't serialize a null object");
- }
-
- Class> clazz = object.getClass();
- if (!clazz.isAnnotationPresent(JsonSerializable.class)) {
- throw new JsonSerializationException("The class " + clazz.getSimpleName() + " is not annotated with JsonSerializable");
- }
- }
-
- private void initializeObject(Object object) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- Class> clazz = object.getClass();
- for (Method method : clazz.getDeclaredMethods()) {
- if (method.isAnnotationPresent(Init.class)) {
- method.setAccessible(true);
- method.invoke(object);
- }
- }
- }
-
- private String getJsonString(Object object) throws IllegalArgumentException, IllegalAccessException {
- Class> clazz = object.getClass();
- Map jsonElementsMap = new HashMap<>();
- for (Field field : clazz.getDeclaredFields()) {
- field.setAccessible(true);
- if (field.isAnnotationPresent(JsonElement.class)) {
- jsonElementsMap.put(getKey(field), (String) field.get(object));
- }
- }
-
- String jsonString = jsonElementsMap.entrySet()
- .stream()
- .map(entry -> "\"" + entry.getKey() + "\":\"" + entry.getValue() + "\"")
- .collect(Collectors.joining(","));
- return "{" + jsonString + "}";
- }
-
- private String getKey(Field field) {
- String value = field.getAnnotation(JsonElement.class)
- .key();
- return value.isEmpty() ? field.getName() : value;
- }
-}
+package com.baeldung.customannotations;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+public class ObjectToJsonConverter {
+ public String convertToJson(Object object) throws JsonSerializationException {
+ try {
+
+ checkIfSerializable(object);
+ initializeObject(object);
+ return getJsonString(object);
+
+ } catch (Exception e) {
+ throw new JsonSerializationException(e.getMessage());
+ }
+ }
+
+ private void checkIfSerializable(Object object) {
+ if (Objects.isNull(object)) {
+ throw new JsonSerializationException("Can't serialize a null object");
+ }
+
+ Class> clazz = object.getClass();
+ if (!clazz.isAnnotationPresent(JsonSerializable.class)) {
+ throw new JsonSerializationException("The class " + clazz.getSimpleName() + " is not annotated with JsonSerializable");
+ }
+ }
+
+ private void initializeObject(Object object) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ Class> clazz = object.getClass();
+ for (Method method : clazz.getDeclaredMethods()) {
+ if (method.isAnnotationPresent(Init.class)) {
+ method.setAccessible(true);
+ method.invoke(object);
+ }
+ }
+ }
+
+ private String getJsonString(Object object) throws IllegalArgumentException, IllegalAccessException {
+ Class> clazz = object.getClass();
+ Map jsonElementsMap = new HashMap<>();
+ for (Field field : clazz.getDeclaredFields()) {
+ field.setAccessible(true);
+ if (field.isAnnotationPresent(JsonElement.class)) {
+ jsonElementsMap.put(getKey(field), (String) field.get(object));
+ }
+ }
+
+ String jsonString = jsonElementsMap.entrySet()
+ .stream()
+ .map(entry -> "\"" + entry.getKey() + "\":\"" + entry.getValue() + "\"")
+ .collect(Collectors.joining(","));
+ return "{" + jsonString + "}";
+ }
+
+ private String getKey(Field field) {
+ String value = field.getAnnotation(JsonElement.class)
+ .key();
+ return value.isEmpty() ? field.getName() : value;
+ }
+}
diff --git a/core-java-8/src/main/java/com/baeldung/customannotations/Person.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/Person.java
similarity index 95%
rename from core-java-8/src/main/java/com/baeldung/customannotations/Person.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/Person.java
index 5db1a7f279..ba702d6d76 100644
--- a/core-java-8/src/main/java/com/baeldung/customannotations/Person.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/customannotations/Person.java
@@ -1,66 +1,66 @@
-package com.baeldung.customannotations;
-
-@JsonSerializable
-public class Person {
- @JsonElement
- private String firstName;
- @JsonElement
- private String lastName;
- @JsonElement(key = "personAge")
- private String age;
-
- private String address;
-
- public Person(String firstName, String lastName) {
- super();
- this.firstName = firstName;
- this.lastName = lastName;
- }
-
- public Person(String firstName, String lastName, String age) {
- this.firstName = firstName;
- this.lastName = lastName;
- this.age = age;
- }
-
- @Init
- private void initNames() {
- this.firstName = this.firstName.substring(0, 1)
- .toUpperCase() + this.firstName.substring(1);
- this.lastName = this.lastName.substring(0, 1)
- .toUpperCase() + this.lastName.substring(1);
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getAge() {
- return age;
- }
-
- public void setAge(String age) {
- this.age = age;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
-}
+package com.baeldung.customannotations;
+
+@JsonSerializable
+public class Person {
+ @JsonElement
+ private String firstName;
+ @JsonElement
+ private String lastName;
+ @JsonElement(key = "personAge")
+ private String age;
+
+ private String address;
+
+ public Person(String firstName, String lastName) {
+ super();
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ public Person(String firstName, String lastName, String age) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.age = age;
+ }
+
+ @Init
+ private void initNames() {
+ this.firstName = this.firstName.substring(0, 1)
+ .toUpperCase() + this.firstName.substring(1);
+ this.lastName = this.lastName.substring(0, 1)
+ .toUpperCase() + this.lastName.substring(1);
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getAge() {
+ return age;
+ }
+
+ public void setAge(String age) {
+ this.age = age;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+}
diff --git a/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/application/Application.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/application/Application.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/application/Application.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/application/Application.java
diff --git a/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Alarm.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Alarm.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Alarm.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Alarm.java
diff --git a/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Car.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Car.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Car.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Car.java
diff --git a/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Motorbike.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Motorbike.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Motorbike.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Motorbike.java
diff --git a/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/MultiAlarmCar.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/MultiAlarmCar.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/MultiAlarmCar.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/MultiAlarmCar.java
diff --git a/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Vehicle.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Vehicle.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Vehicle.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/defaultstaticinterfacemethods/model/Vehicle.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java
diff --git a/core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappers.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappers.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappers.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappers.java
diff --git a/core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/ThrowingConsumer.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/ThrowingConsumer.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/ThrowingConsumer.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/ThrowingConsumer.java
diff --git a/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Bar.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Bar.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Bar.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Bar.java
diff --git a/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Baz.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Baz.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Baz.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Baz.java
diff --git a/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Foo.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Foo.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Foo.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Foo.java
diff --git a/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java
diff --git a/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Processor.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Processor.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Processor.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/Processor.java
diff --git a/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/ProcessorImpl.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/ProcessorImpl.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java8/lambda/tips/ProcessorImpl.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/ProcessorImpl.java
diff --git a/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/UseFoo.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/UseFoo.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java8/lambda/tips/UseFoo.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java8/lambda/tips/UseFoo.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Address.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/Address.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/Address.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/Address.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/User.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/User.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/User.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/User.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPost.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPost.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPost.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPost.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPostType.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPostType.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPostType.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPostType.java
diff --git a/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java
diff --git a/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java
diff --git a/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java
diff --git a/core-java-8/src/main/java/com/baeldung/optional/Modem.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/optional/Modem.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/optional/Modem.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/optional/Modem.java
diff --git a/core-java-8/src/main/java/com/baeldung/optional/OrElseAndOrElseGet.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/optional/OrElseAndOrElseGet.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/optional/OrElseAndOrElseGet.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/optional/OrElseAndOrElseGet.java
diff --git a/core-java-8/src/main/java/com/baeldung/optional/OrElseAndOrElseGetBenchmarkRunner.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/optional/OrElseAndOrElseGetBenchmarkRunner.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/optional/OrElseAndOrElseGetBenchmarkRunner.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/optional/OrElseAndOrElseGetBenchmarkRunner.java
diff --git a/core-java-8/src/main/java/com/baeldung/optional/Person.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/optional/Person.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/optional/Person.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/optional/Person.java
diff --git a/core-java-8/src/main/java/com/baeldung/optional/PersonRepository.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/optional/PersonRepository.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/optional/PersonRepository.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/optional/PersonRepository.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/BenchmarkRunner.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/BenchmarkRunner.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/BenchmarkRunner.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/BenchmarkRunner.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/BooleanPrimitiveLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/BooleanPrimitiveLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/BooleanPrimitiveLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/BooleanPrimitiveLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/BooleanWrapperLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/BooleanWrapperLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/BooleanWrapperLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/BooleanWrapperLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/BytePrimitiveLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/BytePrimitiveLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/BytePrimitiveLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/BytePrimitiveLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/ByteWrapperLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/ByteWrapperLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/ByteWrapperLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/ByteWrapperLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/CharPrimitiveLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/CharPrimitiveLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/CharPrimitiveLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/CharPrimitiveLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/CharacterWrapperLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/CharacterWrapperLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/CharacterWrapperLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/CharacterWrapperLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/DoublePrimitiveLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/DoublePrimitiveLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/DoublePrimitiveLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/DoublePrimitiveLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/DoubleWrapperLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/DoubleWrapperLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/DoubleWrapperLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/DoubleWrapperLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/FloatPrimitiveLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/FloatPrimitiveLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/FloatPrimitiveLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/FloatPrimitiveLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/FloatWrapperLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/FloatWrapperLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/FloatWrapperLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/FloatWrapperLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/IntPrimitiveLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/IntPrimitiveLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/IntPrimitiveLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/IntPrimitiveLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/IntegerWrapperLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/IntegerWrapperLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/IntegerWrapperLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/IntegerWrapperLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/LongPrimitiveLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/LongPrimitiveLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/LongPrimitiveLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/LongPrimitiveLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/LongWrapperLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/LongWrapperLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/LongWrapperLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/LongWrapperLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/Lookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/Lookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/Lookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/Lookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/ShortPrimitiveLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/ShortPrimitiveLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/ShortPrimitiveLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/ShortPrimitiveLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/primitive/ShortWrapperLookup.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/ShortWrapperLookup.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/primitive/ShortWrapperLookup.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/primitive/ShortWrapperLookup.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddCommand.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddCommand.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/AddCommand.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddCommand.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddRule.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddRule.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/AddRule.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddRule.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Addition.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Addition.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Addition.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Addition.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Calculator.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Calculator.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Calculator.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Calculator.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Command.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Command.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Command.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Command.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Division.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Division.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Division.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Division.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Expression.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Expression.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Expression.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Expression.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Modulo.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Modulo.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Modulo.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Modulo.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Multiplication.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Multiplication.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Multiplication.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Multiplication.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operation.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operation.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Operation.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operation.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operator.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operator.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Operator.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operator.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/OperatorFactory.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/OperatorFactory.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/OperatorFactory.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/OperatorFactory.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Result.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Result.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Result.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Result.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Rule.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Rule.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Rule.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Rule.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/RuleEngine.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/RuleEngine.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/RuleEngine.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/RuleEngine.java
diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Subtraction.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Subtraction.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/reducingIfElse/Subtraction.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reducingIfElse/Subtraction.java
diff --git a/core-java-8/src/main/java/com/baeldung/reflect/Person.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/reflect/Person.java
similarity index 93%
rename from core-java-8/src/main/java/com/baeldung/reflect/Person.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/reflect/Person.java
index fba25aca8b..f15250869d 100644
--- a/core-java-8/src/main/java/com/baeldung/reflect/Person.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/reflect/Person.java
@@ -1,18 +1,18 @@
-package com.baeldung.reflect;
-
-public class Person {
-
- private String fullName;
-
- public Person(String fullName) {
- this.fullName = fullName;
- }
-
- public void setFullName(String fullName) {
- this.fullName = fullName;
- }
-
- public String getFullName() {
- return fullName;
- }
-}
+package com.baeldung.reflect;
+
+public class Person {
+
+ private String fullName;
+
+ public Person(String fullName) {
+ this.fullName = fullName;
+ }
+
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+
+ public String getFullName() {
+ return fullName;
+ }
+}
diff --git a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Article.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Article.java
similarity index 95%
rename from core-java-8/src/main/java/com/baeldung/spliteratorAPI/Article.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Article.java
index 402ec6ec5f..3cd2a00da1 100644
--- a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Article.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Article.java
@@ -1,44 +1,44 @@
-package com.baeldung.spliteratorAPI;
-
-import java.util.List;
-
-public class Article {
- private List listOfAuthors;
- private int id;
- private String name;
-
- public Article(String name) {
- this.name = name;
- }
-
- public Article(List listOfAuthors, int id) {
- super();
- this.listOfAuthors = listOfAuthors;
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public List getListOfAuthors() {
- return listOfAuthors;
- }
-
- public void setListOfAuthors(List listOfAuthors) {
- this.listOfAuthors = listOfAuthors;
- }
-
+package com.baeldung.spliteratorAPI;
+
+import java.util.List;
+
+public class Article {
+ private List listOfAuthors;
+ private int id;
+ private String name;
+
+ public Article(String name) {
+ this.name = name;
+ }
+
+ public Article(List listOfAuthors, int id) {
+ super();
+ this.listOfAuthors = listOfAuthors;
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public List getListOfAuthors() {
+ return listOfAuthors;
+ }
+
+ public void setListOfAuthors(List listOfAuthors) {
+ this.listOfAuthors = listOfAuthors;
+ }
+
}
\ No newline at end of file
diff --git a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Author.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Author.java
similarity index 95%
rename from core-java-8/src/main/java/com/baeldung/spliteratorAPI/Author.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Author.java
index 40c381f4a6..18bbbd073e 100644
--- a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Author.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Author.java
@@ -1,33 +1,33 @@
-package com.baeldung.spliteratorAPI;
-
-public class Author {
- private String name;
- private int relatedArticleId;
-
- public Author(String name, int relatedArticleId) {
- this.name = name;
- this.relatedArticleId = relatedArticleId;
- }
-
- public int getRelatedArticleId() {
- return relatedArticleId;
- }
-
- public void setRelatedArticleId(int relatedArticleId) {
- this.relatedArticleId = relatedArticleId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return "[name: " + name + ", relatedId: " + relatedArticleId + "]";
- }
-}
-
+package com.baeldung.spliteratorAPI;
+
+public class Author {
+ private String name;
+ private int relatedArticleId;
+
+ public Author(String name, int relatedArticleId) {
+ this.name = name;
+ this.relatedArticleId = relatedArticleId;
+ }
+
+ public int getRelatedArticleId() {
+ return relatedArticleId;
+ }
+
+ public void setRelatedArticleId(int relatedArticleId) {
+ this.relatedArticleId = relatedArticleId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return "[name: " + name + ", relatedId: " + relatedArticleId + "]";
+ }
+}
+
diff --git a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Executor.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Executor.java
similarity index 96%
rename from core-java-8/src/main/java/com/baeldung/spliteratorAPI/Executor.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Executor.java
index 024d5dabdb..dd124948d8 100644
--- a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Executor.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Executor.java
@@ -1,19 +1,19 @@
-package com.baeldung.spliteratorAPI;
-
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-public class Executor {
-
- public static int countAutors(Stream stream) {
- RelatedAuthorCounter wordCounter = stream.reduce(new RelatedAuthorCounter(0, true),
- RelatedAuthorCounter::accumulate, RelatedAuthorCounter::combine);
- return wordCounter.getCounter();
- }
-
- public static List generateElements() {
- return Stream.generate(() -> new Article("Java")).limit(35000).collect(Collectors.toList());
- }
-
+package com.baeldung.spliteratorAPI;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class Executor {
+
+ public static int countAutors(Stream stream) {
+ RelatedAuthorCounter wordCounter = stream.reduce(new RelatedAuthorCounter(0, true),
+ RelatedAuthorCounter::accumulate, RelatedAuthorCounter::combine);
+ return wordCounter.getCounter();
+ }
+
+ public static List generateElements() {
+ return Stream.generate(() -> new Article("Java")).limit(35000).collect(Collectors.toList());
+ }
+
}
\ No newline at end of file
diff --git a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorCounter.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorCounter.java
similarity index 96%
rename from core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorCounter.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorCounter.java
index b7120b3af2..282c0be727 100644
--- a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorCounter.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorCounter.java
@@ -1,27 +1,27 @@
-package com.baeldung.spliteratorAPI;
-
-public class RelatedAuthorCounter {
- private final int counter;
- private final boolean isRelated;
-
- public RelatedAuthorCounter(int counter, boolean isRelated) {
- this.counter = counter;
- this.isRelated = isRelated;
- }
-
- public RelatedAuthorCounter accumulate(Author author) {
- if (author.getRelatedArticleId() == 0) {
- return isRelated ? this : new RelatedAuthorCounter(counter, true);
- } else {
- return isRelated ? new RelatedAuthorCounter(counter + 1, false) : this;
- }
- }
-
- public RelatedAuthorCounter combine(RelatedAuthorCounter RelatedAuthorCounter) {
- return new RelatedAuthorCounter(counter + RelatedAuthorCounter.counter, RelatedAuthorCounter.isRelated);
- }
-
- public int getCounter() {
- return counter;
- }
-}
+package com.baeldung.spliteratorAPI;
+
+public class RelatedAuthorCounter {
+ private final int counter;
+ private final boolean isRelated;
+
+ public RelatedAuthorCounter(int counter, boolean isRelated) {
+ this.counter = counter;
+ this.isRelated = isRelated;
+ }
+
+ public RelatedAuthorCounter accumulate(Author author) {
+ if (author.getRelatedArticleId() == 0) {
+ return isRelated ? this : new RelatedAuthorCounter(counter, true);
+ } else {
+ return isRelated ? new RelatedAuthorCounter(counter + 1, false) : this;
+ }
+ }
+
+ public RelatedAuthorCounter combine(RelatedAuthorCounter RelatedAuthorCounter) {
+ return new RelatedAuthorCounter(counter + RelatedAuthorCounter.counter, RelatedAuthorCounter.isRelated);
+ }
+
+ public int getCounter() {
+ return counter;
+ }
+}
diff --git a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorSpliterator.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorSpliterator.java
similarity index 96%
rename from core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorSpliterator.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorSpliterator.java
index 0a7190964e..094638da37 100644
--- a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorSpliterator.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/RelatedAuthorSpliterator.java
@@ -1,49 +1,49 @@
-package com.baeldung.spliteratorAPI;
-
-import java.util.List;
-import java.util.Spliterator;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.Consumer;
-
-public class RelatedAuthorSpliterator implements Spliterator {
- private final List list;
- AtomicInteger current = new AtomicInteger();
-
- public RelatedAuthorSpliterator(List list) {
- this.list = list;
- }
-
- @Override
- public boolean tryAdvance(Consumer super Author> action) {
-
- action.accept(list.get(current.getAndIncrement()));
- return current.get() < list.size();
- }
-
- @Override
- public Spliterator trySplit() {
- int currentSize = list.size() - current.get();
- if (currentSize < 10) {
- return null;
- }
- for (int splitPos = currentSize / 2 + current.intValue(); splitPos < list.size(); splitPos++) {
- if (list.get(splitPos).getRelatedArticleId() == 0) {
- Spliterator spliterator = new RelatedAuthorSpliterator(list.subList(current.get(), splitPos));
- current.set(splitPos);
- return spliterator;
- }
- }
- return null;
- }
-
- @Override
- public long estimateSize() {
- return list.size() - current.get();
- }
-
- @Override
- public int characteristics() {
- return CONCURRENT;
- }
-
-}
+package com.baeldung.spliteratorAPI;
+
+import java.util.List;
+import java.util.Spliterator;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+
+public class RelatedAuthorSpliterator implements Spliterator {
+ private final List list;
+ AtomicInteger current = new AtomicInteger();
+
+ public RelatedAuthorSpliterator(List list) {
+ this.list = list;
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer super Author> action) {
+
+ action.accept(list.get(current.getAndIncrement()));
+ return current.get() < list.size();
+ }
+
+ @Override
+ public Spliterator trySplit() {
+ int currentSize = list.size() - current.get();
+ if (currentSize < 10) {
+ return null;
+ }
+ for (int splitPos = currentSize / 2 + current.intValue(); splitPos < list.size(); splitPos++) {
+ if (list.get(splitPos).getRelatedArticleId() == 0) {
+ Spliterator spliterator = new RelatedAuthorSpliterator(list.subList(current.get(), splitPos));
+ current.set(splitPos);
+ return spliterator;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public long estimateSize() {
+ return list.size() - current.get();
+ }
+
+ @Override
+ public int characteristics() {
+ return CONCURRENT;
+ }
+
+}
diff --git a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Task.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Task.java
similarity index 96%
rename from core-java-8/src/main/java/com/baeldung/spliteratorAPI/Task.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Task.java
index 70435d1c75..06a124cc98 100644
--- a/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Task.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/spliteratorAPI/Task.java
@@ -1,27 +1,27 @@
-package com.baeldung.spliteratorAPI;
-
-import java.util.Spliterator;
-import java.util.concurrent.Callable;
-
-public class Task implements Callable {
- private Spliterator spliterator;
- private final static String SUFFIX = "- published by Baeldung";
-
- public Task(Spliterator spliterator) {
- this.spliterator = spliterator;
- }
-
- @Override
- public String call() {
- int current = 0;
- while (spliterator.tryAdvance(article -> {
- article.setName(article.getName()
- .concat(SUFFIX));
- })) {
- current++;
- }
- ;
- return Thread.currentThread()
- .getName() + ":" + current;
- }
-}
+package com.baeldung.spliteratorAPI;
+
+import java.util.Spliterator;
+import java.util.concurrent.Callable;
+
+public class Task implements Callable {
+ private Spliterator spliterator;
+ private final static String SUFFIX = "- published by Baeldung";
+
+ public Task(Spliterator spliterator) {
+ this.spliterator = spliterator;
+ }
+
+ @Override
+ public String call() {
+ int current = 0;
+ while (spliterator.tryAdvance(article -> {
+ article.setName(article.getName()
+ .concat(SUFFIX));
+ })) {
+ current++;
+ }
+ ;
+ return Thread.currentThread()
+ .getName() + ":" + current;
+ }
+}
diff --git a/core-java-8/src/main/java/com/baeldung/strategy/ChristmasDiscounter.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/strategy/ChristmasDiscounter.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/strategy/ChristmasDiscounter.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/strategy/ChristmasDiscounter.java
diff --git a/core-java-8/src/main/java/com/baeldung/strategy/Discounter.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/strategy/Discounter.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/strategy/Discounter.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/strategy/Discounter.java
diff --git a/core-java-8/src/main/java/com/baeldung/strategy/EasterDiscounter.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/strategy/EasterDiscounter.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/strategy/EasterDiscounter.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/strategy/EasterDiscounter.java
diff --git a/core-java-8/src/main/java/com/baeldung/streamreduce/application/Application.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/application/Application.java
similarity index 97%
rename from core-java-8/src/main/java/com/baeldung/streamreduce/application/Application.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/application/Application.java
index 0b1dd952dc..00fc45ccae 100644
--- a/core-java-8/src/main/java/com/baeldung/streamreduce/application/Application.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/application/Application.java
@@ -1,62 +1,62 @@
-package com.baeldung.streamreduce.application;
-
-import com.baeldung.streamreduce.entities.User;
-import com.baeldung.streamreduce.utilities.NumberUtils;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class Application {
-
- public static void main(String[] args) {
- List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
- int result1 = numbers.stream().reduce(0, (a, b) -> a + b);
- System.out.println(result1);
-
- int result2 = numbers.stream().reduce(0, Integer::sum);
- System.out.println(result2);
-
- List letters = Arrays.asList("a", "b", "c", "d", "e");
- String result3 = letters.stream().reduce("", (a, b) -> a + b);
- System.out.println(result3);
-
- String result4 = letters.stream().reduce("", String::concat);
- System.out.println(result4);
-
- String result5 = letters.stream().reduce("", (a, b) -> a.toUpperCase() + b.toUpperCase());
- System.out.println(result5);
-
- List users = Arrays.asList(new User("John", 30), new User("Julie", 35));
- int result6 = users.stream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
- System.out.println(result6);
-
- String result7 = letters.parallelStream().reduce("", String::concat);
- System.out.println(result7);
-
- int result8 = users.parallelStream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
- System.out.println(result8);
-
- List userList = new ArrayList<>();
- for (int i = 0; i <= 1000000; i++) {
- userList.add(new User("John" + i, i));
- }
-
- long t1 = System.currentTimeMillis();
- int result9 = userList.stream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
- long t2 = System.currentTimeMillis();
- System.out.println(result9);
- System.out.println("Sequential stream time: " + (t2 - t1) + "ms");
-
- long t3 = System.currentTimeMillis();
- int result10 = userList.parallelStream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
- long t4 = System.currentTimeMillis();
- System.out.println(result10);
- System.out.println("Parallel stream time: " + (t4 - t3) + "ms");
-
- int result11 = NumberUtils.divideListElements(numbers, 1);
- System.out.println(result11);
-
- int result12 = NumberUtils.divideListElementsWithExtractedTryCatchBlock(numbers, 0);
- System.out.println(result12);
- }
-}
+package com.baeldung.streamreduce.application;
+
+import com.baeldung.streamreduce.entities.User;
+import com.baeldung.streamreduce.utilities.NumberUtils;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Application {
+
+ public static void main(String[] args) {
+ List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
+ int result1 = numbers.stream().reduce(0, (a, b) -> a + b);
+ System.out.println(result1);
+
+ int result2 = numbers.stream().reduce(0, Integer::sum);
+ System.out.println(result2);
+
+ List letters = Arrays.asList("a", "b", "c", "d", "e");
+ String result3 = letters.stream().reduce("", (a, b) -> a + b);
+ System.out.println(result3);
+
+ String result4 = letters.stream().reduce("", String::concat);
+ System.out.println(result4);
+
+ String result5 = letters.stream().reduce("", (a, b) -> a.toUpperCase() + b.toUpperCase());
+ System.out.println(result5);
+
+ List users = Arrays.asList(new User("John", 30), new User("Julie", 35));
+ int result6 = users.stream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
+ System.out.println(result6);
+
+ String result7 = letters.parallelStream().reduce("", String::concat);
+ System.out.println(result7);
+
+ int result8 = users.parallelStream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
+ System.out.println(result8);
+
+ List userList = new ArrayList<>();
+ for (int i = 0; i <= 1000000; i++) {
+ userList.add(new User("John" + i, i));
+ }
+
+ long t1 = System.currentTimeMillis();
+ int result9 = userList.stream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
+ long t2 = System.currentTimeMillis();
+ System.out.println(result9);
+ System.out.println("Sequential stream time: " + (t2 - t1) + "ms");
+
+ long t3 = System.currentTimeMillis();
+ int result10 = userList.parallelStream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
+ long t4 = System.currentTimeMillis();
+ System.out.println(result10);
+ System.out.println("Parallel stream time: " + (t4 - t3) + "ms");
+
+ int result11 = NumberUtils.divideListElements(numbers, 1);
+ System.out.println(result11);
+
+ int result12 = NumberUtils.divideListElementsWithExtractedTryCatchBlock(numbers, 0);
+ System.out.println(result12);
+ }
+}
diff --git a/core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java
similarity index 94%
rename from core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java
index bc13a8cde6..39a42beab7 100644
--- a/core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/entities/User.java
@@ -1,25 +1,25 @@
-package com.baeldung.streamreduce.entities;
-
-public class User {
-
- private final String name;
- private final int age;
-
- public User(String name, int age) {
- this.name = name;
- this.age = age;
- }
-
- public String getName() {
- return name;
- }
-
- public int getAge() {
- return age;
- }
-
- @Override
- public String toString() {
- return "User{" + "name=" + name + ", age=" + age + '}';
- }
-}
+package com.baeldung.streamreduce.entities;
+
+public class User {
+
+ private final String name;
+ private final int age;
+
+ public User(String name, int age) {
+ this.name = name;
+ this.age = age;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ @Override
+ public String toString() {
+ return "User{" + "name=" + name + ", age=" + age + '}';
+ }
+}
diff --git a/core-java-8/src/main/java/com/baeldung/streamreduce/utilities/NumberUtils.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/utilities/NumberUtils.java
similarity index 97%
rename from core-java-8/src/main/java/com/baeldung/streamreduce/utilities/NumberUtils.java
rename to core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/utilities/NumberUtils.java
index 7a6a85e6c4..a2325cc701 100644
--- a/core-java-8/src/main/java/com/baeldung/streamreduce/utilities/NumberUtils.java
+++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/streamreduce/utilities/NumberUtils.java
@@ -1,52 +1,52 @@
-package com.baeldung.streamreduce.utilities;
-
-import java.util.List;
-import java.util.function.BiFunction;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public abstract class NumberUtils {
-
- private static final Logger LOGGER = Logger.getLogger(NumberUtils.class.getName());
-
- public static int divideListElements(List values, Integer divider) {
- return values.stream()
- .reduce(0, (a, b) -> {
- try {
- return a / divider + b / divider;
- } catch (ArithmeticException e) {
- LOGGER.log(Level.INFO, "Arithmetic Exception: Division by Zero");
- }
- return 0;
- });
- }
-
- public static int divideListElementsWithExtractedTryCatchBlock(List values, int divider) {
- return values.stream().reduce(0, (a, b) -> divide(a, divider) + divide(b, divider));
- }
-
- public static int divideListElementsWithApplyFunctionMethod(List values, int divider) {
- BiFunction division = (a, b) -> a / b;
- return values.stream().reduce(0, (a, b) -> applyFunction(division, a, divider) + applyFunction(division, b, divider));
- }
-
- private static int divide(int value, int factor) {
- int result = 0;
- try {
- result = value / factor;
- } catch (ArithmeticException e) {
- LOGGER.log(Level.INFO, "Arithmetic Exception: Division by Zero");
- }
- return result;
- }
-
- private static int applyFunction(BiFunction function, int a, int b) {
- try {
- return function.apply(a, b);
- }
- catch(Exception e) {
- LOGGER.log(Level.INFO, "Exception occurred!");
- }
- return 0;
- }
-}
+package com.baeldung.streamreduce.utilities;
+
+import java.util.List;
+import java.util.function.BiFunction;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public abstract class NumberUtils {
+
+ private static final Logger LOGGER = Logger.getLogger(NumberUtils.class.getName());
+
+ public static int divideListElements(List values, Integer divider) {
+ return values.stream()
+ .reduce(0, (a, b) -> {
+ try {
+ return a / divider + b / divider;
+ } catch (ArithmeticException e) {
+ LOGGER.log(Level.INFO, "Arithmetic Exception: Division by Zero");
+ }
+ return 0;
+ });
+ }
+
+ public static int divideListElementsWithExtractedTryCatchBlock(List values, int divider) {
+ return values.stream().reduce(0, (a, b) -> divide(a, divider) + divide(b, divider));
+ }
+
+ public static int divideListElementsWithApplyFunctionMethod(List values, int divider) {
+ BiFunction division = (a, b) -> a / b;
+ return values.stream().reduce(0, (a, b) -> applyFunction(division, a, divider) + applyFunction(division, b, divider));
+ }
+
+ private static int divide(int value, int factor) {
+ int result = 0;
+ try {
+ result = value / factor;
+ } catch (ArithmeticException e) {
+ LOGGER.log(Level.INFO, "Arithmetic Exception: Division by Zero");
+ }
+ return result;
+ }
+
+ private static int applyFunction(BiFunction function, int a, int b) {
+ try {
+ return function.apply(a, b);
+ }
+ catch(Exception e) {
+ LOGGER.log(Level.INFO, "Exception occurred!");
+ }
+ return 0;
+ }
+}
diff --git a/core-java-8/src/main/resources/logback.xml b/core-java-modules/core-java-8/src/main/resources/logback.xml
similarity index 100%
rename from core-java-8/src/main/resources/logback.xml
rename to core-java-modules/core-java-8/src/main/resources/logback.xml
diff --git a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/counter/CounterStatistics.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/counter/CounterStatistics.java
similarity index 97%
rename from core-java-8/src/test/java/com/baeldung/counter/CounterStatistics.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/counter/CounterStatistics.java
index 015ca3f942..e5b03bf355 100644
--- a/core-java-8/src/test/java/com/baeldung/counter/CounterStatistics.java
+++ b/core-java-modules/core-java-8/src/test/java/com/baeldung/counter/CounterStatistics.java
@@ -1,61 +1,61 @@
-package com.baeldung.counter;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Fork;
-import org.openjdk.jmh.annotations.Mode;
-
-import com.baeldung.counter.CounterUtil.MutableInteger;
-
-@Fork(value = 1, warmups = 3)
-@BenchmarkMode(Mode.All)
-public class CounterStatistics {
-
- private static final Map counterMap = new HashMap<>();
- private static final Map counterWithMutableIntMap = new HashMap<>();
- private static final Map counterWithIntArrayMap = new HashMap<>();
- private static final Map counterWithLongWrapperMap = new HashMap<>();
- private static final Map counterWithLongWrapperStreamMap = new HashMap<>();
-
- static {
- CounterUtil.COUNTRY_NAMES = new String[10000];
- final String prefix = "NewString";
- Random random = new Random();
- for (int i=0; i<10000; i++) {
- CounterUtil.COUNTRY_NAMES[i] = new String(prefix + random.nextInt(1000));
- }
- }
-
- @Benchmark
- public void wrapperAsCounter() {
- CounterUtil.counterWithWrapperObject(counterMap);
- }
-
- @Benchmark
- public void lambdaExpressionWithWrapper() {
- CounterUtil.counterWithLambdaAndWrapper(counterWithLongWrapperMap);
- }
-
- @Benchmark
- public void parallelStreamWithWrapper() {
- CounterUtil.counterWithParallelStreamAndWrapper(counterWithLongWrapperStreamMap);
- }
-
- @Benchmark
- public void mutableIntegerAsCounter() {
- CounterUtil.counterWithMutableInteger(counterWithMutableIntMap);
- }
-
- @Benchmark
- public void primitiveArrayAsCounter() {
- CounterUtil.counterWithPrimitiveArray(counterWithIntArrayMap);
- }
-
- public static void main(String[] args) throws Exception {
- org.openjdk.jmh.Main.main(args);
- }
-}
+package com.baeldung.counter;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Mode;
+
+import com.baeldung.counter.CounterUtil.MutableInteger;
+
+@Fork(value = 1, warmups = 3)
+@BenchmarkMode(Mode.All)
+public class CounterStatistics {
+
+ private static final Map counterMap = new HashMap<>();
+ private static final Map counterWithMutableIntMap = new HashMap<>();
+ private static final Map counterWithIntArrayMap = new HashMap<>();
+ private static final Map counterWithLongWrapperMap = new HashMap<>();
+ private static final Map counterWithLongWrapperStreamMap = new HashMap<>();
+
+ static {
+ CounterUtil.COUNTRY_NAMES = new String[10000];
+ final String prefix = "NewString";
+ Random random = new Random();
+ for (int i=0; i<10000; i++) {
+ CounterUtil.COUNTRY_NAMES[i] = new String(prefix + random.nextInt(1000));
+ }
+ }
+
+ @Benchmark
+ public void wrapperAsCounter() {
+ CounterUtil.counterWithWrapperObject(counterMap);
+ }
+
+ @Benchmark
+ public void lambdaExpressionWithWrapper() {
+ CounterUtil.counterWithLambdaAndWrapper(counterWithLongWrapperMap);
+ }
+
+ @Benchmark
+ public void parallelStreamWithWrapper() {
+ CounterUtil.counterWithParallelStreamAndWrapper(counterWithLongWrapperStreamMap);
+ }
+
+ @Benchmark
+ public void mutableIntegerAsCounter() {
+ CounterUtil.counterWithMutableInteger(counterWithMutableIntMap);
+ }
+
+ @Benchmark
+ public void primitiveArrayAsCounter() {
+ CounterUtil.counterWithPrimitiveArray(counterWithIntArrayMap);
+ }
+
+ public static void main(String[] args) throws Exception {
+ org.openjdk.jmh.Main.main(args);
+ }
+}
diff --git a/core-java-8/src/test/java/com/baeldung/counter/CounterUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/counter/CounterUnitTest.java
similarity index 96%
rename from core-java-8/src/test/java/com/baeldung/counter/CounterUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/counter/CounterUnitTest.java
index ef57fc2c6e..4f914bd289 100644
--- a/core-java-8/src/test/java/com/baeldung/counter/CounterUnitTest.java
+++ b/core-java-modules/core-java-8/src/test/java/com/baeldung/counter/CounterUnitTest.java
@@ -1,53 +1,53 @@
-package com.baeldung.counter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import com.baeldung.counter.CounterUtil.MutableInteger;
-
-public class CounterUnitTest {
-
- @Test
- public void whenMapWithWrapperAsCounter_runsSuccessfully() {
- Map counterMap = new HashMap<>();
- CounterUtil.counterWithWrapperObject(counterMap);
-
- assertEquals(3, counterMap.get("China")
- .intValue());
- assertEquals(2, counterMap.get("India")
- .intValue());
- }
-
- @Test
- public void whenMapWithLambdaAndWrapperCounter_runsSuccessfully() {
- Map counterMap = new HashMap<>();
- CounterUtil.counterWithLambdaAndWrapper(counterMap);
-
- assertEquals(3l, counterMap.get("China")
- .longValue());
- assertEquals(2l, counterMap.get("India")
- .longValue());
- }
-
- @Test
- public void whenMapWithMutableIntegerCounter_runsSuccessfully() {
- Map counterMap = new HashMap<>();
- CounterUtil.counterWithMutableInteger(counterMap);
- assertEquals(3, counterMap.get("China")
- .getCount());
- assertEquals(2, counterMap.get("India")
- .getCount());
- }
-
- @Test
- public void whenMapWithPrimitiveArray_runsSuccessfully() {
- Map counterMap = new HashMap<>();
- CounterUtil.counterWithPrimitiveArray(counterMap);
- assertEquals(3, counterMap.get("China")[0]);
- assertEquals(2, counterMap.get("India")[0]);
- }
-}
+package com.baeldung.counter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.baeldung.counter.CounterUtil.MutableInteger;
+
+public class CounterUnitTest {
+
+ @Test
+ public void whenMapWithWrapperAsCounter_runsSuccessfully() {
+ Map counterMap = new HashMap<>();
+ CounterUtil.counterWithWrapperObject(counterMap);
+
+ assertEquals(3, counterMap.get("China")
+ .intValue());
+ assertEquals(2, counterMap.get("India")
+ .intValue());
+ }
+
+ @Test
+ public void whenMapWithLambdaAndWrapperCounter_runsSuccessfully() {
+ Map counterMap = new HashMap<>();
+ CounterUtil.counterWithLambdaAndWrapper(counterMap);
+
+ assertEquals(3l, counterMap.get("China")
+ .longValue());
+ assertEquals(2l, counterMap.get("India")
+ .longValue());
+ }
+
+ @Test
+ public void whenMapWithMutableIntegerCounter_runsSuccessfully() {
+ Map counterMap = new HashMap<>();
+ CounterUtil.counterWithMutableInteger(counterMap);
+ assertEquals(3, counterMap.get("China")
+ .getCount());
+ assertEquals(2, counterMap.get("India")
+ .getCount());
+ }
+
+ @Test
+ public void whenMapWithPrimitiveArray_runsSuccessfully() {
+ Map counterMap = new HashMap<>();
+ CounterUtil.counterWithPrimitiveArray(counterMap);
+ assertEquals(3, counterMap.get("China")[0]);
+ assertEquals(2, counterMap.get("India")[0]);
+ }
+}
diff --git a/core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java
similarity index 97%
rename from core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java
index c2bf47e213..7e15fa1356 100644
--- a/core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java
+++ b/core-java-modules/core-java-8/src/test/java/com/baeldung/counter/CounterUtil.java
@@ -1,57 +1,57 @@
-package com.baeldung.counter;
-
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-public class CounterUtil {
-
- public static String[] COUNTRY_NAMES = { "China", "Australia", "India", "USA", "USSR", "UK", "China", "France", "Poland", "Austria", "India", "USA", "Egypt", "China" };
-
- public static void counterWithWrapperObject(Map counterMap) {
- for (String country : COUNTRY_NAMES) {
- counterMap.compute(country, (k, v) -> v == null ? 1 : v + 1);
- }
- }
-
- public static void counterWithLambdaAndWrapper(Map counterMap) {
- Stream.of(COUNTRY_NAMES)
- .collect(Collectors.groupingBy(k -> k, () -> counterMap, Collectors.counting()));
- }
-
- public static void counterWithParallelStreamAndWrapper(Map counterMap) {
- Stream.of(COUNTRY_NAMES)
- .parallel()
- .collect(Collectors.groupingBy(k -> k, () -> counterMap, Collectors.counting()));
- }
-
- public static class MutableInteger {
- int count;
-
- public MutableInteger(int count) {
- this.count = count;
- }
-
- public void increment() {
- this.count++;
- }
-
- public int getCount() {
- return this.count;
- }
- }
-
- public static void counterWithMutableInteger(Map counterMap) {
- for (String country : COUNTRY_NAMES) {
- counterMap.compute(country, (k, v) -> v == null ? new MutableInteger(0) : v)
- .increment();
- }
- }
-
- public static void counterWithPrimitiveArray(Map counterMap) {
- for (String country : COUNTRY_NAMES) {
- counterMap.compute(country, (k, v) -> v == null ? new int[] { 0 } : v)[0]++;
- }
- }
-
+package com.baeldung.counter;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class CounterUtil {
+
+ public static String[] COUNTRY_NAMES = { "China", "Australia", "India", "USA", "USSR", "UK", "China", "France", "Poland", "Austria", "India", "USA", "Egypt", "China" };
+
+ public static void counterWithWrapperObject(Map counterMap) {
+ for (String country : COUNTRY_NAMES) {
+ counterMap.compute(country, (k, v) -> v == null ? 1 : v + 1);
+ }
+ }
+
+ public static void counterWithLambdaAndWrapper(Map counterMap) {
+ Stream.of(COUNTRY_NAMES)
+ .collect(Collectors.groupingBy(k -> k, () -> counterMap, Collectors.counting()));
+ }
+
+ public static void counterWithParallelStreamAndWrapper(Map counterMap) {
+ Stream.of(COUNTRY_NAMES)
+ .parallel()
+ .collect(Collectors.groupingBy(k -> k, () -> counterMap, Collectors.counting()));
+ }
+
+ public static class MutableInteger {
+ int count;
+
+ public MutableInteger(int count) {
+ this.count = count;
+ }
+
+ public void increment() {
+ this.count++;
+ }
+
+ public int getCount() {
+ return this.count;
+ }
+ }
+
+ public static void counterWithMutableInteger(Map counterMap) {
+ for (String country : COUNTRY_NAMES) {
+ counterMap.compute(country, (k, v) -> v == null ? new MutableInteger(0) : v)
+ .increment();
+ }
+ }
+
+ public static void counterWithPrimitiveArray(Map counterMap) {
+ for (String country : COUNTRY_NAMES) {
+ counterMap.compute(country, (k, v) -> v == null ? new int[] { 0 } : v)[0]++;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/core-java-8/src/test/java/com/baeldung/customannotations/JsonSerializerUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/customannotations/JsonSerializerUnitTest.java
similarity index 97%
rename from core-java-8/src/test/java/com/baeldung/customannotations/JsonSerializerUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/customannotations/JsonSerializerUnitTest.java
index f24b37aef7..fd8f8ba8b3 100644
--- a/core-java-8/src/test/java/com/baeldung/customannotations/JsonSerializerUnitTest.java
+++ b/core-java-modules/core-java-8/src/test/java/com/baeldung/customannotations/JsonSerializerUnitTest.java
@@ -1,26 +1,26 @@
-package com.baeldung.customannotations;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-import org.junit.jupiter.api.Test;
-
-public class JsonSerializerUnitTest {
-
- @Test
- public void givenObjectNotSerializedThenExceptionThrown() throws JsonSerializationException {
- Object object = new Object();
- ObjectToJsonConverter serializer = new ObjectToJsonConverter();
- assertThrows(JsonSerializationException.class, () -> {
- serializer.convertToJson(object);
- });
- }
-
- @Test
- public void givenObjectSerializedThenTrueReturned() throws JsonSerializationException {
- Person person = new Person("soufiane", "cheouati", "34");
- ObjectToJsonConverter serializer = new ObjectToJsonConverter();
- String jsonString = serializer.convertToJson(person);
- assertEquals("{\"personAge\":\"34\",\"firstName\":\"Soufiane\",\"lastName\":\"Cheouati\"}", jsonString);
- }
-}
+package com.baeldung.customannotations;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import org.junit.jupiter.api.Test;
+
+public class JsonSerializerUnitTest {
+
+ @Test
+ public void givenObjectNotSerializedThenExceptionThrown() throws JsonSerializationException {
+ Object object = new Object();
+ ObjectToJsonConverter serializer = new ObjectToJsonConverter();
+ assertThrows(JsonSerializationException.class, () -> {
+ serializer.convertToJson(object);
+ });
+ }
+
+ @Test
+ public void givenObjectSerializedThenTrueReturned() throws JsonSerializationException {
+ Person person = new Person("soufiane", "cheouati", "34");
+ ObjectToJsonConverter serializer = new ObjectToJsonConverter();
+ String jsonString = serializer.convertToJson(person);
+ assertEquals("{\"personAge\":\"34\",\"firstName\":\"Soufiane\",\"lastName\":\"Cheouati\"}", jsonString);
+ }
+}
diff --git a/core-java-8/src/test/java/com/baeldung/defaultistaticinterfacemethods/test/StaticDefaulInterfaceMethodUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/defaultistaticinterfacemethods/test/StaticDefaulInterfaceMethodUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/defaultistaticinterfacemethods/test/StaticDefaulInterfaceMethodUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/defaultistaticinterfacemethods/test/StaticDefaulInterfaceMethodUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java
diff --git a/core-java-8/src/test/java/com/baeldung/internationalization/DateFormatUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/internationalization/DateFormatUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/internationalization/DateFormatUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/internationalization/DateFormatUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/internationalization/NumbersCurrenciesFormattingUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/internationalization/NumbersCurrenciesFormattingUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/internationalization/NumbersCurrenciesFormattingUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/internationalization/NumbersCurrenciesFormattingUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8PredicateChainUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8PredicateChainUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/Java8PredicateChainUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8PredicateChainUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/UnsignedArithmeticUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/UnsignedArithmeticUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/UnsignedArithmeticUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/UnsignedArithmeticUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/comparator/Employee.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/comparator/Employee.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/comparator/Employee.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/comparator/Employee.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/entity/Human.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/entity/Human.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/entity/Human.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/entity/Human.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappersUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappersUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappersUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappersUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/Bicycle.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/Bicycle.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/Bicycle.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/Bicycle.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/BicycleComparator.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/BicycleComparator.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/BicycleComparator.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/BicycleComparator.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/optional/OptionalChainingUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/optional/OptionalChainingUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/optional/OptionalChainingUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/optional/OptionalChainingUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/java8/optional/OrElseAndOrElseGetUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/java8/optional/OrElseAndOrElseGetUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/java8/optional/OrElseAndOrElseGetUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/java8/optional/OrElseAndOrElseGetUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/math/MathNewMethodsUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/math/MathNewMethodsUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/math/MathNewMethodsUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/math/MathNewMethodsUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/optional/PersonRepositoryUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/optional/PersonRepositoryUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/optional/PersonRepositoryUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/optional/PersonRepositoryUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/reduceIfelse/CalculatorUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/reduceIfelse/CalculatorUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/reduceIfelse/CalculatorUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/reduceIfelse/CalculatorUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/reduceIfelse/RuleEngineUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/reduceIfelse/RuleEngineUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/reduceIfelse/RuleEngineUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/reduceIfelse/RuleEngineUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameUnitTest.java
similarity index 97%
rename from core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameUnitTest.java
index b191c94826..dadd6d7543 100644
--- a/core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameUnitTest.java
+++ b/core-java-modules/core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameUnitTest.java
@@ -1,34 +1,34 @@
-package com.baeldung.reflect;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.lang.reflect.Parameter;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Optional;
-
-import org.junit.Test;
-
-public class MethodParamNameUnitTest {
-
- @Test
- public void whenGetConstructorParams_thenOk()
- throws NoSuchMethodException, SecurityException {
- List parameters
- = Arrays.asList(Person.class.getConstructor(String.class).getParameters());
- Optional parameter
- = parameters.stream().filter(Parameter::isNamePresent).findFirst();
- assertThat(parameter.get().getName()).isEqualTo("fullName");
- }
-
- @Test
- public void whenGetMethodParams_thenOk()
- throws NoSuchMethodException, SecurityException {
- List parameters
- = Arrays.asList(
- Person.class.getMethod("setFullName", String.class).getParameters());
- Optional parameter
- = parameters.stream().filter(Parameter::isNamePresent).findFirst();
- assertThat(parameter.get().getName()).isEqualTo("fullName");
- }
-}
+package com.baeldung.reflect;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.lang.reflect.Parameter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+
+import org.junit.Test;
+
+public class MethodParamNameUnitTest {
+
+ @Test
+ public void whenGetConstructorParams_thenOk()
+ throws NoSuchMethodException, SecurityException {
+ List parameters
+ = Arrays.asList(Person.class.getConstructor(String.class).getParameters());
+ Optional parameter
+ = parameters.stream().filter(Parameter::isNamePresent).findFirst();
+ assertThat(parameter.get().getName()).isEqualTo("fullName");
+ }
+
+ @Test
+ public void whenGetMethodParams_thenOk()
+ throws NoSuchMethodException, SecurityException {
+ List parameters
+ = Arrays.asList(
+ Person.class.getMethod("setFullName", String.class).getParameters());
+ Optional parameter
+ = parameters.stream().filter(Parameter::isNamePresent).findFirst();
+ assertThat(parameter.get().getName()).isEqualTo("fullName");
+ }
+}
diff --git a/core-java-8/src/test/java/com/baeldung/spliteratorAPI/ExecutorUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/spliteratorAPI/ExecutorUnitTest.java
similarity index 97%
rename from core-java-8/src/test/java/com/baeldung/spliteratorAPI/ExecutorUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/spliteratorAPI/ExecutorUnitTest.java
index 81fad12eb0..6981898500 100644
--- a/core-java-8/src/test/java/com/baeldung/spliteratorAPI/ExecutorUnitTest.java
+++ b/core-java-modules/core-java-8/src/test/java/com/baeldung/spliteratorAPI/ExecutorUnitTest.java
@@ -1,44 +1,44 @@
-package com.baeldung.spliteratorAPI;
-
-import java.util.Arrays;
-import java.util.Spliterator;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-
-import static org.assertj.core.api.Assertions.*;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ExecutorUnitTest {
- Article article;
- Stream stream;
- Spliterator spliterator;
- Spliterator split1;
- Spliterator split2;
-
- @Before
- public void init() {
- article = new Article(Arrays.asList(new Author("Ahmad", 0), new Author("Eugen", 0), new Author("Alice", 1),
- new Author("Alice", 1), new Author("Mike", 0), new Author("Alice", 1), new Author("Mike", 0),
- new Author("Alice", 1), new Author("Mike", 0), new Author("Alice", 1), new Author("Mike", 0),
- new Author("Mike", 0), new Author("Alice", 1), new Author("Mike", 0), new Author("Alice", 1),
- new Author("Mike", 0), new Author("Alice", 1), new Author("Mike", 0), new Author("Alice", 1),
- new Author("Mike", 0), new Author("Michał", 0), new Author("Loredana", 1)), 0);
- stream = article.getListOfAuthors().stream();
- split1 = Executor.generateElements().spliterator();
- split2 = split1.trySplit();
- spliterator = new RelatedAuthorSpliterator(article.getListOfAuthors());
- }
-
- @Test
- public void givenAstreamOfAuthors_whenProcessedInParallelWithCustomSpliterator_coubtProducessRightOutput() {
- Stream stream2 = StreamSupport.stream(spliterator, true);
- assertThat(Executor.countAutors(stream2.parallel())).isEqualTo(9);
- }
-
- @Test
- public void givenSpliterator_whenAppliedToAListOfArticle_thenSplittedInHalf() {
- assertThat(new Task(split1).call()).containsSequence(Executor.generateElements().size() / 2 + "");
- assertThat(new Task(split2).call()).containsSequence(Executor.generateElements().size() / 2 + "");
- }
-}
+package com.baeldung.spliteratorAPI;
+
+import java.util.Arrays;
+import java.util.Spliterator;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static org.assertj.core.api.Assertions.*;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ExecutorUnitTest {
+ Article article;
+ Stream stream;
+ Spliterator spliterator;
+ Spliterator split1;
+ Spliterator split2;
+
+ @Before
+ public void init() {
+ article = new Article(Arrays.asList(new Author("Ahmad", 0), new Author("Eugen", 0), new Author("Alice", 1),
+ new Author("Alice", 1), new Author("Mike", 0), new Author("Alice", 1), new Author("Mike", 0),
+ new Author("Alice", 1), new Author("Mike", 0), new Author("Alice", 1), new Author("Mike", 0),
+ new Author("Mike", 0), new Author("Alice", 1), new Author("Mike", 0), new Author("Alice", 1),
+ new Author("Mike", 0), new Author("Alice", 1), new Author("Mike", 0), new Author("Alice", 1),
+ new Author("Mike", 0), new Author("Michał", 0), new Author("Loredana", 1)), 0);
+ stream = article.getListOfAuthors().stream();
+ split1 = Executor.generateElements().spliterator();
+ split2 = split1.trySplit();
+ spliterator = new RelatedAuthorSpliterator(article.getListOfAuthors());
+ }
+
+ @Test
+ public void givenAstreamOfAuthors_whenProcessedInParallelWithCustomSpliterator_coubtProducessRightOutput() {
+ Stream stream2 = StreamSupport.stream(spliterator, true);
+ assertThat(Executor.countAutors(stream2.parallel())).isEqualTo(9);
+ }
+
+ @Test
+ public void givenSpliterator_whenAppliedToAListOfArticle_thenSplittedInHalf() {
+ assertThat(new Task(split1).call()).containsSequence(Executor.generateElements().size() / 2 + "");
+ assertThat(new Task(split2).call()).containsSequence(Executor.generateElements().size() / 2 + "");
+ }
+}
diff --git a/core-java-8/src/test/java/com/baeldung/strategy/StrategyDesignPatternUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/strategy/StrategyDesignPatternUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/strategy/StrategyDesignPatternUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/strategy/StrategyDesignPatternUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/stream/conditional/StreamForEachIfElseUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/stream/conditional/StreamForEachIfElseUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/stream/conditional/StreamForEachIfElseUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/stream/conditional/StreamForEachIfElseUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java
similarity index 97%
rename from core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java
index 9222cbb689..0bf1a5837e 100644
--- a/core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java
+++ b/core-java-modules/core-java-8/src/test/java/com/baeldung/streamreduce/tests/StreamReduceManualTest.java
@@ -1,126 +1,126 @@
-package com.baeldung.streamreduce.tests;
-
-import com.baeldung.streamreduce.entities.User;
-import com.baeldung.streamreduce.utilities.NumberUtils;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import static org.assertj.core.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class StreamReduceManualTest {
-
- @Test
- public void givenIntegerList_whenReduceWithSumAccumulatorLambda_thenCorrect() {
- List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
-
- int result = numbers.stream().reduce(0, (a, b) -> a + b);
-
- assertThat(result).isEqualTo(21);
- }
-
- @Test
- public void givenIntegerList_whenReduceWithSumAccumulatorMethodReference_thenCorrect() {
- List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
-
- int result = numbers.stream().reduce(0, Integer::sum);
-
- assertThat(result).isEqualTo(21);
- }
-
- @Test
- public void givenStringList_whenReduceWithConcatenatorAccumulatorLambda_thenCorrect() {
- List letters = Arrays.asList("a", "b", "c", "d", "e");
-
- String result = letters.stream().reduce("", (a, b) -> a + b);
-
- assertThat(result).isEqualTo("abcde");
- }
-
- @Test
- public void givenStringList_whenReduceWithConcatenatorAccumulatorMethodReference_thenCorrect() {
- List letters = Arrays.asList("a", "b", "c", "d", "e");
-
- String result = letters.stream().reduce("", String::concat);
-
- assertThat(result).isEqualTo("abcde");
- }
-
- @Test
- public void givenStringList_whenReduceWithUppercaseConcatenatorAccumulator_thenCorrect() {
- List letters = Arrays.asList("a", "b", "c", "d", "e");
-
- String result = letters.stream().reduce("", (a, b) -> a.toUpperCase() + b.toUpperCase());
-
- assertThat(result).isEqualTo("ABCDE");
- }
-
- @Test
- public void givenUserList_whenReduceWithAgeAccumulatorAndSumCombiner_thenCorrect() {
- List users = Arrays.asList(new User("John", 30), new User("Julie", 35));
-
- int result = users.stream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
-
- assertThat(result).isEqualTo(65);
- }
-
- @Test
- public void givenStringList_whenReduceWithParallelStream_thenCorrect() {
- List letters = Arrays.asList("a", "b", "c", "d", "e");
-
- String result = letters.parallelStream().reduce("", String::concat);
-
- assertThat(result).isEqualTo("abcde");
- }
-
- @Test
- public void givenNumberUtilsClass_whenCalledDivideListElements_thenCorrect() {
- List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
-
- assertThat(NumberUtils.divideListElements(numbers, 1)).isEqualTo(21);
- }
-
- @Test
- public void givenNumberUtilsClass_whenCalledDivideListElementsWithExtractedTryCatchBlock_thenCorrect() {
- List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
-
- assertThat(NumberUtils.divideListElementsWithExtractedTryCatchBlock(numbers, 1)).isEqualTo(21);
- }
-
- @Test
- public void givenNumberUtilsClass_whenCalledDivideListElementsWithExtractedTryCatchBlockAndListContainsZero_thenCorrect() {
- List numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6);
-
- assertThat(NumberUtils.divideListElementsWithExtractedTryCatchBlock(numbers, 1)).isEqualTo(21);
- }
-
- @Test
- public void givenNumberUtilsClass_whenCalledDivideListElementsWithExtractedTryCatchBlockAndDividerIsZero_thenCorrect() {
- List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
-
- assertThat(NumberUtils.divideListElementsWithExtractedTryCatchBlock(numbers, 0)).isEqualTo(0);
- }
-
- @Test
- public void givenStream_whneCalleddivideListElementsWithApplyFunctionMethod_thenCorrect() {
- List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
-
- assertThat(NumberUtils.divideListElementsWithApplyFunctionMethod(numbers, 1)).isEqualTo(21);
- }
-
- @Test
- public void givenTwoStreams_whenCalledReduceOnParallelizedStream_thenFasterExecutionTime() {
- List userList = new ArrayList<>();
- for (int i = 0; i <= 1000000; i++) {
- userList.add(new User("John" + i, i));
- }
- long currentTime1 = System.currentTimeMillis();
- userList.stream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
- long sequentialExecutionTime = System.currentTimeMillis() -currentTime1;
- long currentTime2 = System.currentTimeMillis();
- userList.parallelStream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
- long parallelizedExecutionTime = System.currentTimeMillis() - currentTime2;
-
- assertThat(parallelizedExecutionTime).isLessThan(sequentialExecutionTime);
- }
-}
+package com.baeldung.streamreduce.tests;
+
+import com.baeldung.streamreduce.entities.User;
+import com.baeldung.streamreduce.utilities.NumberUtils;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class StreamReduceManualTest {
+
+ @Test
+ public void givenIntegerList_whenReduceWithSumAccumulatorLambda_thenCorrect() {
+ List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
+
+ int result = numbers.stream().reduce(0, (a, b) -> a + b);
+
+ assertThat(result).isEqualTo(21);
+ }
+
+ @Test
+ public void givenIntegerList_whenReduceWithSumAccumulatorMethodReference_thenCorrect() {
+ List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
+
+ int result = numbers.stream().reduce(0, Integer::sum);
+
+ assertThat(result).isEqualTo(21);
+ }
+
+ @Test
+ public void givenStringList_whenReduceWithConcatenatorAccumulatorLambda_thenCorrect() {
+ List letters = Arrays.asList("a", "b", "c", "d", "e");
+
+ String result = letters.stream().reduce("", (a, b) -> a + b);
+
+ assertThat(result).isEqualTo("abcde");
+ }
+
+ @Test
+ public void givenStringList_whenReduceWithConcatenatorAccumulatorMethodReference_thenCorrect() {
+ List letters = Arrays.asList("a", "b", "c", "d", "e");
+
+ String result = letters.stream().reduce("", String::concat);
+
+ assertThat(result).isEqualTo("abcde");
+ }
+
+ @Test
+ public void givenStringList_whenReduceWithUppercaseConcatenatorAccumulator_thenCorrect() {
+ List letters = Arrays.asList("a", "b", "c", "d", "e");
+
+ String result = letters.stream().reduce("", (a, b) -> a.toUpperCase() + b.toUpperCase());
+
+ assertThat(result).isEqualTo("ABCDE");
+ }
+
+ @Test
+ public void givenUserList_whenReduceWithAgeAccumulatorAndSumCombiner_thenCorrect() {
+ List users = Arrays.asList(new User("John", 30), new User("Julie", 35));
+
+ int result = users.stream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
+
+ assertThat(result).isEqualTo(65);
+ }
+
+ @Test
+ public void givenStringList_whenReduceWithParallelStream_thenCorrect() {
+ List letters = Arrays.asList("a", "b", "c", "d", "e");
+
+ String result = letters.parallelStream().reduce("", String::concat);
+
+ assertThat(result).isEqualTo("abcde");
+ }
+
+ @Test
+ public void givenNumberUtilsClass_whenCalledDivideListElements_thenCorrect() {
+ List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
+
+ assertThat(NumberUtils.divideListElements(numbers, 1)).isEqualTo(21);
+ }
+
+ @Test
+ public void givenNumberUtilsClass_whenCalledDivideListElementsWithExtractedTryCatchBlock_thenCorrect() {
+ List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
+
+ assertThat(NumberUtils.divideListElementsWithExtractedTryCatchBlock(numbers, 1)).isEqualTo(21);
+ }
+
+ @Test
+ public void givenNumberUtilsClass_whenCalledDivideListElementsWithExtractedTryCatchBlockAndListContainsZero_thenCorrect() {
+ List numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6);
+
+ assertThat(NumberUtils.divideListElementsWithExtractedTryCatchBlock(numbers, 1)).isEqualTo(21);
+ }
+
+ @Test
+ public void givenNumberUtilsClass_whenCalledDivideListElementsWithExtractedTryCatchBlockAndDividerIsZero_thenCorrect() {
+ List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
+
+ assertThat(NumberUtils.divideListElementsWithExtractedTryCatchBlock(numbers, 0)).isEqualTo(0);
+ }
+
+ @Test
+ public void givenStream_whneCalleddivideListElementsWithApplyFunctionMethod_thenCorrect() {
+ List numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
+
+ assertThat(NumberUtils.divideListElementsWithApplyFunctionMethod(numbers, 1)).isEqualTo(21);
+ }
+
+ @Test
+ public void givenTwoStreams_whenCalledReduceOnParallelizedStream_thenFasterExecutionTime() {
+ List userList = new ArrayList<>();
+ for (int i = 0; i <= 1000000; i++) {
+ userList.add(new User("John" + i, i));
+ }
+ long currentTime1 = System.currentTimeMillis();
+ userList.stream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
+ long sequentialExecutionTime = System.currentTimeMillis() -currentTime1;
+ long currentTime2 = System.currentTimeMillis();
+ userList.parallelStream().reduce(0, (partialAgeResult, user) -> partialAgeResult + user.getAge(), Integer::sum);
+ long parallelizedExecutionTime = System.currentTimeMillis() - currentTime2;
+
+ assertThat(parallelizedExecutionTime).isLessThan(sequentialExecutionTime);
+ }
+}
diff --git a/core-java-8/src/test/java/com/baeldung/time/InstantUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/time/InstantUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/time/InstantUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/time/InstantUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/time/InstantWithJMockUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/time/InstantWithJMockUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/time/InstantWithJMockUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/time/InstantWithJMockUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeWithJMockUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeWithJMockUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/time/LocalDateTimeWithJMockUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/time/LocalDateTimeWithJMockUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/typeinference/TypeInferenceUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/typeinference/TypeInferenceUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/typeinference/TypeInferenceUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/typeinference/TypeInferenceUnitTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java
rename to core-java-modules/core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java
diff --git a/core-java-8/src/test/resources/.gitignore b/core-java-modules/core-java-8/src/test/resources/.gitignore
similarity index 100%
rename from core-java-8/src/test/resources/.gitignore
rename to core-java-modules/core-java-8/src/test/resources/.gitignore
diff --git a/core-java-9/.gitignore b/core-java-modules/core-java-9/.gitignore
similarity index 100%
rename from core-java-9/.gitignore
rename to core-java-modules/core-java-9/.gitignore
diff --git a/core-java-9/README.md b/core-java-modules/core-java-9/README.md
similarity index 100%
rename from core-java-9/README.md
rename to core-java-modules/core-java-9/README.md
diff --git a/core-java-9/compile-aot.sh b/core-java-modules/core-java-9/compile-aot.sh
old mode 100755
new mode 100644
similarity index 100%
rename from core-java-9/compile-aot.sh
rename to core-java-modules/core-java-9/compile-aot.sh
diff --git a/core-java-9/compile-httpclient.bat b/core-java-modules/core-java-9/compile-httpclient.bat
similarity index 100%
rename from core-java-9/compile-httpclient.bat
rename to core-java-modules/core-java-9/compile-httpclient.bat
diff --git a/core-java-9/compile-modules.sh b/core-java-modules/core-java-9/compile-modules.sh
old mode 100755
new mode 100644
similarity index 100%
rename from core-java-9/compile-modules.sh
rename to core-java-modules/core-java-9/compile-modules.sh
diff --git a/core-java-9/compile-simple-modules.sh b/core-java-modules/core-java-9/compile-simple-modules.sh
old mode 100755
new mode 100644
similarity index 100%
rename from core-java-9/compile-simple-modules.sh
rename to core-java-modules/core-java-9/compile-simple-modules.sh
diff --git a/core-java-9/compile-student-client.bat b/core-java-modules/core-java-9/compile-student-client.bat
similarity index 100%
rename from core-java-9/compile-student-client.bat
rename to core-java-modules/core-java-9/compile-student-client.bat
diff --git a/core-java-9/compile-student-model.bat b/core-java-modules/core-java-9/compile-student-model.bat
similarity index 100%
rename from core-java-9/compile-student-model.bat
rename to core-java-modules/core-java-9/compile-student-model.bat
diff --git a/core-java-9/compile-student-service-dbimpl.bat b/core-java-modules/core-java-9/compile-student-service-dbimpl.bat
similarity index 100%
rename from core-java-9/compile-student-service-dbimpl.bat
rename to core-java-modules/core-java-9/compile-student-service-dbimpl.bat
diff --git a/core-java-9/compile-student-service.bat b/core-java-modules/core-java-9/compile-student-service.bat
similarity index 100%
rename from core-java-9/compile-student-service.bat
rename to core-java-modules/core-java-9/compile-student-service.bat
diff --git a/core-java-9/logging.sh b/core-java-modules/core-java-9/logging.sh
old mode 100755
new mode 100644
similarity index 100%
rename from core-java-9/logging.sh
rename to core-java-modules/core-java-9/logging.sh
diff --git a/core-java-9/mods/logback.xml b/core-java-modules/core-java-9/mods/logback.xml
similarity index 100%
rename from core-java-9/mods/logback.xml
rename to core-java-modules/core-java-9/mods/logback.xml
diff --git a/core-java-9/pom.xml b/core-java-modules/core-java-9/pom.xml
similarity index 98%
rename from core-java-9/pom.xml
rename to core-java-modules/core-java-9/pom.xml
index cd1fa74dbb..aee289c79f 100644
--- a/core-java-9/pom.xml
+++ b/core-java-modules/core-java-9/pom.xml
@@ -9,6 +9,7 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
+ ../../
diff --git a/core-java-9/run-aot.sh b/core-java-modules/core-java-9/run-aot.sh
old mode 100755
new mode 100644
similarity index 100%
rename from core-java-9/run-aot.sh
rename to core-java-modules/core-java-9/run-aot.sh
diff --git a/core-java-9/run-httpclient.bat b/core-java-modules/core-java-9/run-httpclient.bat
similarity index 100%
rename from core-java-9/run-httpclient.bat
rename to core-java-modules/core-java-9/run-httpclient.bat
diff --git a/core-java-9/run-simple-module-app.sh b/core-java-modules/core-java-9/run-simple-module-app.sh
old mode 100755
new mode 100644
similarity index 100%
rename from core-java-9/run-simple-module-app.sh
rename to core-java-modules/core-java-9/run-simple-module-app.sh
diff --git a/core-java-9/run-student-client.bat b/core-java-modules/core-java-9/run-student-client.bat
similarity index 100%
rename from core-java-9/run-student-client.bat
rename to core-java-modules/core-java-9/run-student-client.bat
diff --git a/core-java-9/run-student-client.sh b/core-java-modules/core-java-9/run-student-client.sh
old mode 100755
new mode 100644
similarity index 100%
rename from core-java-9/run-student-client.sh
rename to core-java-modules/core-java-9/run-student-client.sh
diff --git a/core-java-9/src/main/java/.gitignore b/core-java-modules/core-java-9/src/main/java/.gitignore
similarity index 100%
rename from core-java-9/src/main/java/.gitignore
rename to core-java-modules/core-java-9/src/main/java/.gitignore
diff --git a/core-java-9/src/main/java/com/baeldung/java9/aot/JaotCompilation.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/aot/JaotCompilation.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/aot/JaotCompilation.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/aot/JaotCompilation.java
diff --git a/core-java-9/src/main/java/com/baeldung/java9/language/PrivateInterface.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/language/PrivateInterface.java
similarity index 96%
rename from core-java-9/src/main/java/com/baeldung/java9/language/PrivateInterface.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/language/PrivateInterface.java
index f7b2fad891..3055f82fdb 100644
--- a/core-java-9/src/main/java/com/baeldung/java9/language/PrivateInterface.java
+++ b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/language/PrivateInterface.java
@@ -1,23 +1,23 @@
-package com.baeldung.java9.language;
-
-public interface PrivateInterface {
-
- private static String staticPrivate() {
- return "static private";
- }
-
- private String instancePrivate() {
- return "instance private";
- }
-
- public default void check() {
- String result = staticPrivate();
- if (!result.equals("static private"))
- throw new AssertionError("Incorrect result for static private interface method");
- PrivateInterface pvt = new PrivateInterface() {
- };
- result = pvt.instancePrivate();
- if (!result.equals("instance private"))
- throw new AssertionError("Incorrect result for instance private interface method");
- }
-}
+package com.baeldung.java9.language;
+
+public interface PrivateInterface {
+
+ private static String staticPrivate() {
+ return "static private";
+ }
+
+ private String instancePrivate() {
+ return "instance private";
+ }
+
+ public default void check() {
+ String result = staticPrivate();
+ if (!result.equals("static private"))
+ throw new AssertionError("Incorrect result for static private interface method");
+ PrivateInterface pvt = new PrivateInterface() {
+ };
+ result = pvt.instancePrivate();
+ if (!result.equals("instance private"))
+ throw new AssertionError("Incorrect result for instance private interface method");
+ }
+}
diff --git a/core-java-9/src/main/java/com/baeldung/java9/language/stream/StreamsGroupingCollectionFilter.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/language/stream/StreamsGroupingCollectionFilter.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/language/stream/StreamsGroupingCollectionFilter.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/language/stream/StreamsGroupingCollectionFilter.java
diff --git a/core-java-9/src/main/java/com/baeldung/java9/maps/initialize/MapsInitializer.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/maps/initialize/MapsInitializer.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/maps/initialize/MapsInitializer.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/maps/initialize/MapsInitializer.java
diff --git a/core-java-9/src/main/java/com/baeldung/java9/methodhandles/Book.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/methodhandles/Book.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/methodhandles/Book.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/methodhandles/Book.java
diff --git a/core-java-9/src/main/java/com/baeldung/java9/rangedates/DatesCollectionIteration.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/rangedates/DatesCollectionIteration.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/rangedates/DatesCollectionIteration.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/rangedates/DatesCollectionIteration.java
diff --git a/core-java-9/src/main/java/com/baeldung/java9/rangedates/RangeDatesIteration.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/rangedates/RangeDatesIteration.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/rangedates/RangeDatesIteration.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/rangedates/RangeDatesIteration.java
diff --git a/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImpl.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImpl.java
similarity index 96%
rename from core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImpl.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImpl.java
index 46eee4883a..962df447b6 100644
--- a/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImpl.java
+++ b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImpl.java
@@ -1,82 +1,82 @@
-package com.baeldung.java9.reactive;
-
-import java.util.ArrayList;
-import java.util.concurrent.Flow.Subscriber;
-import java.util.concurrent.Flow.Subscription;
-
-public class BaeldungBatchSubscriberImpl implements Subscriber {
- private Subscription subscription;
- private boolean completed = false;
- private int counter;
- private ArrayList buffer;
- public static final int BUFFER_SIZE = 5;
-
- public BaeldungBatchSubscriberImpl() {
- buffer = new ArrayList();
- }
-
- public boolean isCompleted() {
- return completed;
- }
-
- public void setCompleted(boolean completed) {
- this.completed = completed;
- }
-
- public int getCounter() {
- return counter;
- }
-
- public void setCounter(int counter) {
- this.counter = counter;
- }
-
- @Override
- public void onSubscribe(Subscription subscription) {
- this.subscription = subscription;
- subscription.request(BUFFER_SIZE);
- }
-
- @Override
- public void onNext(String item) {
- buffer.add(item);
- // if buffer is full, process the items.
- if (buffer.size() >= BUFFER_SIZE) {
- processBuffer();
- }
- //request more items.
- subscription.request(1);
- }
-
- private void processBuffer() {
- if (buffer.isEmpty())
- return;
- // Process all items in the buffer. Here, we just print it and sleep for 1 second.
- System.out.print("Processed items: ");
- buffer.stream()
- .forEach(item -> {
- System.out.print(" " + item);
- });
- System.out.println();
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- counter = counter + buffer.size();
- buffer.clear();
- }
-
- @Override
- public void onError(Throwable t) {
- t.printStackTrace();
- }
-
- @Override
- public void onComplete() {
- completed = true;
- // process any remaining items in buffer before
- processBuffer();
- subscription.cancel();
- }
-}
+package com.baeldung.java9.reactive;
+
+import java.util.ArrayList;
+import java.util.concurrent.Flow.Subscriber;
+import java.util.concurrent.Flow.Subscription;
+
+public class BaeldungBatchSubscriberImpl implements Subscriber {
+ private Subscription subscription;
+ private boolean completed = false;
+ private int counter;
+ private ArrayList buffer;
+ public static final int BUFFER_SIZE = 5;
+
+ public BaeldungBatchSubscriberImpl() {
+ buffer = new ArrayList();
+ }
+
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ public void setCompleted(boolean completed) {
+ this.completed = completed;
+ }
+
+ public int getCounter() {
+ return counter;
+ }
+
+ public void setCounter(int counter) {
+ this.counter = counter;
+ }
+
+ @Override
+ public void onSubscribe(Subscription subscription) {
+ this.subscription = subscription;
+ subscription.request(BUFFER_SIZE);
+ }
+
+ @Override
+ public void onNext(String item) {
+ buffer.add(item);
+ // if buffer is full, process the items.
+ if (buffer.size() >= BUFFER_SIZE) {
+ processBuffer();
+ }
+ //request more items.
+ subscription.request(1);
+ }
+
+ private void processBuffer() {
+ if (buffer.isEmpty())
+ return;
+ // Process all items in the buffer. Here, we just print it and sleep for 1 second.
+ System.out.print("Processed items: ");
+ buffer.stream()
+ .forEach(item -> {
+ System.out.print(" " + item);
+ });
+ System.out.println();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ counter = counter + buffer.size();
+ buffer.clear();
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ t.printStackTrace();
+ }
+
+ @Override
+ public void onComplete() {
+ completed = true;
+ // process any remaining items in buffer before
+ processBuffer();
+ subscription.cancel();
+ }
+}
diff --git a/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungSubscriberImpl.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungSubscriberImpl.java
similarity index 95%
rename from core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungSubscriberImpl.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungSubscriberImpl.java
index bacd777255..3534324675 100644
--- a/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungSubscriberImpl.java
+++ b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/reactive/BaeldungSubscriberImpl.java
@@ -1,55 +1,55 @@
-package com.baeldung.java9.reactive;
-
-import java.util.concurrent.Flow.Subscriber;
-import java.util.concurrent.Flow.Subscription;
-
-public class BaeldungSubscriberImpl implements Subscriber {
- private Subscription subscription;
- private boolean completed = false;
- private int counter;
-
- public boolean isCompleted() {
- return completed;
- }
-
- public void setCompleted(boolean completed) {
- this.completed = completed;
- }
-
- public int getCounter() {
- return counter;
- }
-
- public void setCounter(int counter) {
- this.counter = counter;
- }
-
- @Override
- public void onSubscribe(Subscription subscription) {
- this.subscription = subscription;
- subscription.request(1);
- }
-
- @Override
- public void onNext(String item) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- counter++;
- System.out.println("Processed item : " + item);
- subscription.request(1);
- }
-
- @Override
- public void onError(Throwable t) {
- t.printStackTrace();
- }
-
- @Override
- public void onComplete() {
- completed = true;
- subscription.cancel();
- }
-}
+package com.baeldung.java9.reactive;
+
+import java.util.concurrent.Flow.Subscriber;
+import java.util.concurrent.Flow.Subscription;
+
+public class BaeldungSubscriberImpl implements Subscriber {
+ private Subscription subscription;
+ private boolean completed = false;
+ private int counter;
+
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ public void setCompleted(boolean completed) {
+ this.completed = completed;
+ }
+
+ public int getCounter() {
+ return counter;
+ }
+
+ public void setCounter(int counter) {
+ this.counter = counter;
+ }
+
+ @Override
+ public void onSubscribe(Subscription subscription) {
+ this.subscription = subscription;
+ subscription.request(1);
+ }
+
+ @Override
+ public void onNext(String item) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ counter++;
+ System.out.println("Processed item : " + item);
+ subscription.request(1);
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ t.printStackTrace();
+ }
+
+ @Override
+ public void onComplete() {
+ completed = true;
+ subscription.cancel();
+ }
+}
diff --git a/core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java
diff --git a/core-java-9/src/main/java/com/baeldung/java9/stackwalker/StackWalkerDemo.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/stackwalker/StackWalkerDemo.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/stackwalker/StackWalkerDemo.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/stackwalker/StackWalkerDemo.java
diff --git a/core-java-9/src/main/java/com/baeldung/java9/streams.reactive/EndSubscriber.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/streams.reactive/EndSubscriber.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/streams.reactive/EndSubscriber.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/streams.reactive/EndSubscriber.java
diff --git a/core-java-9/src/main/java/com/baeldung/java9/streams.reactive/TransformProcessor.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/streams.reactive/TransformProcessor.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/java9/streams.reactive/TransformProcessor.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/java9/streams.reactive/TransformProcessor.java
diff --git a/core-java-9/src/main/java/com/baeldung/multireleaseapp/App.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/multireleaseapp/App.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/multireleaseapp/App.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/multireleaseapp/App.java
diff --git a/core-java-9/src/main/java/com/baeldung/multireleaseapp/DateHelper.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/multireleaseapp/DateHelper.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/multireleaseapp/DateHelper.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/multireleaseapp/DateHelper.java
diff --git a/core-java-9/src/main/java/com/baeldung/optionals/Optionals.java b/core-java-modules/core-java-9/src/main/java/com/baeldung/optionals/Optionals.java
similarity index 100%
rename from core-java-9/src/main/java/com/baeldung/optionals/Optionals.java
rename to core-java-modules/core-java-9/src/main/java/com/baeldung/optionals/Optionals.java
diff --git a/core-java-9/src/main/java9/com/baeldung/multireleaseapp/DateHelper.java b/core-java-modules/core-java-9/src/main/java9/com/baeldung/multireleaseapp/DateHelper.java
similarity index 100%
rename from core-java-9/src/main/java9/com/baeldung/multireleaseapp/DateHelper.java
rename to core-java-modules/core-java-9/src/main/java9/com/baeldung/multireleaseapp/DateHelper.java
diff --git a/core-java-9/src/main/resources/logback.xml b/core-java-modules/core-java-9/src/main/resources/logback.xml
similarity index 100%
rename from core-java-9/src/main/resources/logback.xml
rename to core-java-modules/core-java-9/src/main/resources/logback.xml
diff --git a/core-java-9/src/modules/com.baeldung.httpclient/com/baeldung/httpclient/HttpClientExample.java b/core-java-modules/core-java-9/src/modules/com.baeldung.httpclient/com/baeldung/httpclient/HttpClientExample.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.httpclient/com/baeldung/httpclient/HttpClientExample.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.httpclient/com/baeldung/httpclient/HttpClientExample.java
diff --git a/core-java-9/src/modules/com.baeldung.httpclient/module-info.java b/core-java-modules/core-java-9/src/modules/com.baeldung.httpclient/module-info.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.httpclient/module-info.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.httpclient/module-info.java
diff --git a/core-java-9/src/modules/com.baeldung.logging.app/com/baeldung/logging/app/MainApp.java b/core-java-modules/core-java-9/src/modules/com.baeldung.logging.app/com/baeldung/logging/app/MainApp.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.logging.app/com/baeldung/logging/app/MainApp.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.logging.app/com/baeldung/logging/app/MainApp.java
diff --git a/core-java-9/src/modules/com.baeldung.logging.app/module-info.java b/core-java-modules/core-java-9/src/modules/com.baeldung.logging.app/module-info.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.logging.app/module-info.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.logging.app/module-info.java
diff --git a/core-java-9/src/modules/com.baeldung.logging.slf4j/com/baeldung/logging/slf4j/Slf4jLogger.java b/core-java-modules/core-java-9/src/modules/com.baeldung.logging.slf4j/com/baeldung/logging/slf4j/Slf4jLogger.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.logging.slf4j/com/baeldung/logging/slf4j/Slf4jLogger.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.logging.slf4j/com/baeldung/logging/slf4j/Slf4jLogger.java
diff --git a/core-java-9/src/modules/com.baeldung.logging.slf4j/com/baeldung/logging/slf4j/Slf4jLoggerFinder.java b/core-java-modules/core-java-9/src/modules/com.baeldung.logging.slf4j/com/baeldung/logging/slf4j/Slf4jLoggerFinder.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.logging.slf4j/com/baeldung/logging/slf4j/Slf4jLoggerFinder.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.logging.slf4j/com/baeldung/logging/slf4j/Slf4jLoggerFinder.java
diff --git a/core-java-9/src/modules/com.baeldung.logging.slf4j/module-info.java b/core-java-modules/core-java-9/src/modules/com.baeldung.logging.slf4j/module-info.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.logging.slf4j/module-info.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.logging.slf4j/module-info.java
diff --git a/core-java-9/src/modules/com.baeldung.logging/com/baeldung/logging/ConsoleLogger.java b/core-java-modules/core-java-9/src/modules/com.baeldung.logging/com/baeldung/logging/ConsoleLogger.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.logging/com/baeldung/logging/ConsoleLogger.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.logging/com/baeldung/logging/ConsoleLogger.java
diff --git a/core-java-9/src/modules/com.baeldung.logging/com/baeldung/logging/CustomLoggerFinder.java b/core-java-modules/core-java-9/src/modules/com.baeldung.logging/com/baeldung/logging/CustomLoggerFinder.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.logging/com/baeldung/logging/CustomLoggerFinder.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.logging/com/baeldung/logging/CustomLoggerFinder.java
diff --git a/core-java-9/src/modules/com.baeldung.logging/module-info.java b/core-java-modules/core-java-9/src/modules/com.baeldung.logging/module-info.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.logging/module-info.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.logging/module-info.java
diff --git a/core-java-9/src/modules/com.baeldung.student.client/com/baeldung/student/client/StudentClient.java b/core-java-modules/core-java-9/src/modules/com.baeldung.student.client/com/baeldung/student/client/StudentClient.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.student.client/com/baeldung/student/client/StudentClient.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.student.client/com/baeldung/student/client/StudentClient.java
diff --git a/core-java-9/src/modules/com.baeldung.student.client/module-info.java b/core-java-modules/core-java-9/src/modules/com.baeldung.student.client/module-info.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.student.client/module-info.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.student.client/module-info.java
diff --git a/core-java-9/src/modules/com.baeldung.student.model/com/baeldung/student/model/Student.java b/core-java-modules/core-java-9/src/modules/com.baeldung.student.model/com/baeldung/student/model/Student.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.student.model/com/baeldung/student/model/Student.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.student.model/com/baeldung/student/model/Student.java
diff --git a/core-java-9/src/modules/com.baeldung.student.model/module-info.java b/core-java-modules/core-java-9/src/modules/com.baeldung.student.model/module-info.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.student.model/module-info.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.student.model/module-info.java
diff --git a/core-java-9/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java b/core-java-modules/core-java-9/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java
diff --git a/core-java-9/src/modules/com.baeldung.student.service.dbimpl/module-info.java b/core-java-modules/core-java-9/src/modules/com.baeldung.student.service.dbimpl/module-info.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.student.service.dbimpl/module-info.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.student.service.dbimpl/module-info.java
diff --git a/core-java-9/src/modules/com.baeldung.student.service/com/baeldung/student/service/StudentService.java b/core-java-modules/core-java-9/src/modules/com.baeldung.student.service/com/baeldung/student/service/StudentService.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.student.service/com/baeldung/student/service/StudentService.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.student.service/com/baeldung/student/service/StudentService.java
diff --git a/core-java-9/src/modules/com.baeldung.student.service/module-info.java b/core-java-modules/core-java-9/src/modules/com.baeldung.student.service/module-info.java
similarity index 100%
rename from core-java-9/src/modules/com.baeldung.student.service/module-info.java
rename to core-java-modules/core-java-9/src/modules/com.baeldung.student.service/module-info.java
diff --git a/core-java-9/src/simple-modules/hello.modules/com/baeldung/modules/hello/HelloInterface.java b/core-java-modules/core-java-9/src/simple-modules/hello.modules/com/baeldung/modules/hello/HelloInterface.java
similarity index 100%
rename from core-java-9/src/simple-modules/hello.modules/com/baeldung/modules/hello/HelloInterface.java
rename to core-java-modules/core-java-9/src/simple-modules/hello.modules/com/baeldung/modules/hello/HelloInterface.java
diff --git a/core-java-9/src/simple-modules/hello.modules/com/baeldung/modules/hello/HelloModules.java b/core-java-modules/core-java-9/src/simple-modules/hello.modules/com/baeldung/modules/hello/HelloModules.java
similarity index 100%
rename from core-java-9/src/simple-modules/hello.modules/com/baeldung/modules/hello/HelloModules.java
rename to core-java-modules/core-java-9/src/simple-modules/hello.modules/com/baeldung/modules/hello/HelloModules.java
diff --git a/core-java-9/src/simple-modules/hello.modules/module-info.java b/core-java-modules/core-java-9/src/simple-modules/hello.modules/module-info.java
similarity index 100%
rename from core-java-9/src/simple-modules/hello.modules/module-info.java
rename to core-java-modules/core-java-9/src/simple-modules/hello.modules/module-info.java
diff --git a/core-java-9/src/simple-modules/main.app/com/baeldung/modules/main/MainApp.java b/core-java-modules/core-java-9/src/simple-modules/main.app/com/baeldung/modules/main/MainApp.java
similarity index 100%
rename from core-java-9/src/simple-modules/main.app/com/baeldung/modules/main/MainApp.java
rename to core-java-modules/core-java-9/src/simple-modules/main.app/com/baeldung/modules/main/MainApp.java
diff --git a/core-java-9/src/simple-modules/main.app/module-info.java b/core-java-modules/core-java-9/src/simple-modules/main.app/module-info.java
similarity index 100%
rename from core-java-9/src/simple-modules/main.app/module-info.java
rename to core-java-modules/core-java-9/src/simple-modules/main.app/module-info.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/Java9OptionalTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/Java9OptionalTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/Java9OptionalTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/Java9OptionalTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/Java9OptionalsStreamUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/Java9OptionalsStreamUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/Java9OptionalsStreamUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/Java9OptionalsStreamUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/MultiResultionImageUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/MultiResultionImageUnitTest.java
similarity index 97%
rename from core-java-9/src/test/java/com/baeldung/java9/MultiResultionImageUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/MultiResultionImageUnitTest.java
index 2c383a44b4..442d85e3f2 100644
--- a/core-java-9/src/test/java/com/baeldung/java9/MultiResultionImageUnitTest.java
+++ b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/MultiResultionImageUnitTest.java
@@ -1,44 +1,44 @@
-package com.baeldung.java9;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.awt.Image;
-import java.awt.image.BaseMultiResolutionImage;
-import java.awt.image.BufferedImage;
-import java.awt.image.MultiResolutionImage;
-import java.util.List;
-
-import org.junit.Test;
-
-public class MultiResultionImageUnitTest {
-
- @Test
- public void baseMultiResImageTest() {
- int baseIndex = 1;
- int length = 4;
- BufferedImage[] resolutionVariants = new BufferedImage[length];
- for (int i = 0; i < length; i++) {
- resolutionVariants[i] = createImage(i);
- }
- MultiResolutionImage bmrImage = new BaseMultiResolutionImage(baseIndex, resolutionVariants);
- List rvImageList = bmrImage.getResolutionVariants();
- assertEquals("MultiResoltion Image shoudl contain the same number of resolution variants!", rvImageList.size(), length);
-
- for (int i = 0; i < length; i++) {
- int imageSize = getSize(i);
- Image testRVImage = bmrImage.getResolutionVariant(imageSize, imageSize);
- assertSame("Images should be the same", testRVImage, resolutionVariants[i]);
- }
-
- }
-
- private static int getSize(int i) {
- return 8 * (i + 1);
- }
-
- private static BufferedImage createImage(int i) {
- return new BufferedImage(getSize(i), getSize(i), BufferedImage.TYPE_INT_RGB);
- }
-
-}
+package com.baeldung.java9;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.awt.Image;
+import java.awt.image.BaseMultiResolutionImage;
+import java.awt.image.BufferedImage;
+import java.awt.image.MultiResolutionImage;
+import java.util.List;
+
+import org.junit.Test;
+
+public class MultiResultionImageUnitTest {
+
+ @Test
+ public void baseMultiResImageTest() {
+ int baseIndex = 1;
+ int length = 4;
+ BufferedImage[] resolutionVariants = new BufferedImage[length];
+ for (int i = 0; i < length; i++) {
+ resolutionVariants[i] = createImage(i);
+ }
+ MultiResolutionImage bmrImage = new BaseMultiResolutionImage(baseIndex, resolutionVariants);
+ List rvImageList = bmrImage.getResolutionVariants();
+ assertEquals("MultiResoltion Image shoudl contain the same number of resolution variants!", rvImageList.size(), length);
+
+ for (int i = 0; i < length; i++) {
+ int imageSize = getSize(i);
+ Image testRVImage = bmrImage.getResolutionVariant(imageSize, imageSize);
+ assertSame("Images should be the same", testRVImage, resolutionVariants[i]);
+ }
+
+ }
+
+ private static int getSize(int i) {
+ return 8 * (i + 1);
+ }
+
+ private static BufferedImage createImage(int i) {
+ return new BufferedImage(getSize(i), getSize(i), BufferedImage.TYPE_INT_RGB);
+ }
+
+}
diff --git a/core-java-9/src/test/java/com/baeldung/java9/OptionalToStreamUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/OptionalToStreamUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/OptionalToStreamUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/OptionalToStreamUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/README.MD b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/README.MD
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/README.MD
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/README.MD
diff --git a/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/concurrent/future/CompletableFutureUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/concurrent/future/CompletableFutureUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/concurrent/future/CompletableFutureUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/concurrent/future/CompletableFutureUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpClientTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpClientTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpClientTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpClientTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpRequestTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpRequestTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpRequestTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpRequestTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpResponseTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpResponseTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpResponseTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/httpclient/HttpResponseTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/DiamondUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/DiamondUnitTest.java
similarity index 95%
rename from core-java-9/src/test/java/com/baeldung/java9/language/DiamondUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/DiamondUnitTest.java
index 4868d37b6a..b1cb4ef63b 100644
--- a/core-java-9/src/test/java/com/baeldung/java9/language/DiamondUnitTest.java
+++ b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/DiamondUnitTest.java
@@ -1,36 +1,36 @@
-package com.baeldung.java9.language;
-
-import org.junit.Test;
-
-public class DiamondUnitTest {
-
- static class FooClass {
- FooClass(X x) {
- }
-
- FooClass(X x, Z z) {
- }
- }
-
- @Test
- public void diamondTest() {
- FooClass fc = new FooClass<>(1) {
- };
- FooClass extends Integer> fc0 = new FooClass<>(1) {
- };
- FooClass> fc1 = new FooClass<>(1) {
- };
- FooClass super Integer> fc2 = new FooClass<>(1) {
- };
-
- FooClass fc3 = new FooClass<>(1, "") {
- };
- FooClass extends Integer> fc4 = new FooClass<>(1, "") {
- };
- FooClass> fc5 = new FooClass<>(1, "") {
- };
- FooClass super Integer> fc6 = new FooClass<>(1, "") {
- };
-
- }
-}
+package com.baeldung.java9.language;
+
+import org.junit.Test;
+
+public class DiamondUnitTest {
+
+ static class FooClass {
+ FooClass(X x) {
+ }
+
+ FooClass(X x, Z z) {
+ }
+ }
+
+ @Test
+ public void diamondTest() {
+ FooClass fc = new FooClass<>(1) {
+ };
+ FooClass extends Integer> fc0 = new FooClass<>(1) {
+ };
+ FooClass> fc1 = new FooClass<>(1) {
+ };
+ FooClass super Integer> fc2 = new FooClass<>(1) {
+ };
+
+ FooClass fc3 = new FooClass<>(1, "") {
+ };
+ FooClass extends Integer> fc4 = new FooClass<>(1, "") {
+ };
+ FooClass> fc5 = new FooClass<>(1, "") {
+ };
+ FooClass super Integer> fc6 = new FooClass<>(1, "") {
+ };
+
+ }
+}
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/Java9ObjectsAPIUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/Java9ObjectsAPIUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/language/Java9ObjectsAPIUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/Java9ObjectsAPIUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/PrivateInterfaceUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/PrivateInterfaceUnitTest.java
similarity index 95%
rename from core-java-9/src/test/java/com/baeldung/java9/language/PrivateInterfaceUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/PrivateInterfaceUnitTest.java
index fb00fe45c3..08aee72f6e 100644
--- a/core-java-9/src/test/java/com/baeldung/java9/language/PrivateInterfaceUnitTest.java
+++ b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/PrivateInterfaceUnitTest.java
@@ -1,15 +1,15 @@
-package com.baeldung.java9.language;
-
-import com.baeldung.java9.language.PrivateInterface;
-import org.junit.Test;
-
-public class PrivateInterfaceUnitTest {
-
- @Test
- public void test() {
- PrivateInterface piClass = new PrivateInterface() {
- };
- piClass.check();
- }
-
-}
+package com.baeldung.java9.language;
+
+import com.baeldung.java9.language.PrivateInterface;
+import org.junit.Test;
+
+public class PrivateInterfaceUnitTest {
+
+ @Test
+ public void test() {
+ PrivateInterface piClass = new PrivateInterface() {
+ };
+ piClass.check();
+ }
+
+}
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/TryWithResourcesUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/TryWithResourcesUnitTest.java
similarity index 96%
rename from core-java-9/src/test/java/com/baeldung/java9/language/TryWithResourcesUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/TryWithResourcesUnitTest.java
index d623bd9965..9afa1c90dd 100644
--- a/core-java-9/src/test/java/com/baeldung/java9/language/TryWithResourcesUnitTest.java
+++ b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/TryWithResourcesUnitTest.java
@@ -1,67 +1,67 @@
-package com.baeldung.java9.language;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class TryWithResourcesUnitTest {
-
- static int closeCount = 0;
-
- static class MyAutoCloseable implements AutoCloseable {
- final FinalWrapper finalWrapper = new FinalWrapper();
-
- public void close() {
- closeCount++;
- }
-
- static class FinalWrapper {
- public final AutoCloseable finalCloseable = new AutoCloseable() {
- @Override
- public void close() throws Exception {
- closeCount++;
- }
- };
- }
- }
-
- @Test
- public void tryWithResourcesTest() {
- MyAutoCloseable mac = new MyAutoCloseable();
-
- try (mac) {
- assertEquals("Expected and Actual does not match", 0, closeCount);
- }
-
- try (mac.finalWrapper.finalCloseable) {
- assertEquals("Expected and Actual does not match", 1, closeCount);
- } catch (Exception ex) {
- }
-
- try (new MyAutoCloseable() { }.finalWrapper.finalCloseable) {
- assertEquals("Expected and Actual does not match", 2, closeCount);
- } catch (Exception ex) {
- }
-
- try ((closeCount > 0 ? mac : new MyAutoCloseable()).finalWrapper.finalCloseable) {
- assertEquals("Expected and Actual does not match", 3, closeCount);
- } catch (Exception ex) {
- }
-
- try {
- throw new CloseableException();
- } catch (CloseableException ex) {
- try (ex) {
- assertEquals("Expected and Actual does not match", 4, closeCount);
- }
- }
- assertEquals("Expected and Actual does not match", 5, closeCount);
- }
-
- static class CloseableException extends Exception implements AutoCloseable {
- @Override
- public void close() {
- closeCount++;
- }
- }
-
-}
+package com.baeldung.java9.language;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class TryWithResourcesUnitTest {
+
+ static int closeCount = 0;
+
+ static class MyAutoCloseable implements AutoCloseable {
+ final FinalWrapper finalWrapper = new FinalWrapper();
+
+ public void close() {
+ closeCount++;
+ }
+
+ static class FinalWrapper {
+ public final AutoCloseable finalCloseable = new AutoCloseable() {
+ @Override
+ public void close() throws Exception {
+ closeCount++;
+ }
+ };
+ }
+ }
+
+ @Test
+ public void tryWithResourcesTest() {
+ MyAutoCloseable mac = new MyAutoCloseable();
+
+ try (mac) {
+ assertEquals("Expected and Actual does not match", 0, closeCount);
+ }
+
+ try (mac.finalWrapper.finalCloseable) {
+ assertEquals("Expected and Actual does not match", 1, closeCount);
+ } catch (Exception ex) {
+ }
+
+ try (new MyAutoCloseable() { }.finalWrapper.finalCloseable) {
+ assertEquals("Expected and Actual does not match", 2, closeCount);
+ } catch (Exception ex) {
+ }
+
+ try ((closeCount > 0 ? mac : new MyAutoCloseable()).finalWrapper.finalCloseable) {
+ assertEquals("Expected and Actual does not match", 3, closeCount);
+ } catch (Exception ex) {
+ }
+
+ try {
+ throw new CloseableException();
+ } catch (CloseableException ex) {
+ try (ex) {
+ assertEquals("Expected and Actual does not match", 4, closeCount);
+ }
+ }
+ assertEquals("Expected and Actual does not match", 5, closeCount);
+ }
+
+ static class CloseableException extends Exception implements AutoCloseable {
+ @Override
+ public void close() {
+ closeCount++;
+ }
+ }
+
+}
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/collections/ListFactoryMethodsUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/collections/ListFactoryMethodsUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/language/collections/ListFactoryMethodsUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/collections/ListFactoryMethodsUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/collections/MapFactoryMethodsUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/collections/MapFactoryMethodsUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/language/collections/MapFactoryMethodsUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/collections/MapFactoryMethodsUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/collections/SetFactoryMethodsUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/collections/SetFactoryMethodsUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/language/collections/SetFactoryMethodsUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/collections/SetFactoryMethodsUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/stream/CollectionFilterUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/stream/CollectionFilterUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/language/stream/CollectionFilterUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/stream/CollectionFilterUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/stream/CollectorImprovementUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/stream/CollectorImprovementUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/language/stream/CollectorImprovementUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/stream/CollectorImprovementUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/language/stream/StreamFeaturesUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/stream/StreamFeaturesUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/language/stream/StreamFeaturesUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/language/stream/StreamFeaturesUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/modules/ModuleAPIUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/modules/ModuleAPIUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/modules/ModuleAPIUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/modules/ModuleAPIUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/rangedates/DatesCollectionIterationUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/rangedates/DatesCollectionIterationUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/rangedates/DatesCollectionIterationUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/rangedates/DatesCollectionIterationUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/rangedates/RangeDatesIterationUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/rangedates/RangeDatesIterationUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/rangedates/RangeDatesIterationUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/rangedates/RangeDatesIterationUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImplIntegrationTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImplIntegrationTest.java
similarity index 96%
rename from core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImplIntegrationTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImplIntegrationTest.java
index cbc3946999..15dc13ec71 100644
--- a/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImplIntegrationTest.java
+++ b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungBatchSubscriberImplIntegrationTest.java
@@ -1,75 +1,75 @@
-package com.baeldung.java9.reactive;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.SubmissionPublisher;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.IntStream;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.Stopwatch;
-
-public class BaeldungBatchSubscriberImplIntegrationTest {
-
- private static final int ITEM_SIZE = 10;
- private SubmissionPublisher publisher;
- private BaeldungBatchSubscriberImpl subscriber;
-
- @Before
- public void initialize() {
- this.publisher = new SubmissionPublisher(ForkJoinPool.commonPool(), 6);
- this.subscriber = new BaeldungBatchSubscriberImpl();
- publisher.subscribe(subscriber);
- }
-
- @Rule
- public Stopwatch stopwatch = new Stopwatch() {
-
- };
-
- @Test
- public void testReactiveStreamCount() {
- IntStream.range(0, ITEM_SIZE)
- .forEach(item -> publisher.submit(item + ""));
- publisher.close();
-
- do {
- // wait for subscribers to complete all processing.
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } while (!subscriber.isCompleted());
-
- int count = subscriber.getCounter();
-
- assertEquals(ITEM_SIZE, count);
- }
-
- @Test
- public void testReactiveStreamTime() {
- IntStream.range(0, ITEM_SIZE)
- .forEach(item -> publisher.submit(item + ""));
- publisher.close();
-
- do {
- // wait for subscribers to complete all processing.
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } while (!subscriber.isCompleted());
-
- // The runtime in seconds should be equal to the number of items in each batch.
- assertTrue(stopwatch.runtime(TimeUnit.SECONDS) >= (ITEM_SIZE / subscriber.BUFFER_SIZE));
- }
-
-}
+package com.baeldung.java9.reactive;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.SubmissionPublisher;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.IntStream;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.Stopwatch;
+
+public class BaeldungBatchSubscriberImplIntegrationTest {
+
+ private static final int ITEM_SIZE = 10;
+ private SubmissionPublisher publisher;
+ private BaeldungBatchSubscriberImpl subscriber;
+
+ @Before
+ public void initialize() {
+ this.publisher = new SubmissionPublisher(ForkJoinPool.commonPool(), 6);
+ this.subscriber = new BaeldungBatchSubscriberImpl();
+ publisher.subscribe(subscriber);
+ }
+
+ @Rule
+ public Stopwatch stopwatch = new Stopwatch() {
+
+ };
+
+ @Test
+ public void testReactiveStreamCount() {
+ IntStream.range(0, ITEM_SIZE)
+ .forEach(item -> publisher.submit(item + ""));
+ publisher.close();
+
+ do {
+ // wait for subscribers to complete all processing.
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } while (!subscriber.isCompleted());
+
+ int count = subscriber.getCounter();
+
+ assertEquals(ITEM_SIZE, count);
+ }
+
+ @Test
+ public void testReactiveStreamTime() {
+ IntStream.range(0, ITEM_SIZE)
+ .forEach(item -> publisher.submit(item + ""));
+ publisher.close();
+
+ do {
+ // wait for subscribers to complete all processing.
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } while (!subscriber.isCompleted());
+
+ // The runtime in seconds should be equal to the number of items in each batch.
+ assertTrue(stopwatch.runtime(TimeUnit.SECONDS) >= (ITEM_SIZE / subscriber.BUFFER_SIZE));
+ }
+
+}
diff --git a/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungSubscriberImplIntegrationTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungSubscriberImplIntegrationTest.java
similarity index 96%
rename from core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungSubscriberImplIntegrationTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungSubscriberImplIntegrationTest.java
index 6fd093b362..84877db500 100644
--- a/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungSubscriberImplIntegrationTest.java
+++ b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/reactive/BaeldungSubscriberImplIntegrationTest.java
@@ -1,100 +1,100 @@
-package com.baeldung.java9.reactive;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.SubmissionPublisher;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.IntStream;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.Stopwatch;
-
-public class BaeldungSubscriberImplIntegrationTest {
-
- private static final int ITEM_SIZE = 10;
- private SubmissionPublisher publisher;
- private BaeldungSubscriberImpl subscriber;
-
- @Before
- public void initialize() {
- // create Publisher with max buffer capacity 3.
- this.publisher = new SubmissionPublisher(ForkJoinPool.commonPool(), 3);
- this.subscriber = new BaeldungSubscriberImpl();
- publisher.subscribe(subscriber);
- }
-
- @Rule
- public Stopwatch stopwatch = new Stopwatch() {
-
- };
-
- @Test
- public void testReactiveStreamCount() {
- IntStream.range(0, ITEM_SIZE)
- .forEach(item -> publisher.submit(item + ""));
- publisher.close();
-
- do {
- // wait for subscribers to complete all processing.
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } while (!subscriber.isCompleted());
-
- int count = subscriber.getCounter();
-
- assertEquals(ITEM_SIZE, count);
- }
-
- @Test
- public void testReactiveStreamTime() {
- IntStream.range(0, ITEM_SIZE)
- .forEach(item -> publisher.submit(item + ""));
- publisher.close();
-
- do {
- // wait for subscribers to complete all processing.
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } while (!subscriber.isCompleted());
-
- // The runtime in seconds should be equal to the number of items.
- assertTrue(stopwatch.runtime(TimeUnit.SECONDS) >= ITEM_SIZE);
- }
-
- @Test
- public void testReactiveStreamOffer() {
- IntStream.range(0, ITEM_SIZE)
- .forEach(item -> publisher.offer(item + "", (subscriber, string) -> {
- // Returning false means this item will be dropped (no retry), if blocked.
- return false;
- }));
- publisher.close();
-
- do {
- // wait for subscribers to complete all processing.
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } while (!subscriber.isCompleted());
-
- int count = subscriber.getCounter();
- // Because 10 items were offered and the buffer capacity was 3, few items will not be processed.
- assertTrue(ITEM_SIZE > count);
- }
-
-}
+package com.baeldung.java9.reactive;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.SubmissionPublisher;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.IntStream;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.Stopwatch;
+
+public class BaeldungSubscriberImplIntegrationTest {
+
+ private static final int ITEM_SIZE = 10;
+ private SubmissionPublisher publisher;
+ private BaeldungSubscriberImpl subscriber;
+
+ @Before
+ public void initialize() {
+ // create Publisher with max buffer capacity 3.
+ this.publisher = new SubmissionPublisher(ForkJoinPool.commonPool(), 3);
+ this.subscriber = new BaeldungSubscriberImpl();
+ publisher.subscribe(subscriber);
+ }
+
+ @Rule
+ public Stopwatch stopwatch = new Stopwatch() {
+
+ };
+
+ @Test
+ public void testReactiveStreamCount() {
+ IntStream.range(0, ITEM_SIZE)
+ .forEach(item -> publisher.submit(item + ""));
+ publisher.close();
+
+ do {
+ // wait for subscribers to complete all processing.
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } while (!subscriber.isCompleted());
+
+ int count = subscriber.getCounter();
+
+ assertEquals(ITEM_SIZE, count);
+ }
+
+ @Test
+ public void testReactiveStreamTime() {
+ IntStream.range(0, ITEM_SIZE)
+ .forEach(item -> publisher.submit(item + ""));
+ publisher.close();
+
+ do {
+ // wait for subscribers to complete all processing.
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } while (!subscriber.isCompleted());
+
+ // The runtime in seconds should be equal to the number of items.
+ assertTrue(stopwatch.runtime(TimeUnit.SECONDS) >= ITEM_SIZE);
+ }
+
+ @Test
+ public void testReactiveStreamOffer() {
+ IntStream.range(0, ITEM_SIZE)
+ .forEach(item -> publisher.offer(item + "", (subscriber, string) -> {
+ // Returning false means this item will be dropped (no retry), if blocked.
+ return false;
+ }));
+ publisher.close();
+
+ do {
+ // wait for subscribers to complete all processing.
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } while (!subscriber.isCompleted());
+
+ int count = subscriber.getCounter();
+ // Because 10 items were offered and the buffer capacity was 3, few items will not be processed.
+ assertTrue(ITEM_SIZE > count);
+ }
+
+}
diff --git a/core-java-9/src/test/java/com/baeldung/java9/stackwalker/StackWalkerDemoUnitTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/stackwalker/StackWalkerDemoUnitTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/stackwalker/StackWalkerDemoUnitTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/stackwalker/StackWalkerDemoUnitTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/streams.reactive/ReactiveStreamsTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/streams.reactive/ReactiveStreamsTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/streams.reactive/ReactiveStreamsTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/streams.reactive/ReactiveStreamsTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/java9/varhandles/VariableHandlesTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/varhandles/VariableHandlesTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/java9/varhandles/VariableHandlesTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/varhandles/VariableHandlesTest.java
diff --git a/core-java-9/src/test/java/com/baeldung/optionals/OptionalsTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/optionals/OptionalsTest.java
similarity index 100%
rename from core-java-9/src/test/java/com/baeldung/optionals/OptionalsTest.java
rename to core-java-modules/core-java-9/src/test/java/com/baeldung/optionals/OptionalsTest.java
diff --git a/core-java-9/src/test/resources/.gitignore b/core-java-modules/core-java-9/src/test/resources/.gitignore
similarity index 100%
rename from core-java-9/src/test/resources/.gitignore
rename to core-java-modules/core-java-9/src/test/resources/.gitignore
diff --git a/core-java-arrays/.gitignore b/core-java-modules/core-java-arrays/.gitignore
similarity index 100%
rename from core-java-arrays/.gitignore
rename to core-java-modules/core-java-arrays/.gitignore
diff --git a/core-java-arrays/README.md b/core-java-modules/core-java-arrays/README.md
similarity index 100%
rename from core-java-arrays/README.md
rename to core-java-modules/core-java-arrays/README.md
diff --git a/core-java-arrays/pom.xml b/core-java-modules/core-java-arrays/pom.xml
similarity index 99%
rename from core-java-arrays/pom.xml
rename to core-java-modules/core-java-arrays/pom.xml
index ac9f7d08f0..b713c196b5 100644
--- a/core-java-arrays/pom.xml
+++ b/core-java-modules/core-java-arrays/pom.xml
@@ -11,7 +11,7 @@
com.baeldung
parent-java
0.0.1-SNAPSHOT
- ../parent-java
+ ../../parent-java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/AddElementToEndOfArray.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/AddElementToEndOfArray.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/AddElementToEndOfArray.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/AddElementToEndOfArray.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/ArrayBenchmarkRunner.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/ArrayBenchmarkRunner.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/ArrayBenchmarkRunner.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/ArrayBenchmarkRunner.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/ArrayInitializer.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/ArrayInitializer.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/ArrayInitializer.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/ArrayInitializer.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/ArrayInverter.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/ArrayInverter.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/ArrayInverter.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/ArrayInverter.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/ArrayReferenceGuide.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/ArrayReferenceGuide.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/ArrayReferenceGuide.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/ArrayReferenceGuide.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/Find2ndLargestInArray.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/Find2ndLargestInArray.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/Find2ndLargestInArray.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/Find2ndLargestInArray.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/FindElementInArray.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/FindElementInArray.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/FindElementInArray.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/FindElementInArray.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/JaggedArray.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/JaggedArray.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/JaggedArray.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/JaggedArray.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/SearchArrayUnitTest.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/SearchArrayUnitTest.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/SearchArrayUnitTest.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/SearchArrayUnitTest.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/SumAndAverageInArray.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/SumAndAverageInArray.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/SumAndAverageInArray.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/SumAndAverageInArray.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/conversions/FloatToByteArray.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/conversions/FloatToByteArray.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/conversions/FloatToByteArray.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/conversions/FloatToByteArray.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/array/operations/ArrayOperations.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/operations/ArrayOperations.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/array/operations/ArrayOperations.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/array/operations/ArrayOperations.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Address.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Address.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Address.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Address.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Employee.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Employee.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Employee.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Employee.java
diff --git a/core-java-arrays/src/main/java/com/baeldung/arrays/ParallelPrefixBenchmark.java b/core-java-modules/core-java-arrays/src/main/java/com/baeldung/arrays/ParallelPrefixBenchmark.java
similarity index 100%
rename from core-java-arrays/src/main/java/com/baeldung/arrays/ParallelPrefixBenchmark.java
rename to core-java-modules/core-java-arrays/src/main/java/com/baeldung/arrays/ParallelPrefixBenchmark.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/AddElementToEndOfArrayUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/AddElementToEndOfArrayUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/AddElementToEndOfArrayUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/AddElementToEndOfArrayUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/ArrayInitializerUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/ArrayInitializerUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/ArrayInitializerUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/ArrayInitializerUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/ArrayInverterUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/ArrayInverterUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/ArrayInverterUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/ArrayInverterUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/Find2ndLargestInArrayUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/Find2ndLargestInArrayUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/Find2ndLargestInArrayUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/Find2ndLargestInArrayUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/FindElementInArrayUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/FindElementInArrayUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/FindElementInArrayUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/FindElementInArrayUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/JaggedArrayUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/JaggedArrayUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/JaggedArrayUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/JaggedArrayUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/SumAndAverageInArrayUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/SumAndAverageInArrayUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/SumAndAverageInArrayUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/SumAndAverageInArrayUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/conversions/FloatToByteArrayUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/conversions/FloatToByteArrayUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/conversions/FloatToByteArrayUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/conversions/FloatToByteArrayUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/operations/ArrayOperationsUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/operations/ArrayOperationsUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/operations/ArrayOperationsUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/operations/ArrayOperationsUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/array/operations/IntersectionUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/operations/IntersectionUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/array/operations/IntersectionUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/array/operations/IntersectionUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/arraycopy/ArrayCopyUtilUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/arraycopy/ArrayCopyUtilUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/arraycopy/ArrayCopyUtilUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/arraycopy/ArrayCopyUtilUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java
diff --git a/core-java-arrays/src/test/java/com/baeldung/sort/ArraySortUnitTest.java b/core-java-modules/core-java-arrays/src/test/java/com/baeldung/sort/ArraySortUnitTest.java
similarity index 100%
rename from core-java-arrays/src/test/java/com/baeldung/sort/ArraySortUnitTest.java
rename to core-java-modules/core-java-arrays/src/test/java/com/baeldung/sort/ArraySortUnitTest.java
diff --git a/core-java-collections-list/README.md b/core-java-modules/core-java-collections-list/README.md
similarity index 100%
rename from core-java-collections-list/README.md
rename to core-java-modules/core-java-collections-list/README.md
diff --git a/core-java-collections-list/pom.xml b/core-java-modules/core-java-collections-list/pom.xml
similarity index 98%
rename from core-java-collections-list/pom.xml
rename to core-java-modules/core-java-collections-list/pom.xml
index 217278bdf6..1a0b1615c8 100644
--- a/core-java-collections-list/pom.xml
+++ b/core-java-modules/core-java-collections-list/pom.xml
@@ -10,7 +10,7 @@
com.baeldung
parent-java
0.0.1-SNAPSHOT
- ../parent-java
+ ../../parent-java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/allequalelements/VerifyAllEqualListElements.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/allequalelements/VerifyAllEqualListElements.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/allequalelements/VerifyAllEqualListElements.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/allequalelements/VerifyAllEqualListElements.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/classcastexception/ClassCastException.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/classcastexception/ClassCastException.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/classcastexception/ClassCastException.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/classcastexception/ClassCastException.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/collection/filtering/Employee.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/collection/filtering/Employee.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/collection/filtering/Employee.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/collection/filtering/Employee.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/findanelement/Customer.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/findanelement/Customer.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/findanelement/Customer.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/findanelement/Customer.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/findanelement/FindACustomerInGivenList.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/findanelement/FindACustomerInGivenList.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/findanelement/FindACustomerInGivenList.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/findanelement/FindACustomerInGivenList.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/java/list/CopyListService.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/CopyListService.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/java/list/CopyListService.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/CopyListService.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/java/list/CustomList.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/CustomList.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/java/list/CustomList.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/CustomList.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/java/list/Flower.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/Flower.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/java/list/Flower.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/Flower.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/java/list/ReverseIterator.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/ReverseIterator.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/java/list/ReverseIterator.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/ReverseIterator.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/java/list/WaysToIterate.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/WaysToIterate.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/java/list/WaysToIterate.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java/list/WaysToIterate.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/java_8_features/Car.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java_8_features/Car.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/java_8_features/Car.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java_8_features/Car.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/java_8_features/Person.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java_8_features/Person.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/java_8_features/Person.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/java_8_features/Person.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/Flower.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/Flower.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/Flower.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/Flower.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pen.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pen.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pen.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pen.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pencil.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pencil.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pencil.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Pencil.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Rubber.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Rubber.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Rubber.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Rubber.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Stationery.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Stationery.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Stationery.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/listoflist/Stationery.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ArrayListOfArrayList.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ThreeDimensionalArrayList.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ThreeDimensionalArrayList.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ThreeDimensionalArrayList.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/multidimensional/ThreeDimensionalArrayList.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitiveCollections.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/primitive/PrimitivesListPerformance.java
diff --git a/core-java-collections-list/src/main/java/com/baeldung/list/removeall/RemoveAll.java b/core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/removeall/RemoveAll.java
similarity index 100%
rename from core-java-collections-list/src/main/java/com/baeldung/list/removeall/RemoveAll.java
rename to core-java-modules/core-java-collections-list/src/main/java/com/baeldung/list/removeall/RemoveAll.java
diff --git a/core-java-collections-list/src/main/resources/logback.xml b/core-java-modules/core-java-collections-list/src/main/resources/logback.xml
similarity index 100%
rename from core-java-collections-list/src/main/resources/logback.xml
rename to core-java-modules/core-java-collections-list/src/main/resources/logback.xml
diff --git a/core-java-collections-list/src/test/java/com/baeldung/allequalelements/VerifyAllEqualListElementsUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/allequalelements/VerifyAllEqualListElementsUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/allequalelements/VerifyAllEqualListElementsUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/allequalelements/VerifyAllEqualListElementsUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/array/converter/ArrayConvertToListUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/array/converter/ArrayConvertToListUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/array/converter/ArrayConvertToListUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/array/converter/ArrayConvertToListUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/collection/ClearVsRemoveAllUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/collection/ClearVsRemoveAllUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/collection/ClearVsRemoveAllUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/collection/ClearVsRemoveAllUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/collection/CollectionsEmpty.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/collection/CollectionsEmpty.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/collection/CollectionsEmpty.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/collection/CollectionsEmpty.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/collection/filtering/CollectionFilteringUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/collection/filtering/CollectionFilteringUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/collection/filtering/CollectionFilteringUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/collection/filtering/CollectionFilteringUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/findItems/FindItemsBasedOnOtherStreamUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/findanelement/FindACustomerInGivenListUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/findanelement/FindACustomerInGivenListUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/findanelement/FindACustomerInGivenListUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/findanelement/FindACustomerInGivenListUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/java/list/CopyListServiceUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/list/CopyListServiceUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/java/list/CopyListServiceUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/list/CopyListServiceUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/java/list/CustomListUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/list/CustomListUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/java/list/CustomListUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/list/CustomListUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/java/list/ReverseIteratorUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/list/ReverseIteratorUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/java/list/ReverseIteratorUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/list/ReverseIteratorUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/list/AddElementsUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/AddElementsUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/list/AddElementsUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/AddElementsUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/list/listoflist/ListOfListsUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/listoflist/ListOfListsUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/list/listoflist/ListOfListsUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/listoflist/ListOfListsUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java
diff --git a/core-java-collections-list/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java
diff --git a/core-java-collections-list/src/test/java/org/baeldung/RandomListElementUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/org/baeldung/RandomListElementUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/org/baeldung/RandomListElementUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/org/baeldung/RandomListElementUnitTest.java
diff --git a/core-java-collections-list/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java
diff --git a/core-java-collections-list/src/test/java/org/baeldung/java/collections/CoreJavaCollectionsUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/collections/CoreJavaCollectionsUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/org/baeldung/java/collections/CoreJavaCollectionsUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/collections/CoreJavaCollectionsUnitTest.java
diff --git a/core-java-collections-list/src/test/java/org/baeldung/java/collections/JavaCollectionCleanupUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/collections/JavaCollectionCleanupUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/org/baeldung/java/collections/JavaCollectionCleanupUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/collections/JavaCollectionCleanupUnitTest.java
diff --git a/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java
diff --git a/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListJUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListJUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/org/baeldung/java/lists/ListJUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListJUnitTest.java
diff --git a/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java b/core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java
similarity index 100%
rename from core-java-collections-list/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java
rename to core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java
diff --git a/core-java-collections-list/src/test/java/org/baeldung/java/lists/README.md b/core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/lists/README.md
similarity index 100%
rename from core-java-collections-list/src/test/java/org/baeldung/java/lists/README.md
rename to core-java-modules/core-java-collections-list/src/test/java/org/baeldung/java/lists/README.md
diff --git a/core-java-collections-set/README.md b/core-java-modules/core-java-collections-set/README.md
similarity index 100%
rename from core-java-collections-set/README.md
rename to core-java-modules/core-java-collections-set/README.md
diff --git a/core-java-collections-set/pom.xml b/core-java-modules/core-java-collections-set/pom.xml
similarity index 93%
rename from core-java-collections-set/pom.xml
rename to core-java-modules/core-java-collections-set/pom.xml
index d5f7937645..2a930efde8 100644
--- a/core-java-collections-set/pom.xml
+++ b/core-java-modules/core-java-collections-set/pom.xml
@@ -1,33 +1,33 @@
-
- 4.0.0
- core-java-collections-set
- 0.1.0-SNAPSHOT
- core-java-collections-set
- jar
-
-
- com.baeldung
- parent-java
- 0.0.1-SNAPSHOT
- ../parent-java
-
-
-
-
- com.google.guava
- guava
- ${guava.version}
-
-
- org.apache.commons
- commons-collections4
- ${commons-collections4.version}
-
-
-
-
- 4.3
- 27.1-jre
-
-
+
+ 4.0.0
+ core-java-collections-set
+ 0.1.0-SNAPSHOT
+ core-java-collections-set
+ jar
+
+
+ com.baeldung
+ parent-java
+ 0.0.1-SNAPSHOT
+ ../../parent-java
+
+
+
+
+ com.google.guava
+ guava
+ ${guava.version}
+
+
+ org.apache.commons
+ commons-collections4
+ ${commons-collections4.version}
+
+
+
+
+ 4.3
+ 27.1-jre
+
+
diff --git a/core-java-collections-set/src/main/java/com/baeldung/enumset/EnumSets.java b/core-java-modules/core-java-collections-set/src/main/java/com/baeldung/enumset/EnumSets.java
similarity index 100%
rename from core-java-collections-set/src/main/java/com/baeldung/enumset/EnumSets.java
rename to core-java-modules/core-java-collections-set/src/main/java/com/baeldung/enumset/EnumSets.java
diff --git a/core-java-collections-set/src/test/java/com/baeldung/collection/WhenUsingHashSet.java b/core-java-modules/core-java-collections-set/src/test/java/com/baeldung/collection/WhenUsingHashSet.java
similarity index 100%
rename from core-java-collections-set/src/test/java/com/baeldung/collection/WhenUsingHashSet.java
rename to core-java-modules/core-java-collections-set/src/test/java/com/baeldung/collection/WhenUsingHashSet.java
diff --git a/core-java-collections-set/src/test/java/com/baeldung/collection/WhenUsingTreeSet.java b/core-java-modules/core-java-collections-set/src/test/java/com/baeldung/collection/WhenUsingTreeSet.java
similarity index 100%
rename from core-java-collections-set/src/test/java/com/baeldung/collection/WhenUsingTreeSet.java
rename to core-java-modules/core-java-collections-set/src/test/java/com/baeldung/collection/WhenUsingTreeSet.java
diff --git a/core-java-collections-set/src/test/java/com/baeldung/java/set/HashSetInitalizingUnitTest.java b/core-java-modules/core-java-collections-set/src/test/java/com/baeldung/java/set/HashSetInitalizingUnitTest.java
similarity index 100%
rename from core-java-collections-set/src/test/java/com/baeldung/java/set/HashSetInitalizingUnitTest.java
rename to core-java-modules/core-java-collections-set/src/test/java/com/baeldung/java/set/HashSetInitalizingUnitTest.java
diff --git a/core-java-collections-set/src/test/java/com/baeldung/java/set/SetUnitTest.java b/core-java-modules/core-java-collections-set/src/test/java/com/baeldung/java/set/SetUnitTest.java
similarity index 100%
rename from core-java-collections-set/src/test/java/com/baeldung/java/set/SetUnitTest.java
rename to core-java-modules/core-java-collections-set/src/test/java/com/baeldung/java/set/SetUnitTest.java
diff --git a/core-java-collections-set/src/test/java/com/baeldung/set/SetOperationsUnitTest.java b/core-java-modules/core-java-collections-set/src/test/java/com/baeldung/set/SetOperationsUnitTest.java
similarity index 100%
rename from core-java-collections-set/src/test/java/com/baeldung/set/SetOperationsUnitTest.java
rename to core-java-modules/core-java-collections-set/src/test/java/com/baeldung/set/SetOperationsUnitTest.java
diff --git a/core-java-collections/README.md b/core-java-modules/core-java-collections/README.md
similarity index 100%
rename from core-java-collections/README.md
rename to core-java-modules/core-java-collections/README.md
diff --git a/core-java-collections/pom.xml b/core-java-modules/core-java-collections/pom.xml
similarity index 95%
rename from core-java-collections/pom.xml
rename to core-java-modules/core-java-collections/pom.xml
index b791f38b24..e5b89c3d16 100644
--- a/core-java-collections/pom.xml
+++ b/core-java-modules/core-java-collections/pom.xml
@@ -1,78 +1,78 @@
-
- 4.0.0
- core-java-collections
- 0.1.0-SNAPSHOT
- core-java-collections
- jar
-
-
- com.baeldung
- parent-java
- 0.0.1-SNAPSHOT
- ../parent-java
-
-
-
-
- org.apache.commons
- commons-collections4
- ${commons-collections4.version}
-
-
- org.apache.commons
- commons-lang3
- ${commons-lang3.version}
-
-
- org.eclipse.collections
- eclipse-collections
- ${eclipse.collections.version}
-
-
- org.assertj
- assertj-core
- ${assertj.version}
- test
-
-
- org.junit.platform
- junit-platform-runner
- ${junit.platform.version}
- test
-
-
- org.openjdk.jmh
- jmh-core
- ${openjdk.jmh.version}
-
-
- org.openjdk.jmh
- jmh-generator-annprocess
- ${openjdk.jmh.version}
-
-
- org.apache.commons
- commons-exec
- ${commons-exec.version}
-
-
- org.projectlombok
- lombok
- ${lombok.version}
- provided
-
-
-
-
- 1.19
- 1.2.0
- 3.8.1
- 4.1
- 4.01
- 1.7.0
- 3.11.1
- 7.1.0
- 1.3
-
-
+
+ 4.0.0
+ core-java-collections
+ 0.1.0-SNAPSHOT
+ core-java-collections
+ jar
+
+
+ com.baeldung
+ parent-java
+ 0.0.1-SNAPSHOT
+ ../../parent-java
+
+
+
+
+ org.apache.commons
+ commons-collections4
+ ${commons-collections4.version}
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
+ org.eclipse.collections
+ eclipse-collections
+ ${eclipse.collections.version}
+
+
+ org.assertj
+ assertj-core
+ ${assertj.version}
+ test
+
+
+ org.junit.platform
+ junit-platform-runner
+ ${junit.platform.version}
+ test
+
+
+ org.openjdk.jmh
+ jmh-core
+ ${openjdk.jmh.version}
+
+
+ org.openjdk.jmh
+ jmh-generator-annprocess
+ ${openjdk.jmh.version}
+
+
+ org.apache.commons
+ commons-exec
+ ${commons-exec.version}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+
+
+ 1.19
+ 1.2.0
+ 3.8.1
+ 4.1
+ 4.01
+ 1.7.0
+ 3.11.1
+ 7.1.0
+ 1.3
+
+
diff --git a/core-java-collections/src/main/java/com/baeldung/charstack/CharStack.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/charstack/CharStack.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/charstack/CharStack.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/charstack/CharStack.java
diff --git a/core-java-collections/src/main/java/com/baeldung/charstack/CharStackWithArray.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/charstack/CharStackWithArray.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/charstack/CharStackWithArray.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/charstack/CharStackWithArray.java
diff --git a/core-java-collections/src/main/java/com/baeldung/charstack/EmptyStackException.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/charstack/EmptyStackException.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/charstack/EmptyStackException.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/charstack/EmptyStackException.java
diff --git a/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningArrays.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningArrays.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningArrays.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningArrays.java
diff --git a/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningLists.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningLists.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningLists.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningLists.java
diff --git a/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningMaps.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningMaps.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningMaps.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningMaps.java
diff --git a/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningSets.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningSets.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningSets.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningSets.java
diff --git a/core-java-collections/src/main/java/com/baeldung/hashtable/Word.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/hashtable/Word.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/hashtable/Word.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/hashtable/Word.java
diff --git a/core-java-collections/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java
diff --git a/core-java-collections/src/main/java/com/baeldung/iterators/Iterators.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/iterators/Iterators.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/iterators/Iterators.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/iterators/Iterators.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/filtering/CollectionUtilsCollectionFilter.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/java/filtering/CollectionUtilsCollectionFilter.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/filtering/CollectionUtilsCollectionFilter.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/java/filtering/CollectionUtilsCollectionFilter.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/filtering/EclipseCollectionsCollectionFilter.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/java/filtering/EclipseCollectionsCollectionFilter.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/filtering/EclipseCollectionsCollectionFilter.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/java/filtering/EclipseCollectionsCollectionFilter.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/filtering/GuavaCollectionFilter.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/java/filtering/GuavaCollectionFilter.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/filtering/GuavaCollectionFilter.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/java/filtering/GuavaCollectionFilter.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/filtering/StreamsCollectionFilter.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/java/filtering/StreamsCollectionFilter.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/filtering/StreamsCollectionFilter.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/java/filtering/StreamsCollectionFilter.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/iterable/IterableSize.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/java/iterable/IterableSize.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/iterable/IterableSize.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/java/iterable/IterableSize.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/java/list/VectorExample.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/sort/CollectionsSortCompare.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/java/sort/CollectionsSortCompare.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/sort/CollectionsSortCompare.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/java/sort/CollectionsSortCompare.java
diff --git a/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java
diff --git a/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java
diff --git a/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java
diff --git a/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java
diff --git a/core-java-collections/src/main/java/com/baeldung/performance/ArraySortBenchmark.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/ArraySortBenchmark.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/performance/ArraySortBenchmark.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/ArraySortBenchmark.java
diff --git a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java
diff --git a/core-java-collections/src/main/java/com/baeldung/performance/CopyOnWriteBenchmark.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/CopyOnWriteBenchmark.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/performance/CopyOnWriteBenchmark.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/CopyOnWriteBenchmark.java
diff --git a/core-java-collections/src/main/java/com/baeldung/performance/Employee.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/Employee.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/performance/Employee.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/Employee.java
diff --git a/core-java-collections/src/main/java/com/baeldung/performance/HashMapBenchmark.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/HashMapBenchmark.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/performance/HashMapBenchmark.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/HashMapBenchmark.java
diff --git a/core-java-collections/src/main/java/com/baeldung/performance/SetBenchMark.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/SetBenchMark.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/performance/SetBenchMark.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/performance/SetBenchMark.java
diff --git a/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/queueInterface/CustomBaeldungQueue.java
diff --git a/core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java
diff --git a/core-java-collections/src/main/java/com/baeldung/removal/Iterators.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/removal/Iterators.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/removal/Iterators.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/removal/Iterators.java
diff --git a/core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java
diff --git a/core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java
diff --git a/core-java-collections/src/main/java/com/baeldung/synchronizedcollections/application/Application.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/synchronizedcollections/application/Application.java
similarity index 97%
rename from core-java-collections/src/main/java/com/baeldung/synchronizedcollections/application/Application.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/synchronizedcollections/application/Application.java
index 1840c125d0..093308a34a 100644
--- a/core-java-collections/src/main/java/com/baeldung/synchronizedcollections/application/Application.java
+++ b/core-java-modules/core-java-collections/src/main/java/com/baeldung/synchronizedcollections/application/Application.java
@@ -1,18 +1,18 @@
-package com.baeldung.synchronizedcollections.application;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Logger;
-
-public class Application {
-
- private static final Logger LOGGER = Logger.getLogger(Application.class.getName());
-
- public static void main(String[] args) throws InterruptedException {
- List syncCollection = Collections.synchronizedList(Arrays.asList(1, 2, 3, 4, 5, 6));
- synchronized (syncCollection) {
- syncCollection.forEach((e) -> {LOGGER.info(e.toString());});
- }
- }
-}
+package com.baeldung.synchronizedcollections.application;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Logger;
+
+public class Application {
+
+ private static final Logger LOGGER = Logger.getLogger(Application.class.getName());
+
+ public static void main(String[] args) throws InterruptedException {
+ List syncCollection = Collections.synchronizedList(Arrays.asList(1, 2, 3, 4, 5, 6));
+ synchronized (syncCollection) {
+ syncCollection.forEach((e) -> {LOGGER.info(e.toString());});
+ }
+ }
+}
diff --git a/core-java-collections/src/main/java/com/baeldung/thread_safe_lifo/DequeBasedSynchronizedStack.java b/core-java-modules/core-java-collections/src/main/java/com/baeldung/thread_safe_lifo/DequeBasedSynchronizedStack.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/thread_safe_lifo/DequeBasedSynchronizedStack.java
rename to core-java-modules/core-java-collections/src/main/java/com/baeldung/thread_safe_lifo/DequeBasedSynchronizedStack.java
diff --git a/core-java-collections/src/main/resources/logback.xml b/core-java-modules/core-java-collections/src/main/resources/logback.xml
similarity index 100%
rename from core-java-collections/src/main/resources/logback.xml
rename to core-java-modules/core-java-collections/src/main/resources/logback.xml
diff --git a/core-java-collections/src/test/java/com/baeldung/arraydeque/ArrayDequeUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/arraydeque/ArrayDequeUnitTest.java
similarity index 95%
rename from core-java-collections/src/test/java/com/baeldung/arraydeque/ArrayDequeUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/arraydeque/ArrayDequeUnitTest.java
index 71930eda97..5a76eb5402 100644
--- a/core-java-collections/src/test/java/com/baeldung/arraydeque/ArrayDequeUnitTest.java
+++ b/core-java-modules/core-java-collections/src/test/java/com/baeldung/arraydeque/ArrayDequeUnitTest.java
@@ -1,50 +1,50 @@
-package com.baeldung.arraydeque;
-
-import java.util.ArrayDeque;
-import java.util.Deque;
-
-import static org.junit.Assert.*;
-import org.junit.Test;
-
-public class ArrayDequeUnitTest {
-
- @Test
- public void whenOffer_addsAtLast() {
- final Deque deque = new ArrayDeque<>();
-
- deque.offer("first");
- deque.offer("second");
-
- assertEquals("second", deque.getLast());
- }
-
- @Test
- public void whenPoll_removesFirst() {
- final Deque deque = new ArrayDeque<>();
-
- deque.offer("first");
- deque.offer("second");
-
- assertEquals("first", deque.poll());
- }
-
- @Test
- public void whenPush_addsAtFirst() {
- final Deque deque = new ArrayDeque<>();
-
- deque.push("first");
- deque.push("second");
-
- assertEquals("second", deque.getFirst());
- }
-
- @Test
- public void whenPop_removesLast() {
- final Deque deque = new ArrayDeque<>();
-
- deque.push("first");
- deque.push("second");
-
- assertEquals("second", deque.pop());
- }
-}
+package com.baeldung.arraydeque;
+
+import java.util.ArrayDeque;
+import java.util.Deque;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+public class ArrayDequeUnitTest {
+
+ @Test
+ public void whenOffer_addsAtLast() {
+ final Deque deque = new ArrayDeque<>();
+
+ deque.offer("first");
+ deque.offer("second");
+
+ assertEquals("second", deque.getLast());
+ }
+
+ @Test
+ public void whenPoll_removesFirst() {
+ final Deque deque = new ArrayDeque<>();
+
+ deque.offer("first");
+ deque.offer("second");
+
+ assertEquals("first", deque.poll());
+ }
+
+ @Test
+ public void whenPush_addsAtFirst() {
+ final Deque deque = new ArrayDeque<>();
+
+ deque.push("first");
+ deque.push("second");
+
+ assertEquals("second", deque.getFirst());
+ }
+
+ @Test
+ public void whenPop_removesLast() {
+ final Deque deque = new ArrayDeque<>();
+
+ deque.push("first");
+ deque.push("second");
+
+ assertEquals("second", deque.pop());
+ }
+}
diff --git a/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/charstack/CharStackUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUsingJavaUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUsingJavaUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/charstack/CharStackUsingJavaUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/charstack/CharStackUsingJavaUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/charstack/CharStackWithArrayUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/charstack/CharStackWithArrayUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/charstack/CharStackWithArrayUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/charstack/CharStackWithArrayUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningArraysUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningArraysUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningArraysUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningArraysUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningListsUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningListsUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningListsUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningListsUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningMapsUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningMapsUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningMapsUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningMapsUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningSetsUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningSetsUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningSetsUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/combiningcollections/CombiningSetsUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/enummap/DummyEnum.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/enummap/DummyEnum.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/enummap/DummyEnum.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/enummap/DummyEnum.java
diff --git a/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapBenchmarkLiveTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapBenchmarkLiveTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/enummap/EnumMapBenchmarkLiveTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapBenchmarkLiveTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/enummap/EnumMapUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/hashmapvshashtable/HashmapVsHashtableDifferenceUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/hashmapvshashtable/HashmapVsHashtableDifferenceUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/hashmapvshashtable/HashmapVsHashtableDifferenceUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/hashmapvshashtable/HashmapVsHashtableDifferenceUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/hashtable/HashtableUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/hashtable/HashtableUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/hashtable/HashtableUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/hashtable/HashtableUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/iterators/IteratorsUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/iterators/IteratorsUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/iterators/IteratorsUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/iterators/IteratorsUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/java/collections/ConcurrentModificationExceptionUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/java/collections/ConcurrentModificationExceptionUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/java/collections/ConcurrentModificationExceptionUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/java/collections/ConcurrentModificationExceptionUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/java/filtering/CollectionFiltersUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/java/filtering/CollectionFiltersUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/java/filtering/CollectionFiltersUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/java/filtering/CollectionFiltersUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/java/iterable/IterableSizeUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/java/iterable/IterableSizeUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/java/iterable/IterableSizeUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/java/iterable/IterableSizeUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/queueInterface/CustomBaeldungQueueUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/queueInterface/CustomBaeldungQueueUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/queueInterface/CustomBaeldungQueueUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/queueInterface/CustomBaeldungQueueUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/queueInterface/PriorityQueueUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/shufflingcollections/ShufflingCollectionsUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/shufflingcollections/ShufflingCollectionsUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/shufflingcollections/ShufflingCollectionsUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/shufflingcollections/ShufflingCollectionsUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/stack_tests/StackUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/stack_tests/StackUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/stack_tests/StackUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/stack_tests/StackUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedCollectionUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedCollectionUnitTest.java
similarity index 97%
rename from core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedCollectionUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedCollectionUnitTest.java
index 84feeb6eaa..fd84503226 100644
--- a/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedCollectionUnitTest.java
+++ b/core-java-modules/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedCollectionUnitTest.java
@@ -1,28 +1,28 @@
-package com.baeldung.synchronizedcollections.test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import static org.assertj.core.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class SynchronizedCollectionUnitTest {
-
- @Test
- public void givenSynchronizedCollection_whenTwoThreadsAddElements_thenCorrectCollectionSize() throws InterruptedException {
- Collection syncCollection = Collections.synchronizedCollection(new ArrayList<>());
-
- Runnable listOperations = () -> {
- syncCollection.addAll(Arrays.asList(1, 2, 3, 4, 5, 6));
- };
- Thread thread1 = new Thread(listOperations);
- Thread thread2 = new Thread(listOperations);
- thread1.start();
- thread2.start();
- thread1.join();
- thread2.join();
-
- assertThat(syncCollection.size()).isEqualTo(12);
- }
-}
+package com.baeldung.synchronizedcollections.test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class SynchronizedCollectionUnitTest {
+
+ @Test
+ public void givenSynchronizedCollection_whenTwoThreadsAddElements_thenCorrectCollectionSize() throws InterruptedException {
+ Collection syncCollection = Collections.synchronizedCollection(new ArrayList<>());
+
+ Runnable listOperations = () -> {
+ syncCollection.addAll(Arrays.asList(1, 2, 3, 4, 5, 6));
+ };
+ Thread thread1 = new Thread(listOperations);
+ Thread thread2 = new Thread(listOperations);
+ thread1.start();
+ thread2.start();
+ thread1.join();
+ thread2.join();
+
+ assertThat(syncCollection.size()).isEqualTo(12);
+ }
+}
diff --git a/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedListUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedListUnitTest.java
similarity index 97%
rename from core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedListUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedListUnitTest.java
index 68fc3becd4..72354622ae 100644
--- a/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedListUnitTest.java
+++ b/core-java-modules/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedListUnitTest.java
@@ -1,51 +1,51 @@
-package com.baeldung.synchronizedcollections.test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Test;
-import static org.assertj.core.api.Assertions.*;
-
-public class SynchronizedListUnitTest {
-
- @Test
- public void givenSynchronizedList_whenTwoThreadsAddElements_thenCorrectListSize() throws InterruptedException {
- List syncList = Collections.synchronizedList(new ArrayList<>());
-
- Runnable listOperations = () -> {
- syncList.addAll(Arrays.asList(1, 2, 3, 4, 5, 6));
- };
- Thread thread1 = new Thread(listOperations);
- Thread thread2 = new Thread(listOperations);
- thread1.start();
- thread2.start();
- thread1.join();
- thread2.join();
-
- assertThat(syncList.size()).isEqualTo(12);
- }
-
- @Test
- public void givenStringList_whenTwoThreadsIterateOnSynchronizedList_thenCorrectResult() throws InterruptedException {
- List syncCollection = Collections.synchronizedList(Arrays.asList("a", "b", "c"));
- List uppercasedCollection = new ArrayList<>();
-
- Runnable listOperations = () -> {
- synchronized (syncCollection) {
- syncCollection.forEach((e) -> {
- uppercasedCollection.add(e.toUpperCase());
- });
- }
- };
-
- Thread thread1 = new Thread(listOperations);
- Thread thread2 = new Thread(listOperations);
- thread1.start();
- thread2.start();
- thread1.join();
- thread2.join();
-
- assertThat(uppercasedCollection.get(0)).isEqualTo("A");
- }
-}
+package com.baeldung.synchronizedcollections.test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.junit.Test;
+import static org.assertj.core.api.Assertions.*;
+
+public class SynchronizedListUnitTest {
+
+ @Test
+ public void givenSynchronizedList_whenTwoThreadsAddElements_thenCorrectListSize() throws InterruptedException {
+ List syncList = Collections.synchronizedList(new ArrayList<>());
+
+ Runnable listOperations = () -> {
+ syncList.addAll(Arrays.asList(1, 2, 3, 4, 5, 6));
+ };
+ Thread thread1 = new Thread(listOperations);
+ Thread thread2 = new Thread(listOperations);
+ thread1.start();
+ thread2.start();
+ thread1.join();
+ thread2.join();
+
+ assertThat(syncList.size()).isEqualTo(12);
+ }
+
+ @Test
+ public void givenStringList_whenTwoThreadsIterateOnSynchronizedList_thenCorrectResult() throws InterruptedException {
+ List syncCollection = Collections.synchronizedList(Arrays.asList("a", "b", "c"));
+ List uppercasedCollection = new ArrayList<>();
+
+ Runnable listOperations = () -> {
+ synchronized (syncCollection) {
+ syncCollection.forEach((e) -> {
+ uppercasedCollection.add(e.toUpperCase());
+ });
+ }
+ };
+
+ Thread thread1 = new Thread(listOperations);
+ Thread thread2 = new Thread(listOperations);
+ thread1.start();
+ thread2.start();
+ thread1.join();
+ thread2.join();
+
+ assertThat(uppercasedCollection.get(0)).isEqualTo("A");
+ }
+}
diff --git a/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedMapUnitTest.java b/core-java-modules/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedMapUnitTest.java
similarity index 96%
rename from core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedMapUnitTest.java
rename to core-java-modules/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedMapUnitTest.java
index abfb866e9c..842e253e9e 100644
--- a/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedMapUnitTest.java
+++ b/core-java-modules/core-java-collections/src/test/java/com/baeldung/synchronizedcollections/test/SynchronizedMapUnitTest.java
@@ -1,30 +1,30 @@
-package com.baeldung.synchronizedcollections.test;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Test;
-import static org.assertj.core.api.Assertions.*;
-
-public class SynchronizedMapUnitTest {
-
- @Test
- public void givenSynchronizedMap_whenTwoThreadsAddElements_thenCorrectMapSize() throws InterruptedException {
- Map syncMap = Collections.synchronizedMap(new HashMap<>());
-
- Runnable mapOperations = () -> {
- syncMap.put(1, "one");
- syncMap.put(2, "two");
- syncMap.put(3, "three");
-
- };
- Thread thread1 = new Thread(mapOperations);
- Thread thread2 = new Thread(mapOperations);
- thread1.start();
- thread2.start();
- thread1.join();
- thread2.join();
-
- assertThat(syncMap.size()).isEqualTo(3);
- }
-}
+package com.baeldung.synchronizedcollections.test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.Test;
+import static org.assertj.core.api.Assertions.*;
+
+public class SynchronizedMapUnitTest {
+
+ @Test
+ public void givenSynchronizedMap_whenTwoThreadsAddElements_thenCorrectMapSize() throws InterruptedException {
+ Map