Typed Table Column Definitions
Type column definitions against the row's own keys so unknown keys fail compilation and each format callback gets the fully typed row.
Page 12 of 50
Type column definitions against the row's own keys so unknown keys fail compilation and each format callback gets the fully typed row.
Push a fresh snapshot before every mutation: undo pops to the previous state, redo replays the future, and any new edit clears the redo stack.
Flip a union of option objects into an intersection through contravariant function positions, so merged option sets require every member.
Render only the rows inside the scroll viewport and give a spacer the full height, so a 5000-row list paints a dozen nodes per frame.
Count in-flight tasks with a WaitGroup: add before spawning, done in each task, and await wait() so the program resumes exactly when all work drained.
Roll one random number against cumulative weights so each item wins with probability proportional to its weight, then verify the split over many draws.
Open the print dialog with window.print() and use beforeprint/afterprint listeners to swap chart markup for print-friendly tables and restore it after.
Build lock-free state flags on atomic.Uint32 with bit masks and CompareAndSwap, so a busy bit flips only when the current word still matches.
The same bytes encode differently under base64.StdEncoding and base64.URLEncoding: +/ become -_ in the URL alphabet, and Raw variants drop = padding.
Extend 64-bit arithmetic with math/bits.Add64 and bits.Mul64, which surface carries and high halves so multi-word sums and products stay exact.
bufio.ScanWords streams whitespace-separated tokens from any reader, so word counting works incrementally without loading whole input.
copy moves min(len(dst), len(src)) elements and returns that count, so short destinations silently truncate and you can detect it.
SignASN1 produces a DER-encoded ECDSA signature over a SHA-256 digest, and VerifyASN1 rejects the same signature for a different message.
Assemble RFC 4122 version-4 UUIDs from crypto/rand bytes by setting the version and variant bits, then format canonical hex groups.
csv.Reader with FieldsPerRecord set to -1 accepts rows of any width, while the default mode rejects records that differ from the first row.
debug.ReadBuildInfo reports the module path, Go version, and VCS revision so a CLI binary can print its own version information.
Deferred call arguments are evaluated when the defer statement runs, while a deferred closure reads the variable's latest value.
fmt.Fscan pulls whitespace-separated tokens from any reader and converts them by pointer type, so parsing does not need a fixed layout.
SetBasicAuth writes the standard Authorization header for you: base64 of user:password that decodes back with a single colon separator.
Comparing two interface values whose dynamic type is a slice or map panics at runtime; guard the comparison with recover or a type switch.
Write an iter.Seq2 function yielding line-number and text pairs so range-over-func consumers can break out and stop the iterator.
Decode a JSON array of records, sort by a numeric field with slices.SortFunc, then re-encode so reports stop trusting upstream ordering.
The two-result map lookup tells a missing key apart from a key stored with its zero value, which plain indexing cannot do.
Sort intervals by start, then extend the last merged span while the next one overlaps, collapsing an unsorted timeline into disjoint ranges.
A method value binds its receiver into a reusable func, while a method expression passes the receiver explicitly as the first argument of the same method.
os.File.Readdirnames returns entry names without FileInfo allocations, a cheaper listing when the code only needs what a directory contains.
Two goroutines trade turns across two unbuffered channels; every handoff is a rendezvous, so the printed ping and pong sequence is fully deterministic.
Each pipeline stage ranges its input and defers close on its own output, so a three-stage chain drains fully and ends without leaks.
Encode non-ASCII mail bodies with mime/quotedprintable so bytes become =XX escapes and soft line breaks keep lines under the 76-character limit.
Draw normal-distributed samples from math/rand/v2 with NormFloat64, scaling the unit variance output to a target mean and standard deviation.
Range variables are copies of each element, so field writes silently vanish; fix it with index writes or a slice of pointers.
reflect.StructTag.Lookup reads custom validate tags per field and distinguishes a missing tag from an empty one, which Get cannot do.
Encode integers by greedy subtraction over descending numeral pairs, then decode by longest-prefix matching the same table back.
Sample runtime.NumGoroutine() before, during, and after a worker batch so a pool that never drains shows up as a count that never returns to baseline.
runtime.Stack writes the current goroutine trace into a caller buffer, and the all=true variant dumps every goroutine for health diagnostics.
Compute SHA-1 digests with crypto/sha1 for legacy fingerprint formats, summing whole payloads or writing chunks through the hash interface.
Walk every case variant of a rune with unicode.SimpleFold, which returns the next equivalent rune and wraps back to the original at cycle end.
slices.All yields index and value pairs as iter.Seq2, so a full pass over a slice can be handed to any function that consumes pairs.
Rank slices element by element with slices.Compare, which reports the first differing element, while CompareFunc applies a custom ordering rule.
slices.SortedFunc returns a freshly sorted copy and leaves the original intact, so audit order survives every presentation sort.
WithGroup prefixes attributes added after it under a dotted path, while With pins attributes onto every later record from that logger scope.
Extract typed fields from fixed-layout strings with fmt.Sscanf, where verbs, literals, and skipped tokens in the format string mirror the input exactly.
ParseInt takes a bitSize ceiling, clamps out-of-range values to that width maximum, and returns ErrRange so 32-bit API fields stay bounded.
strings.TrimFunc strips leading and trailing runes while a predicate holds, with TrimLeftFunc and TrimRightFunc for one-sided variants.
Remove a sync.Map entry and read its old value in one atomic step with LoadAndDelete, avoiding the check-then-delete race of separate calls.
template.Option("missingkey=error") turns missing map keys from silent <no value> output into Execute errors that name the exact key.
time.Ticker.Reset changes the interval between ticks, so a poller can start fast and back off to slower cadence without rebuilding the timer.
AddDate steps one calendar day at a time, so a for loop covers a date range cleanly even when it crosses a month boundary.
Sanitize hostile input with strings.ToValidUTF8, which replaces invalid UTF-8 byte runs with a fixed substitute string and leaves valid text untouched.
Index values as you scan, then look up the complement target-minus-current so each pair is found in one pass with no nested loops.
A type alias is the same type including its method set, while a named type over the same struct starts with an empty method set.
Untyped constants keep arbitrary precision until assignment, so one constant can initialize any integer type that can hold its value.
Walk a byte slice with utf8.DecodeRune, which consumes one UTF-8 sequence per call and reports its width so malformed bytes surface as RuneError.
Align two parallel slices into paired records by index and stop at the shorter side, so leftover names never get fabricated scores.
Compress a byte stream with zlib.NewWriter, then decompress with zlib.NewReader while the underlying Adler-32 checksum validates every roundtrip.
Arrays.asList on an int[] builds a one-element List<int[]> instead of boxing: pass an Integer[] (or IntStream.boxed) for element-wise conversion.
Arrays.parallelSort splits a large object array into sub-arrays sorted and merged across the ForkJoin common pool; small arrays fall back to TimSort.
Arrays.setAll fills an array from an index-based generator, and parallelSetAll splits the same job across threads when the fill is expensive.
updateAndGet and accumulateAndGet hand back the new value; getAndUpdate and getAndAccumulate return the old one. All four update atomically.
Peek ahead with mark and reset a BufferedReader to re-read characters after deciding how to parse them; exceeding readAheadLimit invalidates the mark.
Validate Java identifiers with Character.isJavaIdentifierStart and isJavaIdentifierPart; they accept letters, digits, underscore, dollar sign, Unicode letters.
A raw alias can smuggle an Integer into a plain List<String>, which only explodes on read; Collections.checkedList throws the ClassCastException at the insert.
Compare getName, getSimpleName and getCanonicalName across a plain class, a nested interface, an array and an anonymous class whose canonical name is null.
Strip edges and collapse whitespace runs with \s+ into single spaces before equality or dedup checks, noting which characters \s does not cover.
Collections.newSetFromMap turns any empty Map into a Set, inheriting the map ordering and concurrency: with a LinkedHashMap you get insertion-ordered sets.
One timed-out await puts a CyclicBarrier into the broken state: later awaiters get BrokenBarrierException immediately, and reset() clears it for the next round.
Wrap an InputStream in DigestInputStream so every chunk read feeds the MessageDigest, and confirm the streaming digest equals a one-shot update.
Escape the five HTML entities a text node needs (&, <, >, quotes) with a tiny switch, so user-provided strings can be embedded in markup safely.
Probe files with Files.isReadable, isWritable, and isExecutable; they return false on missing files instead of throwing, and executability is platform-specific.
Extend FilterReader to mask digits during reads; override the bulk read too because FilterReader forwards it to the underlying stream and would skip the mask.
Read a Future's terminal state non-blockingly with state() and the State enum, distinguishing SUCCESS, FAILED, CANCELLED, and RUNNING without waiting.
Run stream mapping on up to N virtual threads with Gatherers.mapConcurrent, which fans work out concurrently yet keeps encounter order in the output.
Aggregate parallel streams straight into ConcurrentMaps with groupingByConcurrent and toConcurrentMap, supplying the merge function key conflicts require.
Allocate maps and sets sized for a known entry count with HashMap.newHashMap and HashSet.newHashSet so later puts generally add without resizing.
Format byte counts through a binary-unit ladder from B to TiB with one-decimal rounding, so reports show 1.5 GiB instead of raw long values.
Bucket a date into fiscal quarters with IsoFields: QUARTER_OF_YEAR labels the quarter and DAY_OF_QUARTER reconstructs its first and last day.
Feed urgent jobs from the head and routine jobs from the tail of a bounded LinkedBlockingDeque; timed offerLast degrades instead of blocking forever.
Convert a List with toArray: the no-arg form erases to Object[], new String[0] allocates the right type, and an oversized array keeps spare slots null.
Scan column by column to keep only the characters every string shares, so grouped keys like deploy-api and deploy-web reduce to their deploy- stem.
Math.abs(Integer.MIN_VALUE) does not throw: the documented contract returns the same negative value, so widen to long or guard the boundary before negating.
Page counts without off-by-one: Math.ceilDiv rounds the quotient up and rejects zero divisors; unsignedMultiplyHigh returns the 128-bit product's top half.
Math.fma computes a*b+c with unlimited intermediate precision and rounds once, so it can differ from the two-rounding expression a*b+c in the last bits.
Step between representable doubles with Math.nextUp and nextDown, measure the gap with ulp, and watch nextUp of MAX_VALUE reach Infinity.
One multi-catch clause handles NumberFormatException and DateTimeParseException together; the types must be unrelated or the compiler rejects it.
An inner class carries an outer instance and reads its private fields; a static nested class is a plain top-level class parked inside another one.
Process.onExit returns a CompletableFuture completed at termination regardless of exit status, so cleanup code can chain instead of blocking on waitFor.
Refresh under a write lock, then take the read lock before releasing the write lock — the documented downgrade that keeps writers out with no unlocked gap.
Break a version string apart with Runtime.Version.parse: feature, interim, update and patch come back as ints while pre, build and optional arrive as Optionals.
Request a DRBG SecureRandom at 256-bit strength with prediction resistance and reseeding, then read back the algorithm, provider and a HexFormat token.
Seek a SeekableByteChannel to any byte offset, read or overwrite in place, and watch the same channel re-read after rewinding its position.
Format dates safely across threads: SimpleDateFormat instances are not synchronized per javadoc, so build one per call or share an immutable DateTimeFormatter.
Route printStackTrace into a StringWriter and PrintWriter to capture the whole trace as one string for log lines, assertions, and error envelopes.
After an optimistic snapshot fails validation, take a read lock and let tryConvertToWriteLock upgrade it to a write stamp in one uncontended step.
Break a log-style line into word, number, quoted phrase and raw character tokens with StreamTokenizer, and report line ends via lineno once enabled.
StrictMath pins transcendental functions to published fdlibm 5.3 algorithms so results are bit-for-bit identical on every platform; Math trades that for speed.
String literals share one pooled instance, a new copy is equal but not identical, and intern() returns the canonical pooled instance for the same content.
String.transform applies a function to the string and returns its result, so multi-step text pipelines read in order without nested call nesting.
Race the same append loop on a shared StringBuffer and StringBuilder: the synchronized buffer lands every char, the unsynchronized one prints its shortfall.
System.arraycopy copies between arrays with overlap handled as if through a temporary buffer, and throws instead of writing when bounds or types do not fit.
Thread.sleep(Duration) sleeps a JDK-19 style span: negative durations are a silent no-op, and interruption throws InterruptedException after clearing the flag.