Skip to content

Commit 6c72e25

Browse files
committed
reorganization
1 parent d2d4062 commit 6c72e25

26 files changed

+192
-224
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.idea/
77
target/
88
output/
9+
bin/
910
*.jar
1011
*.war
1112
*.ear

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ A project to explore more about the new features of Java 8, 9, ...
3737
* Null I/O
3838

3939
* [Java 12](java-12/)
40-
* Switch expression (preview 1)
40+
* Switch expression (preview)
4141
* Compact Number Format
4242
* Collectors improvements
4343
* CompletableFuture improvements
@@ -46,7 +46,7 @@ A project to explore more about the new features of Java 8, 9, ...
4646

4747
* [Java 13](java-13/)
4848
* Switch expression (preview 2)
49-
* Text blocks
49+
* Text blocks (preview)
5050
* String API updates
5151
* NIO updates
5252
* Socket and ServerSocket reimplementation (Project Loom)
@@ -56,10 +56,21 @@ A project to explore more about the new features of Java 8, 9, ...
5656
* [Java 14](java-14/) (May 17th, 2020)
5757
* Switch expression (standard)
5858
* Pattern matching for `instanceof` (preview)
59-
* Text blocks improvements
59+
* Text blocks improvements (preview 2)
6060
* Records (preview)
6161
* Helpful NullPointerExceptions
6262
* Packaging tool
6363
* JFR even streaming
6464

65-
* [Java 15](java-15/)
65+
* [Java 15](java-15/) (GA - Sep, 2020)
66+
* Sealed classes (preview)
67+
* Hidden classes
68+
* DatagramSocket reimplementation
69+
* Pattern matching for `instanceof` (preview 2)
70+
* Records (preview 2)
71+
* Foreign-Memory Access API (incubator)
72+
73+
## Helpful Links
74+
75+
* [Considerations Bumping Java EE](https://vorozco.com/blog/2020/2020-08-21-considerations-bumping-javaee.html)
76+
* [The Role of Preview Features in Java and Beyond](https://blogs.oracle.com/javamagazine/the-role-of-previews-in-java-14-java-15-java-16-and-beyond)

java-10/CollectionsCopyOf.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java.util.Arrays;
2+
import java.util.List;
3+
import java.util.Map;
4+
import java.util.Set;
5+
6+
public class CollectionsCopyOf {
7+
public static void main(String[] args) {
8+
List<String> muttableList = Arrays.asList("New", "Method", "To", "Copy");
9+
10+
// Copy methods
11+
List<String> immutableList = List.copyOf(muttableList);
12+
immutableList.forEach(System.out::println);
13+
14+
Set<String> immutableSet = Set.copyOf(muttableList);
15+
immutableSet.forEach(System.out::println);
16+
17+
Map<String, String> immutableMap = Map.copyOf(Map.of("k1", "v1", "k2", "v2"));
18+
immutableMap.forEach((key, value) -> System.out.println(key + " = " + value));
19+
20+
}
21+
}

java-10/ProcessTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import java.lang.management.ManagementFactory;
2+
import java.lang.management.RuntimeMXBean;
3+
4+
public class ProcessTest {
5+
public static void main(String[] args) {
6+
final RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
7+
final long pid = runtime.getPid();
8+
System.out.println("Process ID is: " + pid);
9+
}
10+
}

java-10/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Java 10
22

3+
```sh
4+
sh build.sh
5+
java -cp bin <ClassName>
6+
```
7+
38
## Features
49

510
### Language
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import java.util.List;
2+
import java.util.Map;
3+
import java.util.function.Function;
4+
import java.util.stream.Collectors;
5+
6+
public class StreamToUnmodifiableCollections {
7+
public static void main(String[] args) {
8+
List<String> list = List.of("Testing", "Immutable", "List", "From", "Stream");
9+
10+
List<String> immutableList = list.stream()
11+
.collect(Collectors.toUnmodifiableList());
12+
immutableList.forEach(System.out::println);
13+
14+
Map<String, Integer> wordsLengths = list.stream()
15+
.collect(Collectors.toUnmodifiableMap(Function.identity(), word -> word.length()));
16+
wordsLengths.forEach((word, length) -> System.out.println(word + " -> " + length + " letters"));
17+
}
18+
}

java-10/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[[ -f bin ]] && mkdir bin
2+
javac *.java -d ./bin

java-10/pom.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.

java-10/src/main/java/com/github/wesleyegberto/collections/CollectionsCopyOf.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

java-10/src/main/java/com/github/wesleyegberto/collections/StreamToUnmodifiableCollections.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)