Martin Ahrer

Thinking outside the box

0001-01-01 1 min read

The following describes selected improvements of the Java API. See the Java 9 release notes.

Unresolved directive in <stdin> - include::ImmutableListFactory.adoc[leveloffset=+1] Unresolved directive in <stdin> - include::ImmutableSetFactory.adoc[leveloffset=+1] Unresolved directive in <stdin> - include::MatcherApi.adoc[leveloffset=+1] Unresolved directive in <stdin> - include::OptionalApi.adoc[leveloffset=+1] Unresolved directive in <stdin> - include::ImmutableMapFactory.adoc[leveloffset=+1] Unresolved directive in <stdin> - include::ObjectsApi.adoc[leveloffset=+1] Unresolved directive in <stdin> - include::ImmutableMapEntryFactory.adoc[leveloffset=+1] Unresolved directive in <stdin> - include::StreamApi.adoc[leveloffset=+1] Unresolved directive in <stdin> - include::CollectorsApi.adoc[leveloffset=+1]

Continue reading

0001-01-01 1 min read
Take While
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nine/api/StreamApi.java[tag=takeWhile]

We can take (accept) stream elements matching a predicate.

Drop While
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nine/api/StreamApi.java[tag=dropWhile]

We can drop stream elements matching a predicate.

Iterate
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nine/api/StreamApi.java[tag=iterate]

Generate a stream using an iteration.

Continue reading

0001-01-01 1 min read

The following describes selected improvements of the Java language. See the Java 9 release notes.

Unresolved directive in <stdin> - include::PrivateInterfaceMethod.adoc[leveloffset=+1] Unresolved directive in <stdin> - include::TryWithResource.adoc[leveloffset=+1]

0001-01-01 1 min read

An interface can now have private methods. These can simplify implementing default methods.

Say Hello
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nine/lang/PrivateInterfaceMethod.java[tag=tagname]

0001-01-01 1 min read
Before Java9
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nine/lang/TryWithResource.java[tag=beforeJava9]

Before Java 9 a variable referencing a resource had to be redeclared (and assigned) in the try block in order to be automatically closed.

With Java9
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nine/lang/TryWithResource.java[tag=withJava9]

Variables that are effectively final can be used in a try with resource block (and don’t have to be redeclared).

Continue reading

0001-01-01 1 min read

It is now possible to create pre allocated hash maps and hash sets through a set of new factory methods on Set and Map implementations.

New Hash Map
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nineteen/api/CollectionApi.java[tag=newHashMap]
New Hash Set
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nineteen/api/CollectionApi.java[tag=newHashSet]
Continue reading

0001-01-01 1 min read
Of Localized Pattern
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nineteen/api/DateTimeFormatterApi.java[tag=ofLocalizedPattern]

The formatted value is Sep 2022. Read more about the pattern template in the API documentation.

Append Localized
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/nineteen/api/DateTimeFormatterApi.java[tag=appendLocalized]

The formatted value is Sep 2022. Read more about the pattern template in the API documentation.

Continue reading
Older posts Newer posts