LocalDate PlusDays And EpochDay Math
Advance dates with plusDays and minusDays across month boundaries, then convert with toEpochDay and fromEpochDay when plain day counts are needed.
Page 3 of 50
Advance dates with plusDays and minusDays across month boundaries, then convert with toEpochDay and fromEpochDay when plain day counts are needed.
List the ISO country and language codes the JDK knows with getISOCountries and getISOLanguages, then validate user input against those sets.
Render dates with ofLocalizedDate and FormatStyle, where the pattern itself comes from the formatter locale and FULL/LONG need a zone on the temporal.
Roll up grouped long metrics with Collectors.summarizingLong and LongSummaryStatistics, keeping count, sum, min, and max together per group.
Write conditionally into a Map with putIfAbsent and computeIfPresent, so a first writer wins a slot and later writers adjust existing entries.
Carry a time-of-day with a fixed UTC offset in OffsetTime, keeping wall-clock through withOffsetSameLocal and the instant through withOffsetSameInstant.
Transform wrapped values with map and keep the Optional flat with flatMap, so parsing and validation steps compose without nested wrappers.
Treat 32-bit patterns above Integer.MAX_VALUE as large positives with parseUnsignedInt and divideUnsigned, matching what wire formats and hashes encode.
Read ofPattern letter counts: M counts switch number to short, full, narrow text; yy parses with a 2000-2099 base; y is year-of-era while u is the year.
Parse P1Y2M3W4D text where weeks fold into days, add periods component-wise with no normalization, and normalize only when months should carry into years.
InputStream.readNBytes reads up to the requested count and never returns negative values, so chunked uploads get a clean empty-array end signal.
Insert at both ends with addFirst and addLast from the JDK 21 SequencedCollection interface, then poll from either side without index arithmetic.
flatMap expands each stream element into a sub-stream, generating ordered pair combinations or flattening nested lists in one pipeline.
String.compareTo compares UTF-16 code units one position at a time, so uppercase letters sort before lowercase and prefixes yield a length difference.
Search arrays from the right with lastIndexOf, whose fromIndex marks where the backward scan begins and silently clamps out-of-range starts instead of throwing.
Intl.Collator sensitivity climbs from base to variant: base folds case and accents, accent keeps accents, case keeps case, and variant distinguishes both.
Node.compareDocumentPosition returns a bitmask combining containment and document order, so one call answers contains, contained-by, before, and after.
Pull deep fields out in one statement with nested destructuring, rename bindings with colons, and combine defaults so missing API data cannot crash a render.
String.fromCodePoint accepts surrogate pairs and ZWJ sequences while length counts UTF-16 units, so one emoji can span two units or five across joins.
DateTimeFormat.formatToParts splits a formatted date into typed fields that reassemble into ISO stamps, and resolvedOptions reports the chosen locale rules.
concat spreads array-like values only when Symbol.isConcatSpreadable is true; flipping the flag keeps real arrays nested or flattens array-likes on demand.
Adding an abort listener after the signal already aborted does not throw and does not fire, so cleanup paths must check signal.aborted before subscribing.
Sort user-facing text with String.prototype.localeCompare or Intl.Collator, whose numeric and case-first options fix the classic 2-before-10 ordering bug.
Bound values with Math.min and Math.max — empty calls return the infinities, any NaN poisons the result, and nesting the two builds a clamp.
Classify and normalize numbers with Math.sign and Math.abs: sign preserves -0 as -0, abs collapses it to 0, and both propagate NaN untouched.
Parse numeric strings with parseFloat and parseInt, which tolerate trailing garbage where Number() rejects it — choose deliberately per input source.
A ReadableStream consumer calls reader.read() until done flips true, decoding each Uint8Array chunk with stream:true so multi-byte splits stay intact.
Read single UTF-16 code units with charAt and charCodeAt — out-of-range asks return the empty string and NaN instead of throwing, unlike bracket access.
Measure and index strings by UTF-16 code units: length and bracket access split astral emoji into surrogates, while spread iteration reads whole code points.
Duplicate strings with repeat for indentation and separator lines: zero returns the empty string, while negative or infinite counts raise RangeError.
Compute replacements at runtime with a function passed to replace, where the callback receives the match, capture groups, offset, and the full string.
split keeps trailing empties by default; the limit argument truncates and discards the remainder; matchAll preserves capture groups.
TextEncoder.encodeInto writes into an existing Uint8Array and reports both read and written counts, stopping at the buffer boundary instead of allocating.
Teach the + operator to work on your class by defining __add__, and make instances print readably with __repr__, returning NotImplemented for wrong types.
Implement __contains__ on a class so membership checks run your logic; the fallback when missing is __iter__, not __len__.
Get the most frequent values with statistics.multimode, which keeps every tied value in first-seen order instead of returning one arbitrary winner.
Center strings in a fixed width with str.center, which splits leftover padding between the sides, rejects multi-character fills, and never truncates.
Count substring occurrences with str.count, which scans left to right and never counts the same bytes twice — the classic non-overlapping trap.
Locate substrings with str.find when absence is expected and str.index when it is not, while the in operator answers pure membership without a position.
Render strings with str.format positional, named, and indexed fields — the one path where the template itself can live in a variable, unlike f-strings.
Gate input by character class with isalpha, isalnum, and isspace — all three return False for empty strings, so strip before judging user input.
Trim known prefixes and suffixes with removeprefix and removesuffix, which return the string untouched when the affix is absent instead of raising.
Validate routing prefixes with str.startswith, which accepts a tuple of candidates and a start offset so one call replaces or-ed comparisons.
Flip letter case in place with str.swapcase and gate display rules with istitle, isupper, and islower, which all return False for empty or digit-only strings.
Render datetimes with strftime format codes — %Y %m %d %H %M %S for fields, %f for microseconds — and round-trip the output through strptime.
any and all stop consuming the iterator at the first decisive element, observable by logging how many items each visit actually touches.
Apply &mut references at function boundaries to edit data in place, showing that exclusive borrows end before new borrows begin.
Shift letters by a fixed offset using u8 arithmetic on ASCII ranges, wrapping inside each case so digits and punctuation stay untouched.
Cover the divide, remainder, and shift corners that checked_add misses: checked_div rejects zero, checked_shl rejects shifts past the width.
Shift safely with checked_shl and checked_shr: any shift amount at or beyond the type width yields None instead of masked, surprising bits.
Classify each char through a match with or-patterns and guards, tallying vowels, consonants, and non-letters in one pass.
Advance a traffic light through cycles by matching the current variant and returning the next one, so impossible transitions cannot be written.
Render byte slices as lowercase and uppercase hex using {:02x} and {:02X}, then re-parse the string back into bytes.
Implement FromStr so a custom type plugs into str.parse, returning a typed error instead of a generic message on bad input.
Parse key-value config lines with let-else so each malformed line diverges into a warning branch while the success path stays flat.
Returned values move out of the function into the caller, shown by the compile-time dead bindings and by borrowing the result afterwards.
Split a string, trim whitespace, and parse each field into numbers, keeping valid values and reporting the fields that failed.
Guarantee a one-field wrapper has the identical memory layout as its inner type with #[repr(transparent)], so transmutes and FFI stay sound.
Collapse Result<Result<T,E>,E> into a single layer with flatten, keeping only the outer error when the wrapper itself failed.
Mirror a whole integer with reverse_bits and probe bit patterns with count_zeros, leading_ones, and trailing_ones — count_ones + count_zeros stays fixed at 8.
Take the last element plus the front slice with split_last, and its mirrored split_first, to write recursive slice walkers without index math.
Use _ and _binding to silence parts of a pattern: _ never binds, _x binds without moving, so borrowed fields stay borrowable.
Convert an owned Vec into a static-lifetime slice with Vec::leak, trading the deallocation path for data that lives for the whole program.
RENAME COLUMN and RENAME TO are metadata-only changes: they take an ACCESS EXCLUSIVE lock, rewrite no data, and leave views referencing the old name broken.
Construct fixed-shape arrays with array_fill, choosing each dimension length and optionally a non-1 lower bound per dimension.
CREATE CAST tells PostgreSQL how to convert between two types, with WITH/AS assignment or implicit context deciding which casts apply without an explicit ::.
Read and write session parameters with current_setting and set_config: missing_ok returns NULL for unknown keys, and is_local scopes writes to one transaction.
daterange folds inclusive upper bounds to next-day exclusive form, reports emptiness with isempty, and joins touching bookings with the -|- adjacency operator.
Remove the current row from its own window frame with EXCLUDE CURRENT ROW, so aggregate comparisons measure peers only and never the row being scored.
Read and flip individual bits with get_bit and set_bit on a bit column, packing boolean flags where the leftmost bit is bit 0.
INSERT ... SELECT maps the select list onto the target column list by position, so column names need not match but the order must.
Test dates, timestamps, and intervals with isfinite, which flags the infinity literals that stand in for open-ended ranges.
Update nested JSON documents with jsonb_set_lax, whose null_value_treatment decides whether SQL NULL becomes JSON null, a deleted key, or an error.
PostgreSQL % and mod() return a remainder carrying the dividend sign, so negative ids hash to negative buckets unless you wrap with mod(mod(x,n)+n,n).
Use the money type for currency that stays exact through addition and SUM, while division by an integer truncates and numeric mixes need casts.
NULLIF(a, b) returns NULL when its arguments match, so empty form fields collapse to real NULLs and one COALESCE covers blank and missing alike.
Inspect pg_matviews to see every materialized view, its owner, and refresh state, then compare with pg_views for plain views.
Read pg_stat_user_functions to see how often each PL/pgSQL function runs and how much time it consumes, gated by track_functions.
pg_typeof prints the real type of any expression, exposing literal surprises like unknown-typed strings and numeric results from floor(numeric).
Under READ COMMITTED, an UPDATE blocked by a concurrent writer rechecks its WHERE against the committed new version, so conditions can silently stop matching.
REPEATABLE READ pins one snapshot for the whole transaction, so re-reads return identical rows even after other sessions commit changes.
A FROM-less SELECT evaluates one row of constant expressions, the quickest way to probe function output, casts, and operator semantics.
SET ROLE changes the effective user inside a session, RESET ROLE returns to the login role, and privileges flip with each switch.
Match whole strings with SIMILAR TO, which keeps LIKE wildcards but adds POSIX alternation, repetition, and bracket classes — while the dot stays literal.
Split one delimited column into one row per token with string_to_table, from empty segments to a null_string that turns matching fields into NULL.
SUM(DISTINCT x) collapses equal values inside one aggregate, which silently shrinks totals when legitimate duplicates exist; dedup a known key instead.
Shrink arrays from the tail with trim_array, which trims only the first dimension of multidimensional input and returns an empty array when n reaches length.
flat(1) only unwraps one array level and the compiler tracks it: flat(2) and flat(Infinity) return deeper element unions, so type errors surface wrong depths.
The details toggle event arrives as a plain Event, so handlers cast to ToggleEvent once and read newState, oldState, and the open flag with full types.
Intl.NumberFormat renders currency per locale and formatToParts splits the result into typed parts, so symbol, integer, and fraction render separately.
Chained Object.assign calls give the result an intersection of every source type, so a later patch with different field shapes widens reads instead of erroring.
Object.keys returns string for typed objects, so a cast restores the union; Object.entries pairs each key with its value type for typed rebuilds.
A Record keyed by a role union forces every entry to exist, so reading table[role] never returns undefined and capability checks need no runtime fallback.
HTMLInputElement.setRangeText replaces a character range with four selection modes, and omitting start and end targets the current user selection instead.
Array.from with a fill(0) inner call gives each matrix row an independent array, while copyWithin moves values inside one array in place with typed bounds.
findLast and findLastIndex search backwards through readonly arrays and return undefined or -1 when nothing matches, typed as T | undefined at the call site.
formatToParts yields Intl.DateTimeFormatPart objects that narrow on part.type, and resolvedOptions reports the exact locale, calendar, and hour cycle chosen.
Spreading map.entries() yields typed tuple arrays that sort and filter like normal arrays, and new Map(entries) rebuilds with insertion order restored.
Object.freeze pairs with Readonly type annotations so runtime writes throw TypeError while compile-time index writes fail before the build.
queueMicrotask callbacks run after the current task in FIFO order interleaved with promise reactions, so all microtasks drain before any timer fires.