Results for “standard”
Small, practical examples. Search by task or narrow things down below.
Handle three possible outcomes
Java: Check high, normal and low values with an ordered conditional chain.
Java✓ Tested
Hash a file without reading it all at once
Python: Feed fixed-size binary chunks into SHA-256 for files larger than memory.
Python✓ Tested
Hash a UTF-8 value with SHA-256
C#: Use SHA256.HashData for a one-shot content digest.
C#✓ Tested
Implement a method on a struct
Implement a method on a struct in a complete Rust program using the standard library.
Rust✓ Tested
Increment a shared counter atomically
C#: Interlocked performs an indivisible update without a separate lock for this operation.
C#✓ Tested
Increment an atomic counter
Increment an atomic counter using a complete Go program with explicit sample inputs.
Go✓ Tested
Index records by a unique key
Java: Use toMap with an explicit merge rule so duplicate keys have defined behavior.
Java✓ Tested
Initialize a map entry only when absent
Java: Use computeIfAbsent when creating a collection for a new key.
Java✓ Tested
Initialize a resource only once
Initialize a resource only once using a complete Go program with explicit sample inputs.
Go✓ Tested
Initialize shared data once
Initialize shared data once in a complete Rust program using the standard library.
Rust✓ Tested
Insert a value while preserving sorted order
Python: Use insort on an already sorted list; insertion still shifts later list elements.
Python✓ Tested
Insert and retrieve a map value
Insert and retrieve a map value in a complete Rust program using the standard library.
Rust✓ Tested