@@ -3,6 +3,7 @@
|
|||||||
This module contains articles about searching algorithms.
|
This module contains articles about searching algorithms.
|
||||||
|
|
||||||
### Relevant articles:
|
### Relevant articles:
|
||||||
|
|
||||||
- [Binary Search Algorithm in Java](https://www.baeldung.com/java-binary-search)
|
- [Binary Search Algorithm in Java](https://www.baeldung.com/java-binary-search)
|
||||||
- [Depth First Search in Java](https://www.baeldung.com/java-depth-first-search)
|
- [Depth First Search in Java](https://www.baeldung.com/java-depth-first-search)
|
||||||
- [Interpolation Search in Java](https://www.baeldung.com/java-interpolation-search)
|
- [Interpolation Search in Java](https://www.baeldung.com/java-interpolation-search)
|
||||||
@@ -11,3 +12,4 @@ This module contains articles about searching algorithms.
|
|||||||
- [Monte Carlo Tree Search for Tic-Tac-Toe Game](https://www.baeldung.com/java-monte-carlo-tree-search)
|
- [Monte Carlo Tree Search for Tic-Tac-Toe Game](https://www.baeldung.com/java-monte-carlo-tree-search)
|
||||||
- [Range Search Algorithm in Java](https://www.baeldung.com/java-range-search)
|
- [Range Search Algorithm in Java](https://www.baeldung.com/java-range-search)
|
||||||
- [Fast Pattern Matching of Strings Using Suffix Tree](https://www.baeldung.com/java-pattern-matching-suffix-tree)
|
- [Fast Pattern Matching of Strings Using Suffix Tree](https://www.baeldung.com/java-pattern-matching-suffix-tree)
|
||||||
|
- [Find the Kth Smallest Element in Two Sorted Arrays](https://www.baeldung.com/java-kth-smallest-element-in-sorted-arrays)
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
This module contains articles about Apache POI
|
This module contains articles about Apache POI
|
||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
|
|
||||||
- [Microsoft Word Processing in Java with Apache POI](https://www.baeldung.com/java-microsoft-word-with-apache-poi)
|
- [Microsoft Word Processing in Java with Apache POI](https://www.baeldung.com/java-microsoft-word-with-apache-poi)
|
||||||
- [Working with Microsoft Excel in Java](https://www.baeldung.com/java-microsoft-excel)
|
- [Working with Microsoft Excel in Java](https://www.baeldung.com/java-microsoft-excel)
|
||||||
- [Creating a MS PowerPoint Presentation in Java](https://www.baeldung.com/apache-poi-slideshow)
|
- [Creating a MS PowerPoint Presentation in Java](https://www.baeldung.com/apache-poi-slideshow)
|
||||||
- [Merge Cells in Excel Using Apache POI](https://www.baeldung.com/java-apache-poi-merge-cells)
|
- [Merge Cells in Excel Using Apache POI](https://www.baeldung.com/java-apache-poi-merge-cells)
|
||||||
- [Get String Value of Excel Cell with Apache POI](https://www.baeldung.com/java-apache-poi-cell-string-value)
|
- [Get String Value of Excel Cell with Apache POI](https://www.baeldung.com/java-apache-poi-cell-string-value)
|
||||||
- [Read Excel Cell Value Rather Than Formula With Apache POI](https://www.baeldung.com/apache-poi-read-cell-value-formula)
|
- [Read Excel Cell Value Rather Than Formula With Apache POI](https://www.baeldung.com/apache-poi-read-cell-value-formula)
|
||||||
|
- [Setting Formulas in Excel with Apache POI](https://www.baeldung.com/java-apache-poi-set-formulas)
|
||||||
|
|||||||
@@ -9,3 +9,4 @@ This module contains articles about Java 10 core features
|
|||||||
- [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another)
|
- [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another)
|
||||||
- [Deep Dive Into the New Java JIT Compiler – Graal](https://www.baeldung.com/graal-java-jit-compiler)
|
- [Deep Dive Into the New Java JIT Compiler – Graal](https://www.baeldung.com/graal-java-jit-compiler)
|
||||||
- [Copying Sets in Java](https://www.baeldung.com/java-copy-sets)
|
- [Copying Sets in Java](https://www.baeldung.com/java-copy-sets)
|
||||||
|
- [Converting between a List and a Set in Java](https://www.baeldung.com/convert-list-to-set-and-set-to-list)
|
||||||
|
|||||||
@@ -1,22 +1,29 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project
|
<project
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>core-java-10</artifactId>
|
<artifactId>core-java-10</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<name>core-java-10</name>
|
<name>core-java-10</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung.core-java-modules</groupId>
|
||||||
<artifactId>parent-modules</artifactId>
|
<artifactId>core-java-modules</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-collections4</artifactId>
|
||||||
|
<version>${commons-collections4.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -34,6 +41,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source.version>10</maven.compiler.source.version>
|
<maven.compiler.source.version>10</maven.compiler.source.version>
|
||||||
<maven.compiler.target.version>10</maven.compiler.target.version>
|
<maven.compiler.target.version>10</maven.compiler.target.version>
|
||||||
|
<commons-collections4.version>4.1</commons-collections4.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
+68
@@ -0,0 +1,68 @@
|
|||||||
|
package com.baeldung.java10.collections.conversion;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class ListSetConversionUnitTest {
|
||||||
|
|
||||||
|
// Set -> List; List -> Set
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public final void givenUsingCoreJava_whenSetConvertedToList_thenCorrect() {
|
||||||
|
final Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
|
||||||
|
final List<Integer> targetList = new ArrayList<>(sourceSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public final void givenUsingCoreJava_whenListConvertedToSet_thenCorrect() {
|
||||||
|
final List<Integer> sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5);
|
||||||
|
final Set<Integer> targetSet = new HashSet<>(sourceList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenUsingJava10_whenSetConvertedToList_thenCorrect() {
|
||||||
|
final Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
|
||||||
|
final List<Integer> targetList = List.copyOf(sourceSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenUsingJava10_whenListConvertedToSet_thenCorrect() {
|
||||||
|
final List<Integer> sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5);
|
||||||
|
final Set<Integer> targetSet = Set.copyOf(sourceList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public final void givenUsingGuava_whenSetConvertedToList_thenCorrect() {
|
||||||
|
final Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
|
||||||
|
final List<Integer> targetList = Lists.newArrayList(sourceSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public final void givenUsingGuava_whenListConvertedToSet_thenCorrect() {
|
||||||
|
final List<Integer> sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5);
|
||||||
|
final Set<Integer> targetSet = Sets.newHashSet(sourceList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public final void givenUsingCommonsCollections_whenListConvertedToSet_thenCorrect() {
|
||||||
|
final List<Integer> sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5);
|
||||||
|
|
||||||
|
final Set<Integer> targetSet = new HashSet<>(6);
|
||||||
|
CollectionUtils.addAll(targetSet, sourceList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public final void givenUsingCommonsCollections_whenSetConvertedToList_thenCorrect() {
|
||||||
|
final Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
|
||||||
|
|
||||||
|
final List<Integer> targetList = new ArrayList<>(6);
|
||||||
|
CollectionUtils.addAll(targetList, sourceSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,9 @@
|
|||||||
This module contains articles about advanced operations on arrays in Java. They assume some background knowledge with arrays in Java.
|
This module contains articles about advanced operations on arrays in Java. They assume some background knowledge with arrays in Java.
|
||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
|
|
||||||
- [How to Copy an Array in Java](https://www.baeldung.com/java-array-copy)
|
- [How to Copy an Array in Java](https://www.baeldung.com/java-array-copy)
|
||||||
- [Arrays.deepEquals](https://www.baeldung.com/java-arrays-deepequals)
|
- [Arrays.deepEquals](https://www.baeldung.com/java-arrays-deepequals)
|
||||||
- [Find Sum and Average in a Java Array](https://www.baeldung.com/java-array-sum-average)
|
- [Find Sum and Average in a Java Array](https://www.baeldung.com/java-array-sum-average)
|
||||||
- [Intersection Between two Integer Arrays](https://www.baeldung.com/java-array-intersection)
|
- [Intersection Between two Integer Arrays](https://www.baeldung.com/java-array-intersection)
|
||||||
|
- [Comparing Arrays in Java](https://www.baeldung.com/java-comparing-arrays)
|
||||||
|
|||||||
@@ -12,3 +12,4 @@
|
|||||||
- [Fail-Safe Iterator vs Fail-Fast Iterator](https://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator)
|
- [Fail-Safe Iterator vs Fail-Fast Iterator](https://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator)
|
||||||
- [Quick Guide to the Java Stack](https://www.baeldung.com/java-stack)
|
- [Quick Guide to the Java Stack](https://www.baeldung.com/java-stack)
|
||||||
- [Convert an Array of Primitives to a List](https://www.baeldung.com/java-primitive-array-to-list)
|
- [Convert an Array of Primitives to a List](https://www.baeldung.com/java-primitive-array-to-list)
|
||||||
|
- [A Guide to BitSet in Java](https://www.baeldung.com/java-bitset)
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ This module contains articles about the Java List collection
|
|||||||
- [Performance Comparison of Primitive Lists in Java](https://www.baeldung.com/java-list-primitive-performance)
|
- [Performance Comparison of Primitive Lists in Java](https://www.baeldung.com/java-list-primitive-performance)
|
||||||
- [Filtering a Java Collection by a List](https://www.baeldung.com/java-filter-collection-by-list)
|
- [Filtering a Java Collection by a List](https://www.baeldung.com/java-filter-collection-by-list)
|
||||||
- [How to Count Duplicate Elements in Arraylist](https://www.baeldung.com/java-count-duplicate-elements-arraylist)
|
- [How to Count Duplicate Elements in Arraylist](https://www.baeldung.com/java-count-duplicate-elements-arraylist)
|
||||||
|
- [Finding the Differences Between Two Lists in Java](https://www.baeldung.com/java-lists-difference)
|
||||||
- [[<-- Prev]](/core-java-modules/core-java-collections-list-2)
|
- [[<-- Prev]](/core-java-modules/core-java-collections-list-2)
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#Core Java Console
|
#Core Java Console
|
||||||
|
|
||||||
[Read and Write User Input in Java](http://www.baeldung.com/java-console-input-output)
|
### Relevant Articles:
|
||||||
[Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf)
|
|
||||||
[ASCII Art in Java](http://www.baeldung.com/ascii-art-in-java)
|
- [Read and Write User Input in Java](http://www.baeldung.com/java-console-input-output)
|
||||||
|
- [Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf)
|
||||||
|
- [ASCII Art in Java](http://www.baeldung.com/ascii-art-in-java)
|
||||||
|
- [System.console() vs. System.out](https://www.baeldung.com/java-system-console-vs-system-out)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
### Relevant Articles:
|
||||||
|
|
||||||
|
- [NoSuchMethodError in Java](https://www.baeldung.com/java-nosuchmethod-error)
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.baeldung.exceptions</groupId>
|
||||||
|
<artifactId>core-java-exceptions-3</artifactId>
|
||||||
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
|
<name>core-java-exceptions-3</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung.core-java-modules</groupId>
|
||||||
|
<artifactId>core-java-modules</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<relativePath>../</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- test scoped -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<version>${assertj-core.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<!-- testing -->
|
||||||
|
<assertj-core.version>3.10.0</assertj-core.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package com.baeldung.exceptions.nosuchmethoderror;
|
||||||
|
|
||||||
|
public class MainMenu {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Today's Specials: " + getSpecials());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSpecials() {
|
||||||
|
return SpecialToday.getDesert();
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package com.baeldung.exceptions.nosuchmethoderror;
|
||||||
|
public class SpecialToday {
|
||||||
|
private static String desert = "Chocolate Cake";
|
||||||
|
|
||||||
|
public static String getDesert() {
|
||||||
|
return desert;
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package com.baeldung.exceptions.nosuchmethoderror;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MainMenuUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void whenGetSpecials_thenNotNull() {
|
||||||
|
assertNotNull(MainMenu.getSpecials());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,4 +6,7 @@ This module contains articles about core Java input and output (IO)
|
|||||||
|
|
||||||
- [Java – Create a File](https://www.baeldung.com/java-how-to-create-a-file)
|
- [Java – Create a File](https://www.baeldung.com/java-how-to-create-a-file)
|
||||||
- [Check If a Directory Is Empty in Java](https://www.baeldung.com/java-check-empty-directory)
|
- [Check If a Directory Is Empty in Java](https://www.baeldung.com/java-check-empty-directory)
|
||||||
|
- [Check If a File or Directory Exists in Java](https://www.baeldung.com/java-file-directory-exists)
|
||||||
|
- [Copy a Directory in Java](https://www.baeldung.com/java-copy-directory)
|
||||||
|
- [Java Files Open Options](https://www.baeldung.com/java-file-options)
|
||||||
- [[<-- Prev]](/core-java-modules/core-java-io-2)
|
- [[<-- Prev]](/core-java-modules/core-java-io-2)
|
||||||
|
|||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
package com.baeldung.linenumber;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Scanner;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class LineAtGivenNumberUnitTest {
|
||||||
|
|
||||||
|
private static final String FILE_PATH = "src/test/resources/linesInput.txt";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenFile_whenUsingBufferedReader_thenExtractedLineIsCorrect() throws IOException {
|
||||||
|
try (BufferedReader br = Files.newBufferedReader(Paths.get(FILE_PATH))) {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
br.readLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
String extractedLine = br.readLine();
|
||||||
|
assertEquals("Line 4", extractedLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenFile_whenUsingScanner_thenExtractedLineIsCorrect() throws IOException {
|
||||||
|
try (Scanner scanner = new Scanner(new File(FILE_PATH))) {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
scanner.nextLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
String extractedLine = scanner.nextLine();
|
||||||
|
assertEquals("Line 4", extractedLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSmallFile_whenUsingFilesAPI_thenExtractedLineIsCorrect() throws IOException {
|
||||||
|
String extractedLine = Files.readAllLines(Paths.get(FILE_PATH)).get(4);
|
||||||
|
|
||||||
|
assertEquals("Line 5", extractedLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenLargeFile_whenUsingFilesAPI_thenExtractedLineIsCorrect() throws IOException {
|
||||||
|
try (Stream<String> lines = Files.lines(Paths.get(FILE_PATH))) {
|
||||||
|
String extractedLine = lines.skip(4).findFirst().get();
|
||||||
|
|
||||||
|
assertEquals("Line 5", extractedLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenFile_whenUsingFileUtils_thenExtractedLineIsCorrect() throws IOException {
|
||||||
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
|
File file = new File(classLoader.getResource("linesInput.txt").getFile());
|
||||||
|
|
||||||
|
List<String> lines = FileUtils.readLines(file, "UTF-8");
|
||||||
|
|
||||||
|
String extractedLine = lines.get(0);
|
||||||
|
assertEquals("Line 1", extractedLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenFile_whenUsingIOUtils_thenExtractedLineIsCorrect() throws IOException {
|
||||||
|
String fileContent = IOUtils.toString(new FileInputStream(FILE_PATH), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
String extractedLine = fileContent.split(System.lineSeparator())[0];
|
||||||
|
assertEquals("Line 1", extractedLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Line 1
|
||||||
|
Line 2
|
||||||
|
Line 3
|
||||||
|
Line 4
|
||||||
|
Line 5
|
||||||
@@ -10,4 +10,5 @@ This module contains articles about working with the Java Virtual Machine (JVM).
|
|||||||
- [boolean and boolean[] Memory Layout in the JVM](https://www.baeldung.com/jvm-boolean-memory-layout)
|
- [boolean and boolean[] Memory Layout in the JVM](https://www.baeldung.com/jvm-boolean-memory-layout)
|
||||||
- [Where Is the Array Length Stored in JVM?](https://www.baeldung.com/java-jvm-array-length)
|
- [Where Is the Array Length Stored in JVM?](https://www.baeldung.com/java-jvm-array-length)
|
||||||
- [Memory Address of Objects in Java](https://www.baeldung.com/java-object-memory-address)
|
- [Memory Address of Objects in Java](https://www.baeldung.com/java-object-memory-address)
|
||||||
|
- [List All Classes Loaded in a Specific Class Loader](https://www.baeldung.com/java-list-classes-class-loader)
|
||||||
- More articles: [[<-- prev]](/core-java-modules/core-java-jvm)
|
- More articles: [[<-- prev]](/core-java-modules/core-java-jvm)
|
||||||
|
|||||||
+5
-2
@@ -6,8 +6,11 @@ public interface Bar {
|
|||||||
|
|
||||||
String method(String string);
|
String method(String string);
|
||||||
|
|
||||||
default String defaultMethod() {
|
default String defaultBar() {
|
||||||
return "String from Bar";
|
return "Default String from Bar";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default String defaultCommon() {
|
||||||
|
return "Default Common from Bar";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -6,7 +6,11 @@ public interface Baz {
|
|||||||
|
|
||||||
String method(String string);
|
String method(String string);
|
||||||
|
|
||||||
default String defaultMethod() {
|
default String defaultBaz() {
|
||||||
return "String from Baz";
|
return "Default String from Baz";
|
||||||
|
}
|
||||||
|
|
||||||
|
default String defaultCommon(){
|
||||||
|
return "Default Common from Baz";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -5,8 +5,7 @@ package com.baeldung.java8.lambda.tips;
|
|||||||
public interface FooExtended extends Baz, Bar {
|
public interface FooExtended extends Baz, Bar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default String defaultMethod() {
|
default String defaultCommon() {
|
||||||
return Bar.super.defaultMethod();
|
return Bar.super.defaultCommon();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -39,9 +39,9 @@ public class Java8FunctionalInteracesLambdasUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public void defaultMethodFromExtendedInterface_whenReturnDefiniteString_thenCorrect() {
|
public void defaultMethodFromExtendedInterface_whenReturnDefiniteString_thenCorrect() {
|
||||||
final FooExtended fooExtended = string -> string;
|
final FooExtended fooExtended = string -> string;
|
||||||
final String result = fooExtended.defaultMethod();
|
final String result = fooExtended.defaultCommon();
|
||||||
|
|
||||||
assertEquals("String from Bar", result);
|
assertEquals("Default Common from Bar", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ This module contains articles about core features in the Java language
|
|||||||
|
|
||||||
- [Class.isInstance vs Class.isAssignableFrom](https://www.baeldung.com/java-isinstance-isassignablefrom)
|
- [Class.isInstance vs Class.isAssignableFrom](https://www.baeldung.com/java-isinstance-isassignablefrom)
|
||||||
- [Converting a Java String Into a Boolean](https://www.baeldung.com/java-string-to-boolean)
|
- [Converting a Java String Into a Boolean](https://www.baeldung.com/java-string-to-boolean)
|
||||||
|
- [When are Static Variables Initialized in Java?](https://www.baeldung.com/java-static-variables-initialization)
|
||||||
- [[<-- Prev]](/core-java-modules/core-java-lang-2)
|
- [[<-- Prev]](/core-java-modules/core-java-lang-2)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
This module contains articles about types in Java
|
This module contains articles about types in Java
|
||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
|
|
||||||
- [Java Classes and Objects](https://www.baeldung.com/java-classes-objects)
|
- [Java Classes and Objects](https://www.baeldung.com/java-classes-objects)
|
||||||
- [Guide to the this Java Keyword](https://www.baeldung.com/java-this)
|
- [Guide to the this Java Keyword](https://www.baeldung.com/java-this)
|
||||||
- [Nested Classes in Java](https://www.baeldung.com/java-nested-classes)
|
- [Nested Classes in Java](https://www.baeldung.com/java-nested-classes)
|
||||||
@@ -10,3 +11,4 @@ This module contains articles about types in Java
|
|||||||
- [Iterating Over Enum Values in Java](https://www.baeldung.com/java-enum-iteration)
|
- [Iterating Over Enum Values in Java](https://www.baeldung.com/java-enum-iteration)
|
||||||
- [Attaching Values to Java Enum](https://www.baeldung.com/java-enum-values)
|
- [Attaching Values to Java Enum](https://www.baeldung.com/java-enum-values)
|
||||||
- [A Guide to Java Enums](https://www.baeldung.com/a-guide-to-java-enums)
|
- [A Guide to Java Enums](https://www.baeldung.com/a-guide-to-java-enums)
|
||||||
|
- [Determine if an Object is of Primitive Type](https://www.baeldung.com/java-object-primitive-type)
|
||||||
|
|||||||
@@ -12,5 +12,6 @@ This module contains articles about working with the operating system (OS) in Ja
|
|||||||
- [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java)
|
- [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java)
|
||||||
- [Pattern Search with Grep in Java](http://www.baeldung.com/grep-in-java)
|
- [Pattern Search with Grep in Java](http://www.baeldung.com/grep-in-java)
|
||||||
- [How to Run a Shell Command in Java](http://www.baeldung.com/run-shell-command-in-java)
|
- [How to Run a Shell Command in Java](http://www.baeldung.com/run-shell-command-in-java)
|
||||||
|
- [Taking Screenshots Using Java](https://www.baeldung.com/java-taking-screenshots)
|
||||||
|
|
||||||
This module uses Java 9, so make sure to have the JDK 9 installed to run it.
|
This module uses Java 9, so make sure to have the JDK 9 installed to run it.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
|
|
||||||
- [Reading the Value of ‘private’ Fields from a Different Class in Java](https://www.baeldung.com/java-reflection-read-private-field-value)
|
- [Reading the Value of ‘private’ Fields from a Different Class in Java](https://www.baeldung.com/java-reflection-read-private-field-value)
|
||||||
|
- [Set Field Value With Reflection](https://www.baeldung.com/java-set-private-field-value)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
|
|
||||||
<module>core-java-exceptions</module>
|
<module>core-java-exceptions</module>
|
||||||
<module>core-java-exceptions-2</module>
|
<module>core-java-exceptions-2</module>
|
||||||
|
<module>core-java-exceptions-3</module>
|
||||||
<module>core-java-function</module>
|
<module>core-java-function</module>
|
||||||
|
|
||||||
<module>core-java-io</module>
|
<module>core-java-io</module>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
This module contains articles about Kotlin core features.
|
This module contains articles about Kotlin core features.
|
||||||
|
|
||||||
### Relevant articles:
|
### Relevant articles:
|
||||||
|
|
||||||
- [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin-intro)
|
- [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin-intro)
|
||||||
- [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability)
|
- [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability)
|
||||||
- [Get a Random Number in Kotlin](https://www.baeldung.com/kotlin-random-number)
|
- [Get a Random Number in Kotlin](https://www.baeldung.com/kotlin-random-number)
|
||||||
@@ -10,3 +11,4 @@ This module contains articles about Kotlin core features.
|
|||||||
- [Kotlin Ternary Conditional Operator](https://www.baeldung.com/kotlin-ternary-operator)
|
- [Kotlin Ternary Conditional Operator](https://www.baeldung.com/kotlin-ternary-operator)
|
||||||
- [Sequences in Kotlin](https://www.baeldung.com/kotlin/sequences)
|
- [Sequences in Kotlin](https://www.baeldung.com/kotlin/sequences)
|
||||||
- [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class)
|
- [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class)
|
||||||
|
- [Exception Handling in Kotlin](https://www.baeldung.com/kotlin/exception-handling)
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ This module contains articles about Deeplearning4j.
|
|||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
- [A Guide to Deeplearning4j](https://www.baeldung.com/deeplearning4j)
|
- [A Guide to Deeplearning4j](https://www.baeldung.com/deeplearning4j)
|
||||||
- [Logistic Regression in Java](https://www.baeldung.com/java-logistic-regression)
|
- [Logistic Regression in Java](https://www.baeldung.com/java-logistic-regression)
|
||||||
|
- [How to Implement a CNN with Deeplearning4j](https://www.baeldung.com/java-cnn-deeplearning4j)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
## Relevant Articles:
|
## Relevant Articles:
|
||||||
|
|
||||||
- [Introduction to Docker Compose](https://www.baeldung.com/docker-compose)
|
- [Introduction to Docker Compose](https://www.baeldung.com/docker-compose)
|
||||||
|
- [Creating Docker Images with Spring Boot](https://www.baeldung.com/spring-boot-docker-images)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user