diff --git a/algorithms-modules/algorithms-sorting-2/README.md b/algorithms-modules/algorithms-sorting-2/README.md index b31cfceb42..f8a675ed8a 100644 --- a/algorithms-modules/algorithms-sorting-2/README.md +++ b/algorithms-modules/algorithms-sorting-2/README.md @@ -4,4 +4,5 @@ - [Sorting Strings by Contained Numbers in Java](https://www.baeldung.com/java-sort-strings-contained-numbers) - [Guide to In-Place Sorting Algorithm Works with a Java Implementation](https://www.baeldung.com/java-in-place-sorting) - [Partitioning and Sorting Arrays with Many Repeated Entries with Java Examples](https://www.baeldung.com/java-sorting-arrays-with-repeated-entries) +- [Gravity/Bead Sort in Java](https://www.baeldung.com/java-gravity-bead-sort) - More articles: [[<-- prev]](/algorithms-sorting) diff --git a/core-java-modules/core-java-collections-set-2/README.md b/core-java-modules/core-java-collections-set-2/README.md index 17ed810323..48c70084ca 100644 --- a/core-java-modules/core-java-collections-set-2/README.md +++ b/core-java-modules/core-java-collections-set-2/README.md @@ -1,3 +1,4 @@ ## Relevant articles - [Using Streams to Collect Into a TreeSet](https://www.baeldung.com/java-stream-collect-into-treeset) +- [A Guide to LinkedHashSet in Java](https://www.baeldung.com/java-linkedhashset) diff --git a/core-java-modules/core-java-lang-math-3/src/main/java/com/baeldung/math/standarddeviation/StandardDeviation.java b/core-java-modules/core-java-lang-math-3/src/main/java/com/baeldung/math/standarddeviation/StandardDeviation.java new file mode 100644 index 0000000000..623f7a96eb --- /dev/null +++ b/core-java-modules/core-java-lang-math-3/src/main/java/com/baeldung/math/standarddeviation/StandardDeviation.java @@ -0,0 +1,35 @@ +package com.baeldung.math.standarddeviation; + +import java.util.Arrays; + +public class StandardDeviation { + + public static double calculateStandardDeviation(double[] array) { + + // get the sum of array + double sum = 0.0; + for (double i : array) { + sum += i; + } + + // get the mean of array + int length = array.length; + double mean = sum / length; + + // calculate the standard deviation + double standardDeviation = 0.0; + for (double num : array) { + standardDeviation += Math.pow(num - mean, 2); + } + + return Math.sqrt(standardDeviation / length); + } + + public static void main(String[] args) { + double[] array = {25, 5, 45, 68, 61, 46, 24, 95}; + System.out.println("List of elements: " + Arrays.toString(array)); + + double standardDeviation = calculateStandardDeviation(array); + System.out.format("Standard Deviation = %.6f", standardDeviation); + } +} diff --git a/core-java-modules/core-java-networking-4/README.md b/core-java-modules/core-java-networking-4/README.md new file mode 100644 index 0000000000..355f0c447e --- /dev/null +++ b/core-java-modules/core-java-networking-4/README.md @@ -0,0 +1,2 @@ +## Relevant Articles: +- [Difference Between URI.create() and new URI()](https://www.baeldung.com/java-uri-create-and-new-uri) diff --git a/libraries-data/pom.xml b/libraries-data/pom.xml index f0f5338560..a6f8730538 100644 --- a/libraries-data/pom.xml +++ b/libraries-data/pom.xml @@ -174,7 +174,7 @@ 2.8.2 1.1.1 1.5.0 - 3.8.4 + 5.2.0 0.15.0 2.2.0 1.6.0.1 diff --git a/libraries-data/src/test/java/com/baeldung/jcache/CacheLoaderIntegrationTest.java b/libraries-data/src/test/java/com/baeldung/jcache/CacheLoaderIntegrationTest.java index 8017418eba..510083280d 100644 --- a/libraries-data/src/test/java/com/baeldung/jcache/CacheLoaderIntegrationTest.java +++ b/libraries-data/src/test/java/com/baeldung/jcache/CacheLoaderIntegrationTest.java @@ -16,21 +16,22 @@ import org.junit.Test; public class CacheLoaderIntegrationTest { private static final String CACHE_NAME = "SimpleCache"; + private static final String HAZELCAST_MEMBER_CACHING_PROVIDER = "com.hazelcast.cache.HazelcastMemberCachingProvider"; private Cache cache; @Before public void setup() { // Adding fully qualified class name because of multiple Cache Provider (Ignite and Hazelcast) - CachingProvider cachingProvider = Caching.getCachingProvider("com.hazelcast.cache.HazelcastCachingProvider"); + CachingProvider cachingProvider = Caching.getCachingProvider(HAZELCAST_MEMBER_CACHING_PROVIDER); CacheManager cacheManager = cachingProvider.getCacheManager(); MutableConfiguration config = new MutableConfiguration().setReadThrough(true).setCacheLoaderFactory(new FactoryBuilder.SingletonFactory<>(new SimpleCacheLoader())); - this.cache = cacheManager.createCache("SimpleCache", config); + this.cache = cacheManager.createCache( CACHE_NAME, config ); } @After public void tearDown() { - Caching.getCachingProvider("com.hazelcast.cache.HazelcastCachingProvider").getCacheManager().destroyCache(CACHE_NAME); + Caching.getCachingProvider(HAZELCAST_MEMBER_CACHING_PROVIDER).getCacheManager().destroyCache(CACHE_NAME); } @Test diff --git a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/DateNotifier.java b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/DateNotifier.java index 931fd29445..b48c432a32 100644 --- a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/DateNotifier.java +++ b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/DateNotifier.java @@ -1,4 +1,4 @@ -package com.baeldung.factoryGeneric; +package com.baeldung.factorygeneric; import java.util.Date; diff --git a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Main.java b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Main.java index 9ee570f4c4..0b3da9013d 100644 --- a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Main.java +++ b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Main.java @@ -1,4 +1,4 @@ -package com.baeldung.factoryGeneric; +package com.baeldung.factorygeneric; import java.util.Date; diff --git a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Notifier.java b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Notifier.java index 8c7d9e4a56..bfda24bc15 100644 --- a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Notifier.java +++ b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Notifier.java @@ -1,4 +1,4 @@ -package com.baeldung.factoryGeneric; +package com.baeldung.factorygeneric; public interface Notifier { diff --git a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/NotifierFactory.java b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/NotifierFactory.java index 67b980f198..ff1091d18f 100644 --- a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/NotifierFactory.java +++ b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/NotifierFactory.java @@ -1,4 +1,4 @@ -package com.baeldung.factoryGeneric; +package com.baeldung.factorygeneric; import java.util.Date; diff --git a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Record.java b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Record.java index 0f99e1f988..1dbe94f2e7 100644 --- a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Record.java +++ b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/Record.java @@ -1,4 +1,4 @@ -package com.baeldung.factoryGeneric; +package com.baeldung.factorygeneric; import java.util.Date; diff --git a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/StringNotifier.java b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/StringNotifier.java index 124bfa9a5a..576085f267 100644 --- a/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/StringNotifier.java +++ b/patterns-modules/design-patterns-creational/src/main/java/com/baeldung/factorygeneric/StringNotifier.java @@ -1,4 +1,4 @@ -package com.baeldung.factoryGeneric; +package com.baeldung.factorygeneric; public class StringNotifier implements Notifier { diff --git a/patterns-modules/design-patterns-creational/src/test/java/com/baeldung/factorygeneric/FactoryGenericUnitTest.java b/patterns-modules/design-patterns-creational/src/test/java/com/baeldung/factorygeneric/FactoryGenericUnitTest.java index 4dd9880b74..6fabfc22dc 100644 --- a/patterns-modules/design-patterns-creational/src/test/java/com/baeldung/factorygeneric/FactoryGenericUnitTest.java +++ b/patterns-modules/design-patterns-creational/src/test/java/com/baeldung/factorygeneric/FactoryGenericUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.factoryGeneric; +package com.baeldung.factorygeneric; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/spring-5-webflux-2/README.md b/spring-5-webflux-2/README.md index 862ca72ca9..e64c88c61d 100644 --- a/spring-5-webflux-2/README.md +++ b/spring-5-webflux-2/README.md @@ -5,3 +5,4 @@ This module contains articles about Spring 5 WebFlux ## Relevant articles: - [Spring Webflux and @Cacheable Annotation](https://www.baeldung.com/spring-webflux-cacheable) - [Comparison Between Mono’s doOnNext() and doOnSuccess()](https://www.baeldung.com/mono-doonnext-doonsuccess) +- [How to Access the First Element of a Flux](https://www.baeldung.com/java-flux-first-element) diff --git a/spring-boot-modules/spring-boot-groovy/README.md b/spring-boot-modules/spring-boot-groovy/README.md index 73edafb9c0..0897cc92bc 100644 --- a/spring-boot-modules/spring-boot-groovy/README.md +++ b/spring-boot-modules/spring-boot-groovy/README.md @@ -6,4 +6,5 @@ This module contains articles about Spring with Groovy ### Relevant Articles: - [Building a Simple Web Application with Spring Boot and Groovy](https://www.baeldung.com/spring-boot-groovy-web-app) -- [Groovy Bean Definitions](https://www.baeldung.com/spring-groovy-beans) \ No newline at end of file +- [Groovy Bean Definitions](https://www.baeldung.com/spring-groovy-beans) +- [Using Groovy in Spring](https://www.baeldung.com/groovy/spring-using-groovy) diff --git a/spring-boot-modules/spring-boot-properties-3/README.md b/spring-boot-modules/spring-boot-properties-3/README.md index 1bd6724885..77c6815649 100644 --- a/spring-boot-modules/spring-boot-properties-3/README.md +++ b/spring-boot-modules/spring-boot-properties-3/README.md @@ -8,4 +8,5 @@ - [How to Define a Map in YAML for a POJO?](https://www.baeldung.com/yaml-map-pojo) - [Using application.yml vs application.properties in Spring Boot](https://www.baeldung.com/spring-boot-yaml-vs-properties) - [Load Spring Boot Properties From a JSON File](https://www.baeldung.com/spring-boot-json-properties) -- [IntelliJ – Cannot Resolve Spring Boot Configuration Properties Error](https://www.baeldung.com/intellij-resolve-spring-boot-configuration-properties) \ No newline at end of file +- [IntelliJ – Cannot Resolve Spring Boot Configuration Properties Error](https://www.baeldung.com/intellij-resolve-spring-boot-configuration-properties) +- [Log Properties in a Spring Boot Application](https://www.baeldung.com/spring-boot-log-properties) diff --git a/spring-reactive-modules/spring-5-reactive-client-2/README.md b/spring-reactive-modules/spring-5-reactive-client-2/README.md index 341271e5ad..067a87a9d5 100644 --- a/spring-reactive-modules/spring-5-reactive-client-2/README.md +++ b/spring-reactive-modules/spring-5-reactive-client-2/README.md @@ -6,4 +6,5 @@ This module contains articles about reactive Spring 5 WebClient The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles +- [Limiting the Requests per Second With WebClient](https://www.baeldung.com/spring-webclient-limit-requests-per-second) - More articles: [[<-- prev]](../spring-5-reactive-client) diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md index cefc8e1707..9f1fd53ee5 100644 --- a/testing-modules/junit-5/README.md +++ b/testing-modules/junit-5/README.md @@ -8,3 +8,4 @@ - [Determine the Execution Time of JUnit Tests](https://www.baeldung.com/junit-test-execution-time) - [@BeforeAll and @AfterAll in Non-Static Methods](https://www.baeldung.com/java-beforeall-afterall-non-static) - [The java.lang.NoClassDefFoundError in JUnit](https://www.baeldung.com/junit-noclassdeffounderror) +- [assertAll() vs Multiple Assertions in JUnit5](https://github.com/eugenp/tutorials/tree/master/testing-modules/junit-5)