Skip to content

Commit d5776cb

Browse files
committed
* Java 17 LTS.
* Add README * Comment Vector Api class java don't recognize incubator package. * Add EnhancedPseudoRandomNumberGenerators example. * The pattern matching for switch case is not actually working on this version.
1 parent 5aeb7cf commit d5776cb

File tree

3 files changed

+58
-2
lines changed

3 files changed

+58
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Java 17 Features Summary
2+
3+
1. Sealed Classes (JEP 409)
4+
Sealed classes and interfaces restrict which other classes or interfaces may extend or implement them. After being in preview in earlier versions, sealed classes are now a standard feature, providing more precise control over inheritance.
5+
6+
2. Pattern Matching for instanceof (JEP 394)
7+
Simplifies conditional extraction of components from objects, reducing boilerplate code. This feature became standard in Java 16 and continues to be part of Java 17.
8+
9+
3. Strong Encapsulation of JDK Internals (JEP 403)
10+
Strongly encapsulates JDK internals by default, except for critical internal APIs such as sun.misc.Unsafe. This change aims to improve security and maintainability, encouraging the use of standard APIs.
11+
12+
4. Foreign Function & Memory API (JEP 412) [Incubator]
13+
Provides a pure Java API for calling native code and working with native memory, continuing the evolution of Project Panama. This feature is in the incubator stage in Java 17.
14+
15+
5. New macOS Rendering Pipeline (JEP 382)
16+
Introduces a new rendering pipeline for macOS, based on Apple's Metal framework, replacing the existing pipeline that used the deprecated OpenGL framework. This change enhances the performance and efficiency of Java applications on macOS.
17+
6. Enhanced Pseudo-Random Number Generators (JEP 356)
18+
Introduces new interfaces and implementations for pseudo-random number generators (PRNGs), including jumpable PRNGs and an additional class of splittable PRNG algorithms (LXM).
19+
20+
7. Deprecate the Applet API for Removal (JEP 398)
21+
Marks the Applet API as deprecated for removal, acknowledging the obsolescence of applets and the shift towards modern web technologies.
22+
8. Pattern Matching for Switch (JEP 406) [Preview]
23+
Extends pattern matching to the switch expression, allowing pattern matching within switch cases. This feature is in preview in Java 17.
24+
25+
9. Record Patterns, Array Patterns (JEP 405) [Preview]
26+
Introduces patterns for deconstructing records and arrays in pattern matching expressions. This feature is in preview and part of the ongoing effort to enhance the Java language's expressiveness and conciseness through pattern matching.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package features_versions.seventeen_17.bases;
2+
3+
import java.util.random.RandomGenerator;
4+
import java.util.random.RandomGeneratorFactory;
5+
6+
/**
7+
* JEP 356, titled "Enhanced Pseudo-Random Number Generators," introduces a significant enhancement to the
8+
* pseudo-random number generation (PRNG) capabilities in Java 17.
9+
* This enhancement is designed to offer a more flexible and efficient approach for generating pseudo-random numbers,
10+
* catering to both general-purpose use cases and specific requirements that may need different characteristics
11+
* from a PRNG, such as better statistical properties, non-repeatability, and the ability to "jump" ahead in
12+
* the generated sequence of numbers.
13+
*/
14+
public class EnhancedPseudoRandomNumberGenerators {
15+
16+
public static void main(String[] args) {
17+
18+
//L128X256MixRandom is a new algorithm that is part of the enhanced PRNG capabilities in Java 17.
19+
RandomGeneratorFactory<RandomGenerator> factory = RandomGeneratorFactory.of("L128X256MixRandom");
20+
RandomGenerator randomGenerator = factory.create();
21+
22+
System.out.println(randomGenerator.nextInt());
23+
}
24+
}

src/main/java/features_versions/sixteen_16/basics/VectorApiIncubator.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package features_versions.sixteen_16.basics;
22

3-
import jdk.incubator.vector.IntVector;
3+
//import jdk.incubator.vector.IntVector;
44

55
/**
66
* The Vector API is in its initial incubation phase for Java 16. The idea of this API is to provide a means of vector
77
* computations that will ultimately be able to perform more optimally (on supporting CPU architectures)
88
* than the traditional scalar method of computations.
9+
*
10+
* Make sure to add --add-modules jdk.incubator.vector to the command line to run this code.
11+
*
12+
* I put in comments to avoid compilation errors for the majority of the people.
913
*/
1014
public class VectorApiIncubator {
1115

@@ -42,11 +46,13 @@ public static void vectorMultiplication() {
4246
int[] a = {1, 2, 3, 4};
4347
int[] b = {5, 6, 7, 8};
4448
int[] c = new int[a.length];
45-
49+
/*
4650
var vectorA = IntVector.fromArray(IntVector.SPECIES_128, a, 0);
4751
var vectorB = IntVector.fromArray(IntVector.SPECIES_128, b, 0);
4852
var vectorC = vectorA.mul(vectorB);
4953
vectorC.intoArray(c, 0);
54+
55+
*/
5056
}
5157

5258
}

0 commit comments

Comments
 (0)