JavaThe @Override annotation lets the compiler check whether a method overrides a supertype method or implements an interface method. It helps catch typos and accidental overloads; it does not itself change the method's runtime behavior.
Basic · Java SE 21; repository runtime, production runtime not attestedJava`@SafeVarargs` is the author's assertion that a method or constructor handles its varargs parameter safely. It suppresses specific unchecked warnings at the declaration and call sites, but neither checks nor repairs type safety.
Intermediate · Java SE 21; repository runtime, production runtime not attestedJava@SuppressWarnings suppresses selected warning categories in an annotated declaration and its contents. It neither repairs code nor guarantees type safety; use the smallest effective scope and explain the reason.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaAbstractCollection.toString returns elements in square brackets, following iterator order and separating them with a comma and a space.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaAbstractMap.toString returns text containing key–value mappings. Their order comes from the entrySet() iterator, not from automatic sorting.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaCreate a fixed-capacity queue with two slots, and distinguish that queue limit from a zero idle keep-alive time for excess pool workers.
Advanced · Java SE 21Javaarray.clone() creates a new array containing copies of its component values. Primitive values are independent, but references still point to the same objects; in multidimensional arrays, subarrays remain shared.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaUse `ArrayDeque` to add elements at the back, remove them from the front, and check how many are left or whether the queue is empty.
Intermediate · Java SE 21JavaThe expression array.length reads the number of array elements as an int. length is a public final field, not a method: the syntax has no parentheses, and an existing array's length cannot be changed.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaArrays.asList creates a fixed-size list view of an array. Elements can be replaced, but the size cannot change; the list and array share their data.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaArrays.binarySearch searches a sorted array. It returns the matching index or a negative result encoding the insertion point.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaArrays.copyOf creates a new array of a specified length. For int[], it removes trailing elements or fills extra positions with zeros without changing the original.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaArrays.sort orders int[] values in ascending order, modifying the supplied array. You can sort the entire array or a selected index range.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaUse an array of reference-type elements as the source of a sequential stream, filter its elements, and collect the result into an array of the right type.
Basic · Java SE 21JavaArrays.toString returns a readable array representation as a String, with square brackets and separators between elements.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaAtomicIntegerFieldUpdater provides atomic operations on an existing object's volatile int field. One updater can serve multiple instances of a class, without a separate AtomicInteger object for each field.
Intermediate · Java SE 21; repository runtime, production runtime not attestedJavaInitialize an atomic counter, read or replace its value, and increment it in one operation. Use a compare-and-set loop to retry a conditional update after a mismatch.
Intermediate · Java SE 21JavaAtomically increase an `AtomicLong` counter by 1 and return the updated `long`, rather than the value before the increment.
Intermediate · Java SE 21JavaSet the starting value of a shared counter, retrieve each number after incrementing, and see why the `POISON` sentinel gets the lowest number.
Advanced · Java SE 21JavaRead the current reference, replace it only when it matches the expected reference by identity, or swap it unconditionally and get the previous configuration back.
Intermediate · Java SE 21Java`AutoCloseable.close()` releases a resource. Call it on an object yourself, or let `try-with-resources` call it automatically when the block exits.
Basic · Java SE 21JavaThe java.util.Base64 class represents bytes as Base64 text and recovers them by decoding. Learn the Basic variant, explicit UTF-8 conversion, and handling of malformed input.
Basic · Java SE 21; repository runtime, production runtime not attestedJavaUse `java.util.Base64` to represent bytes as text and recover the original bytes. Base64 is reversible and provides neither confidentiality nor integrity.
Advanced · Java SE 21JavaAdd BigDecimal values exactly, or use MathContext to set the precision and rounding mode of the result.
Basic · Java SE 21