util.function.IntPredicate: practical reference
util.function.IntPredicate: practical reference: IntPredicate is the primitive specialization of Predicate for an int argument, returning boolean without input boxing.
CKTIS / Java
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
util.function.IntPredicate: practical reference: IntPredicate is the primitive specialization of Predicate for an int argument, returning boolean without input boxing.
Predicate<T> describes a condition on one argument of type T. It supports testing values and combining conditions using logical AND, OR, and negation.
util.function.Supplier: practical reference: Supplier<T> is a zero-argument functional interface whose get method supplies a result of type T.
util.function.UnaryOperator: practical reference: UnaryOperator<T> specializes Function<T,T>: apply accepts a T and returns a result of the same type.
util.HashMap: practical reference: HashMap<K,V> is a hash-table Map implementation that permits one null key and null values without guaranteeing encounter order.
util.HashSet: practical reference: HashSet<E> is a HashMap-backed set that retains one element by equals and hashCode, permits null, and defines no encounter order.
IdentityHashMap compares keys using == rather than equals, so distinct objects with equal contents can be separate keys. Learn put, get, containsKey, and size, including how to distinguish a missing entry from a null value.
Iterator reads collection elements sequentially and, when its optional remove operation is supported, can delete elements during traversal.
LinkedHashMap in java.util stores key–value mappings. The example demonstrates an LRU cache limited to two entries.
util.LinkedHashSet: practical reference: LinkedHashSet<E> combines HashSet with a doubly linked list, providing uniqueness and an encounter order normally matching insertion order.
util.LinkedList: practical reference: LinkedList<E> is a doubly linked list implementing List, Deque, and in Java 21 SequencedCollection; it permits null elements.
List<E> describes an ordered collection with zero-based indexes, usually allowing duplicates. Learn how to read, add, and remove elements, and distinguish a modifiable list from an unmodifiable copy and a range view.
util.ListIterator: practical reference: ListIterator<E> has a cursor between list elements and can traverse both directions while editing the current position safely.
Locale describes the language and regional context used by locale-sensitive operations.
Map<K,V> associates each key with at most one value. Learn lookup, updates, computed values, and map views, with particular attention to null handling and implementation guarantees.
NavigableMap extends SortedMap with neighboring-key lookups and range views whose boundary inclusion can be controlled.
NoSuchElementException is a java.util exception indicating that a requested element does not exist. For example, Iterator.next() throws it when the iterator has no remaining elements.
Learn Objects.requireNonNull, Objects.equals, and Objects.hash: null checks, equality for nullable references, and computing a hash from fields.
Optional<T> represents either a result containing a value or an empty result. Learn presence checks and safe access.
util.OptionalDouble: practical reference: OptionalDouble is a value-based container for one primitive double or absence, without boxing to Double.
util.OptionalInt: practical reference: OptionalInt represents one present primitive int or absence and avoids creating an Integer object.
util.OptionalLong: practical reference: OptionalLong stores one present primitive long or an empty state without boxing to Long.
util.PriorityQueue: practical reference: PriorityQueue<E> is an unbounded heap queue whose head is the least element under natural ordering or the supplied Comparator.
The java.util.Queue interface describes a queue of elements awaiting processing. Learn how offer differs from add and poll differs from remove, how peek inspects the head, and how isEmpty checks whether the queue contains elements.