This is part of my live blogging from QCon 2015. See my QCon table of contents for other posts.
This session was from the Java Sig. It’s a repeat of the conference session I didn’t attend then since I knew I’d see it here.
Java 8 has lots of new features, but people think of streams/lambdas. This session isn’t slides. It’s building a real app live. Trisha starts with an architecture diagram – small serivces and MVC layer. They aren’t microservices because they aren’t reliable. Then she has a sketch of the screen.
The Java 8 features I see go by:
- Stub Service uses a Supplier for generating random numbers.
- JavaFX for basic UI. [I’m not familiar with JavaFX.]
- Compute if absent and method reference:
- Streams, comparators
map.values().stream() .sorted(Comparators.comparing(TwitterUser::getTweets) .reversed()).limit(10).collect(Collectors.toList();
laterPlatform.runLater(() -> items.setAll(x));
- JavaFX comes with built in animation
- Date/time to get current minute
- Loop from to y
This coud be better or worse than a regular loop in terms of readability or performance.
- Read fileStream
lines = Files.lines(path);
lines.filter(s -> !s.equals("Ok"));
- Check on stream:
lines.peek(s -> method())
- Convert array to stream, map
- Join strings with delimiter in between
- automatically shortens to simplest thing that could work making code a method reference or lambda.
- Keyboard shortcut to use appropriate functional interface. Complicated shortcut, but nice function