Skip to content
Java code examples for the major new language features that were added to Java 10.
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.mvn/wrapper
gradle/wrapper
src/test/java/com/neiljbrown/examples/java10
.gitignore
README.adoc
build.gradle
gradle.properties
gradlew
gradlew.bat
mvnw
mvnw.cmd
pom.xml
settings.gradle

README.adoc

Java 10 Examples

1. Purpose

This project provides a set of Java code examples illustrating the new language features and APIs introduced in Java 10.

The examples are implemented as a set of easy to run tests, using JUnit (5).

For a broader overview of the new features in JDK 10 that are of most interest to developers see my blog post https://neiljbrown.com/2018/08/11/java-10-new-features-code-examples-support/.

2. Source Code

The source code for the examples can be found in the src/test/java folder.

An explanation and guidance on the usage of each of the showcased language features can be found in the Javadoc of each of the code examples. (See commands for generating Javadoc below).

3. Building and Running the Examples

You will need to install a Java 10 JDK.

Support is provided for building and running the project using either Gradle or Maven as described in the sections below.

3.1. Gradle

The minimum required version of Gradle will be installed if you execute the build using the supplied Gradle wrapper script (./gradlew).

To compile and run all the example tests, enter the following command in the project’s root folder:

./gradlew clean test

To generate the Javadoc, use the following command:

./gradlew clean javadocTests

The generated Javadoc can be found in the standard location for a Gradle project - build/docs/javadoc/index.html.

For more details of Gradle build support see build.gradle in the project’s root folder.

3.2. Maven

The minimum required version of Maven will be installed if you execute the build using the supplied Maven wrapper script (./mvnw).

To compile and run all the example tests, enter the following command in the project’s root folder:

./mvnw clean test

To generate the Javadoc, use the following command:

./mvnw javadoc:test-javadoc

The generated Javadoc can be found in the standard location for a Maven project - target/site/testapidocs/index.html.

For more details of Maven build support see pom.xml in the project’s root folder.

4. Other Examples

You can find similar code examples for the new features introduced in earlier versions in Java in my other code repos, including -

You can’t perform that action at this time.