Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Knowledge base

Knowledge base

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 5788

Java

Collectors.collectingAndThen: practical reference

Collectors.collectingAndThen: practical reference: Collectors.collectingAndThen adapts a downstream collector and applies a finishing function exactly once to its completed result; the returned collector does not retain IDENTITY_FINISH.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Collectors.counting: practical reference

Collectors.counting: practical reference: Collectors.counting returns a collector equivalent to reducing every element to 1L and summing, so its result type is Long.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Collectors.groupingBy: practical reference

Collectors.groupingBy: practical reference: Collectors.groupingBy classifies each element by a key function and accumulates a Map from keys to group results; its overloads select the map supplier and downstream collector.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Concurrent grouping and counting in Java

`Collectors.groupingByConcurrent` groups stream elements by key and can count each category without preserving the order in which elements are encountered.

Advanced · Java SE 21
Java

Collectors.joining: practical reference

Collectors.joining: practical reference: Collectors.joining concatenates CharSequence elements, optionally inserting a delimiter and surrounding the result with a prefix and suffix.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Collectors.mapping: practical reference

Collectors.mapping: practical reference: Collectors.mapping applies a mapping function to each input and forwards the mapped values to a downstream collector.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Collectors.partitioningBy: practical reference

Collectors.partitioningBy: practical reference: Collectors.partitioningBy divides input into exactly two Boolean-keyed groups according to a predicate, with an optional downstream collector.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Collectors.toList: practical reference

Collectors.toList: practical reference: Collectors.toList accumulates stream elements into a List while making no promise about the concrete list type, serializability, thread safety, or mutability.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Collectors.toMap: practical reference

Collectors.toMap: practical reference: Collectors.toMap creates a Map from key and value mapping functions; overloads control duplicate-key merging and the concrete map supplier.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Collectors.toSet: practical reference

Collectors.toSet: practical reference: Collectors.toSet accumulates elements into a Set and therefore removes duplicates, but it does not guarantee set type, order, mutability, serializability, or thread safety.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Reverse a comparator with Comparator.reversed()

`Comparator.reversed()` returns a comparator that orders elements in the opposite direction from an existing comparator. The call itself does not sort or change a list.

Basic · Java SE 21