You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: java-19/README.md
+13-3Lines changed: 13 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,12 @@ To run each example use: `java --enable-preview --source 19 <FileName.java>`
7
7
### Language
8
8
9
9
* Pattern matching for `switch`
10
-
*Minor improvements from JDK 18:
10
+
*minor improvements from JDK 18:
11
11
* changed guarded pattern from `&&` to `when` keyword
12
12
* definition: guard is the boolean expression, guarded pattern is the case with guard
13
13
* guarded pattern: `case Hero h when h.getCity() == Cities.NEW_YORK`
14
14
* guard: `h.getCity() == Cities.NEW_YORK`
15
-
* Virtual Threads
15
+
* Virtual Threads:
16
16
* also called user-mode threads or [fiber](https://en.wikipedia.org/wiki/Fiber_(computer_science))
17
17
* more notes about Project Loom [here](../java-loom/)
18
18
*`Virtual threads are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications`
@@ -54,8 +54,10 @@ To run each example use: `java --enable-preview --source 19 <FileName.java>`
54
54
* has normal priority;
55
55
* is not member of any thread group;
56
56
* supports concurrent lock API;
57
-
* supports thread-local variables and interruption;
57
+
* supports thread-local variables (be careful cause we will tend to use a lot of virtual threads, using too much thread-local variables could easily increase de memory footprint)
58
+
* interruption and LockSupport;
58
59
* can opt-out from having a thread locals (using Builder);
60
+
* doesn't supports ThreadGroup (deprecated in favor of structured concurrency);
59
61
* scenarios where it can significantly improve throughput when:
60
62
* number of concurrent tasks is high, and
61
63
* work is not CPU-bound.
@@ -65,14 +67,22 @@ To run each example use: `java --enable-preview --source 19 <FileName.java>`
65
67
*`Thread.ofPlatform().start(() -> {})`;
66
68
***do not use** any cached method from `Executors`.
67
69
*[here](platform-thread-vs-virtual-thread.md) is some details about the Platform Thread vs Virtual Thread examples
70
+
* Record patterns
71
+
* added suport to deconstruct record values in pattern matcher
72
+
* record pattern: `Point(int x, int y)`
73
+
* now we can use type pattern and record pattern together
74
+
* we can check the type and extract the record components using `instanceof` operator
75
+
*`o instanceOf Point(int x, int y)`
68
76
69
77
## JEPs
70
78
79
+
*[405](https://openjdk.java.net/jeps/405) - Record Patterns (Preview)
71
80
*[422](https://openjdk.java.net/jeps/422) - Linux/RISC-V Port
72
81
*[424](https://openjdk.java.net/jeps/424) - Foreign Function & Memory API (Preview)
0 commit comments