Loading…
Loading…
Java
The advanced-libraries companion to Core Java I: streams, files, regular expressions, XML, networking, databases, date & time, internationalisation, security, desktop UIs and the Foreign Function and Memory API. Targets Java 25.
Group Java stream elements with Collectors.groupingBy and split them in two with partitioningBy. Covers classifier functions, choosing TreeMap or EnumMap, why partitioningBy always has both keys, the null-key error and groupingByConcurrent for parallel streams.
kvi5hnuCode Sprout team member7 minTurn a Java stream into a map with Collectors.toMap: key and value functions, Function.identity(), the duplicate-key IllegalStateException, merge functions, choosing TreeMap or LinkedHashMap, the null-value trap, toUnmodifiableMap and toConcurrentMap.
kvi5hnuCode Sprout team member8 minGet results out of a Java stream: iterator, forEach versus forEachOrdered, typed arrays with toArray(String[]::new), the differences between toList(), Collectors.toList() and toUnmodifiableList(), toSet, toCollection, joining and summarizingInt statistics.
kvi5hnuCode Sprout team member8 minHow not to use Java Optional (get, isPresent, Optional fields and parameters), how to create Optionals with of, ofNullable and empty, how to chain Optional-returning methods with flatMap, and how Optional.stream drops missing values in a stream pipeline.
kvi5hnuCode Sprout team member9 minUse Java's Optional the right way: unwrap with orElse, orElseGet and orElseThrow (and why orElse evaluates eagerly), consume with ifPresent and ifPresentOrElse, and transform with map, filter and or, without ever calling get.
kvi5hnuCode Sprout team member7 minGet answers out of Java streams with the simple terminal reductions count, max, min, findFirst, findAny, anyMatch, allMatch and noneMatch. Learn why they return Optional, how short-circuiting works, the empty-stream rules and when findAny beats findFirst.
kvi5hnuCode Sprout team member8 minCut, combine and reorder Java streams: limit and skip (with paging), takeWhile and dropWhile versus filter, Stream.concat, distinct, stable sorted with comparators, and peek for debugging, including why peek can silently not run with count().
kvi5hnuCode Sprout team member9 minThe core Java stream transformations: filter keeps elements, map transforms them, flatMap flattens nested results and mapMulti pushes zero or more results without inner streams. Includes grapheme clusters, dropping nulls with ofNullable, and the primitive mapToInt and flatMapToInt.
kvi5hnuCode Sprout team member9 minEvery way to get a Java stream: from collections, arrays and values, infinite streams with generate and iterate, ofNullable, String.lines, Pattern, Scanner, Files.lines, Stream.Builder and iterators, plus the noninterference rule and the Stream.of(int[]) trap.
kvi5hnuCode Sprout team member10 minWhy Java streams exist and how they differ from collections and loops: the "what, not how" style, lazy evaluation, the three stages of a pipeline (source, intermediate, terminal), single-use streams and a first look at parallel streams.
kvi5hnuCode Sprout team member11 minThe complete table of contents for Core Java II, the advanced-libraries companion to Core Java I: streams, I/O, XML, networking, databases, date and time, internationalization, security, Swing and the Foreign Function and Memory API. 110 articles in thirteen parts. Start here, or jump to any part.
kvi5hnuCode Sprout team member9 min