diff --git a/algorithms/README.md b/algorithms/README.md
index 9d347869bd..b9a37a7bf2 100644
--- a/algorithms/README.md
+++ b/algorithms/README.md
@@ -31,3 +31,6 @@
- [Round Up to the Nearest Hundred](https://www.baeldung.com/java-round-up-nearest-hundred)
- [Merge Sort in Java](https://www.baeldung.com/java-merge-sort)
- [Calculate Percentage in Java](https://www.baeldung.com/java-calculate-percentage)
+- [Quicksort Algorithm Implementation in Java](https://www.baeldung.com/java-quicksort)
+- [Insertion Sort in Java](https://www.baeldung.com/java-insertion-sort)
+- [Converting Between Byte Arrays and Hexadecimal Strings in Java](https://www.baeldung.com/java-byte-arrays-hex-strings)
diff --git a/apache-geode/README.md b/apache-geode/README.md
new file mode 100644
index 0000000000..2f04418825
--- /dev/null
+++ b/apache-geode/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+
+- [A Quick Guide to Apache Geode](https://www.baeldung.com/apache-geode)
diff --git a/core-java-collections/README.md b/core-java-collections/README.md
index 684beda281..d0aaaa7182 100644
--- a/core-java-collections/README.md
+++ b/core-java-collections/README.md
@@ -38,3 +38,4 @@
- [Time Complexity of Java Collections](https://www.baeldung.com/java-collections-complexity)
- [Operating on and Removing an Item from Stream](https://www.baeldung.com/java-use-remove-item-stream)
- [An Introduction to Synchronized Java Collections](https://www.baeldung.com/java-synchronized-collections)
+- [Guide to EnumSet](https://www.baeldung.com/java-enumset)
diff --git a/core-java-io/README.md b/core-java-io/README.md
index 58e331b6fc..ae4c267b8a 100644
--- a/core-java-io/README.md
+++ b/core-java-io/README.md
@@ -31,4 +31,5 @@
- [Create a Symbolic Link with Java](http://www.baeldung.com/java-symlink)
- [Quick Use of FilenameFilter](http://www.baeldung.com/java-filename-filter)
- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
-- [ Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist)
+- [Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist)
+- [Guide to Java OutputStream](https://www.baeldung.com/java-outputstream)
diff --git a/core-java-io/pom.xml b/core-java-io/pom.xml
index cf3e950cb8..efa32b8e3e 100644
--- a/core-java-io/pom.xml
+++ b/core-java-io/pom.xml
@@ -154,6 +154,12 @@
async-http-client
${async-http-client.version}
+
+ com.opencsv
+ opencsv
+ ${opencsv.version}
+ test
+
@@ -247,7 +253,7 @@
1.13
0.6.5
0.9.0
-
+ 4.1
3.6.1
1.7.0
diff --git a/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java b/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java
new file mode 100644
index 0000000000..2593eee82b
--- /dev/null
+++ b/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java
@@ -0,0 +1,106 @@
+package com.baeldung.csv;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Scanner;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.opencsv.CSVReader;
+
+public class ReadCSVInArrayUnitTest {
+ public static final String COMMA_DELIMITER = ",";
+ public static final String CSV_FILE = "src/test/resources/book.csv";
+ public static final List> EXPECTED_ARRAY = Collections.unmodifiableList(new ArrayList>() {
+ {
+ add(new ArrayList() {
+ {
+ add("Mary Kom");
+ add("Unbreakable");
+ }
+ });
+ add(new ArrayList() {
+ {
+ add("Kapil Isapuari");
+ add("Farishta");
+ }
+ });
+ }
+ });
+
+ @Test
+ public void givenCSVFile_whenBufferedReader_thenContentsAsExpected() throws IOException {
+ List> records = new ArrayList>();
+ try (BufferedReader br = new BufferedReader(new FileReader(CSV_FILE))) {
+ String line = "";
+ while ((line = br.readLine()) != null) {
+ String[] values = line.split(COMMA_DELIMITER);
+ records.add(Arrays.asList(values));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ for (int i = 0; i < EXPECTED_ARRAY.size(); i++) {
+ Assert.assertArrayEquals(EXPECTED_ARRAY.get(i)
+ .toArray(),
+ records.get(i)
+ .toArray());
+ }
+ }
+
+ @Test
+ public void givenCSVFile_whenScanner_thenContentsAsExpected() throws IOException {
+ List> records = new ArrayList>();
+ try (Scanner scanner = new Scanner(new File(CSV_FILE));) {
+ while (scanner.hasNextLine()) {
+ records.add(getRecordFromLine(scanner.nextLine()));
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ for (int i = 0; i < EXPECTED_ARRAY.size(); i++) {
+ Assert.assertArrayEquals(EXPECTED_ARRAY.get(i)
+ .toArray(),
+ records.get(i)
+ .toArray());
+ }
+ }
+
+ private List getRecordFromLine(String line) {
+ List values = new ArrayList();
+ try (Scanner rowScanner = new Scanner(line)) {
+ rowScanner.useDelimiter(COMMA_DELIMITER);
+ while (rowScanner.hasNext()) {
+ values.add(rowScanner.next());
+ }
+ }
+ return values;
+ }
+
+ @Test
+ public void givenCSVFile_whenOpencsv_thenContentsAsExpected() throws IOException {
+ List> records = new ArrayList>();
+ try (CSVReader csvReader = new CSVReader(new FileReader(CSV_FILE));) {
+ String[] values = null;
+ while ((values = csvReader.readNext()) != null) {
+ records.add(Arrays.asList(values));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ for (int i = 0; i < EXPECTED_ARRAY.size(); i++) {
+ Assert.assertArrayEquals(EXPECTED_ARRAY.get(i)
+ .toArray(),
+ records.get(i)
+ .toArray());
+ }
+ }
+}
diff --git a/core-java-io/src/test/resources/book.csv b/core-java-io/src/test/resources/book.csv
new file mode 100644
index 0000000000..b7c4b80499
--- /dev/null
+++ b/core-java-io/src/test/resources/book.csv
@@ -0,0 +1,2 @@
+Mary Kom,Unbreakable
+Kapil Isapuari,Farishta
\ No newline at end of file
diff --git a/core-java/README.md b/core-java/README.md
index 1cbbfe2b39..59aab91aa9 100644
--- a/core-java/README.md
+++ b/core-java/README.md
@@ -157,3 +157,4 @@
- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing)
- [Java Switch Statement](https://www.baeldung.com/java-switch)
- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java)
+- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator)
diff --git a/core-java/src/main/java/com/baeldung/string/DoubleToString.java b/core-java/src/main/java/com/baeldung/string/DoubleToString.java
new file mode 100644
index 0000000000..d26d26f3df
--- /dev/null
+++ b/core-java/src/main/java/com/baeldung/string/DoubleToString.java
@@ -0,0 +1,41 @@
+package com.baeldung.string;
+
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+public class DoubleToString {
+
+ public static String truncateByCast(double d) {
+ return String.valueOf((int) d);
+ }
+
+ public static String roundWithStringFormat(double d) {
+ return String.format("%.0f", d);
+ }
+
+ public static String truncateWithNumberFormat(double d) {
+ NumberFormat nf = NumberFormat.getInstance();
+ nf.setMaximumFractionDigits(0);
+ nf.setRoundingMode(RoundingMode.FLOOR);
+ return nf.format(d);
+ }
+
+ public static String roundWithNumberFormat(double d) {
+ NumberFormat nf = NumberFormat.getInstance();
+ nf.setMaximumFractionDigits(0);
+ return nf.format(d);
+ }
+
+ public static String truncateWithDecimalFormat(double d) {
+ DecimalFormat df = new DecimalFormat("#,###");
+ df.setRoundingMode(RoundingMode.FLOOR);
+ return df.format(d);
+ }
+
+ public static String roundWithDecimalFormat(double d) {
+ DecimalFormat df = new DecimalFormat("#,###");
+ return df.format(d);
+ }
+
+}
diff --git a/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java b/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java
new file mode 100644
index 0000000000..5212d7aa1a
--- /dev/null
+++ b/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java
@@ -0,0 +1,45 @@
+package com.baeldung.string;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+public class DoubleToStringUnitTest {
+
+ private static final double DOUBLE_VALUE = 3.56;
+ private static final String TRUNCATED_DOUBLE = "3";
+ private static final String ROUNDED_UP_DOUBLE = "4";
+
+
+ @Test
+ public void truncateByCastTest() {
+ assertThat(DoubleToString.truncateByCast(DOUBLE_VALUE)).isEqualTo(TRUNCATED_DOUBLE);
+ }
+
+ @Test
+ public void roundingWithStringFormatTest() {
+ assertThat(DoubleToString.roundWithStringFormat(DOUBLE_VALUE)).isEqualTo(ROUNDED_UP_DOUBLE);
+ }
+
+ @Test
+ public void truncateWithNumberFormatTest() {
+ assertThat(DoubleToString.truncateWithNumberFormat(DOUBLE_VALUE)).isEqualTo(TRUNCATED_DOUBLE);
+ }
+
+ @Test
+ public void roundWithNumberFormatTest() {
+ assertThat(DoubleToString.roundWithNumberFormat(DOUBLE_VALUE)).isEqualTo(ROUNDED_UP_DOUBLE);
+ }
+
+ @Test
+ public void truncateWithDecimalFormatTest() {
+ assertThat(DoubleToString.truncateWithDecimalFormat(DOUBLE_VALUE)).isEqualTo(TRUNCATED_DOUBLE);
+ }
+
+ @Test
+ public void roundWithDecimalFormatTest() {
+ assertThat(DoubleToString.roundWithDecimalFormat(DOUBLE_VALUE)).isEqualTo(ROUNDED_UP_DOUBLE);
+ }
+
+
+}
diff --git a/core-kotlin/README.md b/core-kotlin/README.md
index 523f5b6e78..9906b59a93 100644
--- a/core-kotlin/README.md
+++ b/core-kotlin/README.md
@@ -39,3 +39,4 @@
- [Introduction to Kovenant Library for Kotlin](https://www.baeldung.com/kotlin-kovenant)
- [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class)
- [Concatenate Strings in Kotlin](https://www.baeldung.com/kotlin-concatenate-strings)
+- [Kotlin return, break, continue Keywords](https://www.baeldung.com/kotlin-return-break-continue)
diff --git a/hibernate5/README.md b/hibernate5/README.md
index fbf46eed50..7f52531076 100644
--- a/hibernate5/README.md
+++ b/hibernate5/README.md
@@ -17,3 +17,4 @@
- [Mapping A Hibernate Query to a Custom Class](https://www.baeldung.com/hibernate-query-to-custom-class)
- [@JoinColumn Annotation Explained](https://www.baeldung.com/jpa-join-column)
- [Hibernate 5 Naming Strategy Configuration](https://www.baeldung.com/hibernate-naming-strategy)
+- [Proxy in Hibernate load() Method](https://www.baeldung.com/hibernate-proxy-load-method)
diff --git a/java-collections-maps/README.md b/java-collections-maps/README.md
index ca7fee1d21..a6037a3c57 100644
--- a/java-collections-maps/README.md
+++ b/java-collections-maps/README.md
@@ -16,3 +16,4 @@
- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort)
- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max)
- [Merging Two Maps with Java 8](https://www.baeldung.com/java-merge-maps)
+- [How to Check If a Key Exists in a Map](https://www.baeldung.com/java-map-key-exists)
diff --git a/java-dates/README.md b/java-dates/README.md
index 54843f90ee..f99bfeb861 100644
--- a/java-dates/README.md
+++ b/java-dates/README.md
@@ -21,4 +21,5 @@
- [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end)
- [Calculate Age in Java](http://www.baeldung.com/java-get-age)
- [Increment Date in Java](http://www.baeldung.com/java-increment-date)
-- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date)
\ No newline at end of file
+- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date)
+- [Guide to DateTimeFormatter](https://www.baeldung.com/java-datetimeformatter)
diff --git a/java-numbers/README.md b/java-numbers/README.md
index 6d6a279cc9..1138d9a74c 100644
--- a/java-numbers/README.md
+++ b/java-numbers/README.md
@@ -12,3 +12,4 @@
- [BigDecimal and BigInteger in Java](http://www.baeldung.com/java-bigdecimal-biginteger)
- [Find All Pairs of Numbers in an Array That Add Up to a Given Sum](http://www.baeldung.com/java-algorithm-number-pairs-sum)
- [Java – Random Long, Float, Integer and Double](http://www.baeldung.com/java-generate-random-long-float-integer-double)
+- [Using Math.sin with Degrees](https://www.baeldung.com/java-math-sin-degrees)
diff --git a/libraries-security/README.md b/libraries-security/README.md
index c42e91a888..6923e0474e 100644
--- a/libraries-security/README.md
+++ b/libraries-security/README.md
@@ -1,3 +1,4 @@
### Relevant Articles:
- [Guide to ScribeJava](https://www.baeldung.com/scribejava)
+- [Guide to Passay](https://www.baeldung.com/java-passay)
diff --git a/maven-polyglot/README.md b/maven-polyglot/README.md
index 589315efd1..8635c8eddf 100644
--- a/maven-polyglot/README.md
+++ b/maven-polyglot/README.md
@@ -1,3 +1,4 @@
To run the maven-polyglot-json-app successfully, you first have to build the maven-polyglot-json-extension module using: mvn clean install.
-Related Articles:
+### Relevant Articles:
+- [Maven Polyglot](https://www.baeldung.com/maven-polyglot)
diff --git a/maven/README.md b/maven/README.md
index 2d838bcb76..970250d142 100644
--- a/maven/README.md
+++ b/maven/README.md
@@ -10,3 +10,6 @@
- [Build a Jar with Maven and Ignore the Test Results](http://www.baeldung.com/maven-ignore-test-results)
- [Maven Project with Multiple Source Directories](https://www.baeldung.com/maven-project-multiple-src-directories)
- [Integration Testing with Maven](https://www.baeldung.com/maven-integration-test)
+- [Apache Maven Standard Directory Layout](https://www.baeldung.com/maven-directory-structure)
+- [Apache Maven Tutorial](https://www.baeldung.com/maven)
+- [Use the Latest Version of a Dependency in Maven](https://www.baeldung.com/maven-dependency-latest-version)
diff --git a/persistence-modules/spring-data-mongodb/README.md b/persistence-modules/spring-data-mongodb/README.md
index 4e12a2218a..c7bc7584be 100644
--- a/persistence-modules/spring-data-mongodb/README.md
+++ b/persistence-modules/spring-data-mongodb/README.md
@@ -11,3 +11,4 @@
- [Introduction to Spring Data MongoDB](http://www.baeldung.com/spring-data-mongodb-tutorial)
- [Spring Data MongoDB: Projections and Aggregations](http://www.baeldung.com/spring-data-mongodb-projections-aggregations)
- [Spring Data Annotations](http://www.baeldung.com/spring-data-annotations)
+- [Spring Data MongoDB Transactions](https://www.baeldung.com/spring-data-mongodb-transactions )
diff --git a/spring-5-reactive-security/README.md b/spring-5-reactive-security/README.md
index 3395cf5562..845d07cd7f 100644
--- a/spring-5-reactive-security/README.md
+++ b/spring-5-reactive-security/README.md
@@ -8,4 +8,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring Boot Actuator](http://www.baeldung.com/spring-boot-actuators)
- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive)
- [Guide to Spring 5 WebFlux](http://www.baeldung.com/spring-webflux)
-
+- [Introduction to the Functional Web Framework in Spring 5](https://www.baeldung.com/spring-5-functional-web)
diff --git a/spring-boot-mvc/README.md b/spring-boot-mvc/README.md
index b46dbe3bae..e7b42f8f50 100644
--- a/spring-boot-mvc/README.md
+++ b/spring-boot-mvc/README.md
@@ -7,4 +7,5 @@
- [Spring Web Annotations](http://www.baeldung.com/spring-mvc-annotations)
- [Spring Core Annotations](http://www.baeldung.com/spring-core-annotations)
- [Display RSS Feed with Spring MVC](http://www.baeldung.com/spring-mvc-rss-feed)
-
+- [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao)
+- [Cache Eviction in Spring Boot](https://www.baeldung.com/spring-boot-evict-cache)
diff --git a/spring-boot/README.MD b/spring-boot/README.MD
index aed2d2c5f8..9a9f44e1cf 100644
--- a/spring-boot/README.MD
+++ b/spring-boot/README.MD
@@ -35,3 +35,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring Component Scanning](https://www.baeldung.com/spring-component-scanning)
- [Load Spring Boot Properties From a JSON File](https://www.baeldung.com/spring-boot-json-properties)
- [Display Auto-Configuration Report in Spring Boot](https://www.baeldung.com/spring-boot-auto-configuration-report)
+- [Logging to Graylog with Spring Boot](https://www.baeldung.com/graylog-with-spring-boot)
diff --git a/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java b/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java
index 2e0d9eb8d8..2ee265f134 100644
--- a/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java
+++ b/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java
@@ -16,5 +16,6 @@ public class CollectionInjectionDemo {
collectionsBean.printNameSet();
collectionsBean.printNameMap();
collectionsBean.printBeanList();
+ collectionsBean.printNameListWithDefaults();
}
}
diff --git a/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java b/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java
index a0e985267f..fc90f2c6ff 100644
--- a/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java
+++ b/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java
@@ -1,13 +1,14 @@
package com.baeldung.collection;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+
/**
* Created by Gebruiker on 5/18/2018.
*/
@@ -24,6 +25,9 @@ public class CollectionsBean {
@Qualifier("CollectionsBean")
private List beanList = new ArrayList<>();
+ @Value("${names.list:}#{T(java.util.Collections).emptyList()}")
+ private List nameListWithDefaultValue;
+
public CollectionsBean() {
}
@@ -51,4 +55,8 @@ public class CollectionsBean {
public void printBeanList() {
System.out.println(beanList);
}
+
+ public void printNameListWithDefaults() {
+ System.out.println(nameListWithDefaultValue);
+ }
}
diff --git a/testing-modules/testng/README.md b/testing-modules/testng/README.md
index e54ee1dbf2..a7e0e29d62 100644
--- a/testing-modules/testng/README.md
+++ b/testing-modules/testng/README.md
@@ -2,3 +2,4 @@
- [Introduction to TestNG](http://www.baeldung.com/testng)
- [Custom Reporting with TestNG](http://www.baeldung.com/testng-custom-reporting)
+- [A Quick JUnit vs TestNG Comparison](https://www.baeldung.com/junit-vs-testng)
diff --git a/xml/README.md b/xml/README.md
index 80c6a069f0..fb070100db 100644
--- a/xml/README.md
+++ b/xml/README.md
@@ -3,3 +3,4 @@
- [Introduction to JiBX](http://www.baeldung.com/jibx)
- [XML Libraries Support in Java](http://www.baeldung.com/java-xml-libraries)
- [DOM parsing with Xerces](http://www.baeldung.com/java-xerces-dom-parsing)
+- [Write an org.w3.dom.Document to a File](https://www.baeldung.com/java-write-xml-document-file)