1. A new HttpClient/HttpRequest/HttpResponse/WebSocket:
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://postman-echo.com/get"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandler.asString());
2. Process handler
ProcessHandle self = ProcessHandle.current();
long PID = self.getPid();
ProcessHandle.Info procInfo = self.info();
Optional<String[]> args = procInfo.arguments();
Optional<String> cmd = procInfo.commandLine();
Optional<Instant> startTime = procInfo.startInstant();
Optional<Duration> cpuUsage = procInfo.totalCpuDuration()
3. Destroying child process
childProc = ProcessHandle.current().children();
childProc.forEach(procHandle -> {
assertTrue("Could not kill process " + procHandle.getPid(), procHandle.destroy());
});
4. JSheel command line to verify the simple snip code.
5. Immutable Set and Map
Set<String> sets = Set.of("v1", "v2", "v3");
Map<String, String> maps = Map.of(“k1”, “v1”, “k2”, “v2”); (max support 10 entry)
6. Allow annotation to the lambada parameter:
list.stream() .map((@Notnull var s) -> s.toLowerCase()) .collect(Collectors.toList());
7. java.util.function.Predicate:not
lines.stream() .filter(Predicate.not(String::isBlank))
8. local var type inference
var x = new … , (should be argued if we need use it for daily work or not).
9. New copyOf method for List, Map, Set interface
10. java.util.stream.Collectors: toUnmodifiableList/ toUnmodifiableSet to provide unmodified set.
11. Lunch java code directly:
java HelloWorld.java = {javac HelloWorld; java HelloWorld}
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://postman-echo.com/get"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandler.asString());
2. Process handler
ProcessHandle self = ProcessHandle.current();
long PID = self.getPid();
ProcessHandle.Info procInfo = self.info();
Optional<String[]> args = procInfo.arguments();
Optional<String> cmd = procInfo.commandLine();
Optional<Instant> startTime = procInfo.startInstant();
Optional<Duration> cpuUsage = procInfo.totalCpuDuration()
3. Destroying child process
childProc = ProcessHandle.current().children();
childProc.forEach(procHandle -> {
assertTrue("Could not kill process " + procHandle.getPid(), procHandle.destroy());
});
4. JSheel command line to verify the simple snip code.
5. Immutable Set and Map
Set<String> sets = Set.of("v1", "v2", "v3");
Map<String, String> maps = Map.of(“k1”, “v1”, “k2”, “v2”); (max support 10 entry)
6. Allow annotation to the lambada parameter:
list.stream() .map((@Notnull var s) -> s.toLowerCase()) .collect(Collectors.toList());
7. java.util.function.Predicate:not
lines.stream() .filter(Predicate.not(String::isBlank))
8. local var type inference
var x = new … , (should be argued if we need use it for daily work or not).
9. New copyOf method for List, Map, Set interface
10. java.util.stream.Collectors: toUnmodifiableList/ toUnmodifiableSet to provide unmodified set.
11. Lunch java code directly:
java HelloWorld.java = {javac HelloWorld; java HelloWorld}
Comments
Post a Comment