live coding java 8 urs peter
TRANSCRIPT
![Page 2: Live coding java 8 urs peter](https://reader036.vdocuments.net/reader036/viewer/2022062319/554e58e1b4c905b2178b4e53/html5/thumbnails/2.jpg)
New Features of Java 8
• JSR 335 Lambda Expressions and Virtual Extension Methods
• JSR 308 AnnotaJons on Java Types Map<@NonNull String, @NonEmpty List<@Readonly Document>> files; !
• JSR 310 Date and Time API OffsetDateTime now = OffsetDateTime.now(); System.out.println(now.format(DateTimeFormatter.ISO_DATE)); !
![Page 3: Live coding java 8 urs peter](https://reader036.vdocuments.net/reader036/viewer/2022062319/554e58e1b4c905b2178b4e53/html5/thumbnails/3.jpg)
New Features of Java 8
• JSR 335 Lambda Expressions and Virtual Extension Methods
• JSR 308 AnnotaJons on Java Types Map<@NonNull String, @NonEmpty List<@Readonly Document>> files; !
• JSR 310 Date and Time API OffsetDateTime now = OffsetDateTime.now(); System.out.println(now.format(DateTimeFormatter.ISO_DATE)); !
![Page 4: Live coding java 8 urs peter](https://reader036.vdocuments.net/reader036/viewer/2022062319/554e58e1b4c905b2178b4e53/html5/thumbnails/4.jpg)
New Features of Java 8
• JSR 335 Lambda Expressions and Virtual Extension Methods
• JSR 308 AnnotaJons on Java Types Map<@NonNull String, @NonEmpty List<@Readonly Document>> files; !
• JSR 310 Date and Time API OffsetDateTime now = OffsetDateTime.now(); System.out.println(now.format(DateTimeFormatter.ISO_DATE)); !
FuncAonal Programming
MulAple Inheritance of Behaviour
![Page 5: Live coding java 8 urs peter](https://reader036.vdocuments.net/reader036/viewer/2022062319/554e58e1b4c905b2178b4e53/html5/thumbnails/5.jpg)
Let’s Dive into Java 8!
![Page 6: Live coding java 8 urs peter](https://reader036.vdocuments.net/reader036/viewer/2022062319/554e58e1b4c905b2178b4e53/html5/thumbnails/6.jpg)
What will change for you?
FuncJonal programming becomes mainstream!
![Page 7: Live coding java 8 urs peter](https://reader036.vdocuments.net/reader036/viewer/2022062319/554e58e1b4c905b2178b4e53/html5/thumbnails/7.jpg)
How to get funcJonal
• Change the way you look at programming logic: – Think in terms of transforming data or input/output …instead manipulaJng state
– Make immutable programming the default, mutable programming the excepJon
– FuncJonal programming implies programming on a higher abstracAon level
![Page 8: Live coding java 8 urs peter](https://reader036.vdocuments.net/reader036/viewer/2022062319/554e58e1b4c905b2178b4e53/html5/thumbnails/8.jpg)
How to get funcJonal
• Start using higher order funcJons (filter(), map() etc.) in CollecJons/Streams – Whenever you use a for loop try to come up with a funcJonal alternaJve
• Use Lambda’s in your own so]ware structures – E.g. Use Lambda’s instead of a Template or Strategy pa^ern
• Learn to read Javadoc for Lambda’s
![Page 9: Live coding java 8 urs peter](https://reader036.vdocuments.net/reader036/viewer/2022062319/554e58e1b4c905b2178b4e53/html5/thumbnails/9.jpg)
When to apply Virtual Extension Methods
• Use Virtual Extension Methods to make new addiJons to your
API backwards compaJble
• Add useful default implementaJons to your interfaces – E.g. Comparator: boolean gt(T other), boolean lt(T other) !
• Bundle cross-‐cuang behaviour in interfaces with default methods – E.g. Logging