Martin Ahrer

Thinking outside the box

0001-01-01 1 min read
Stream.toList()
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/sixteen/api/StreamApi.java[tag=toList]

0001-01-01 1 min read
Pattern Matching For Instanceof
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/sixteen/lang/PatternMatchingForInstanceof.java[tag=patternMatchingForInstanceof]
  1. Pattern matching eliminates a required type conversion (type cast).

0001-01-01 1 min read
Record
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/sixteen/lang/Record.java[tag=record]
  1. A record is implicitly final,

  2. has a canonical constructor equal to the header,

  3. has a toString(), equals(), and hashCode() method.

  4. Each member has an accessor method, e.g x() or y().

Compact Canonical Constructor
Continue reading

0001-01-01 1 min read
To Unmodifiable List
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/ten/api/CollectorsApi.java[tag=toUnmodifiableList]

With Collectors.toUnmodifiableList() we can now convert a list into an immutable list.

To Unmodifiable Set
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/ten/api/CollectorsApi.java[tag=toUnmodifiableSet]

With Collectors.toUnmodifiableSet() we can now convert a set into an immutable set.

Continue reading

0001-01-01 1 min read
Copy Of
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/ten/api/ListApi.java[tag=copyOf]

With List.copyOf we can now create an immutable copy of a list.

0001-01-01 1 min read
Copy Of
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/ten/api/MapApi.java[tag=copyOf]

With Map.copyOf we can now create an immutable copy of a list.

Older posts Newer posts