util.Random: practical reference
util.Random: practical reference: Random generates a pseudorandom sequence with a 48-bit linear algorithm; the same seed and identical call sequence produce the same values.
CKTIS / Java
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
util.Random: practical reference: Random generates a pseudorandom sequence with a 48-bit linear algorithm; the same seed and identical call sequence produce the same values.
java.util.regex.Matcher applies a regular expression to text. matches() checks the entire region, find() searches for successive substrings, and group() reads the result of a successful match.
java.util.regex.Pattern stores a compiled regular expression. Pattern.compile creates the pattern, and Pattern.matcher creates a Matcher for checking an entire input or searching for matching subsequences.
util.regex.PatternSyntaxException: practical reference: PatternSyntaxException is an unchecked IllegalArgumentException that reports a syntax error while a regular-expression pattern is compiled.
java.util.Scanner reads text tokens and lines. Distinguish reading a number from reading the remainder of a line, and configure number formatting explicitly.
util.SequencedCollection: practical reference: SequencedCollection<E> defines a collection with a well-defined encounter order, operations at both ends, and a reverse-ordered view.
util.SequencedMap: practical reference: SequencedMap<K,V> is a map with a defined encounter order for mappings, operations on its first and last entries, and a reverse-ordered view.
util.SequencedSet: practical reference: SequencedSet<E> combines Set uniqueness with a defined encounter order, end operations, and a reversed view whose type remains SequencedSet.
util.ServiceLoader: practical reference: ServiceLoader<S> locates zero, one, or many service providers in the runtime environment and loads them lazily without exposing implementation locations.
Set<E> describes a collection of unique elements. Learn how to add, check, remove, and count elements, and distinguish the Set interface from the HashSet implementation.
SortedMap orders keys by their natural ordering or a comparator. firstKey() and lastKey() return the endpoint keys in that ordering; both throw an exception for an empty map.
java.util.Spliterator supports reading elements and partitioning the remaining range. Source characteristics describe properties such as ordering and size accuracy; splitting alone does not start parallel execution.
Collector<T, A, R> describes accumulating stream elements into mutable state and transforming it into a result. Learn the collector functions, parallel-processing requirements, and the meaning of its characteristics in Java SE 21.
The java.util.stream.Collectors class supplies collectors for Stream.collect. Combine Collectors.groupingByConcurrent with Collectors.summarizingDouble to calculate numeric summary statistics separately for each group.
DoubleStream processes primitive double values through a lazy pipeline. Learn stream creation, filtering, and the terminal operations count() and average().
IntStream processes primitive int values. It supports filtering data, testing conditions, and calculating element counts, sums, and averages.
LongStream processes primitive long values rather than Long objects. LongStream.of creates a stream from supplied values, and LongStream.sum completes processing and returns their sum as a long.
Stream<T> processes object references through a lazy pipeline. Learn stream creation, result arrays, primitive mappings, and encounter-order guarantees.
util.StringJoiner: practical reference: StringJoiner builds text from elements separated by a delimiter and optional prefix and suffix.
TreeMap orders entries by key. Learn the difference between copying with TreeMap(Map), retaining a comparator with TreeMap(SortedMap), and using the constructor reference TreeMap::new.
util.TreeSet: practical reference: TreeSet<E> is a TreeMap-backed NavigableSet sorted naturally or by a Comparator, with add, remove, and contains guaranteed O(log n).
util.UUID: practical reference: UUID represents an immutable 128-bit value; the class methods manipulate the Leach-Salz variant layout, although its constructor can create any UUID variant.
WeakHashMap holds keys through weak references: the map alone does not protect them from garbage collection. Learn put, get, containsKey, containsValue, and size, including the distinction between a missing entry and a null value.
Compare the no-argument constructor with the constructor that takes a capacity. Learn what `Integer.MAX_VALUE` means and what `offer(E)` does when a queue with capacity 2 is full.