Results for “library”
Small, practical examples. Search by task or narrow things down below.
Count the items in a collection
Java: Read the collection’s length instead of hard-coding the loop limit.
Java✓ Tested
Count Unicode code points
Java: Use codePointCount when supplementary characters should count as one rather than two UTF-16 units.
Java✓ Tested
Count Unicode code points
Count Unicode code points using a complete Go program with explicit sample inputs.
Go✓ Tested
Count values with the entry API
Count values with the entry API in a complete Rust program using the standard library.
Rust✓ Tested
Count word frequencies
Use Map.merge to count repeated words in Java.
Java✓ Tested
Count word frequencies
Accumulate word counts in an ordered C++ map.
C++✓ Tested
Create a file without overwriting an existing one
Python: Use exclusive creation mode and handle FileExistsError explicitly.
Python✓ Tested
Create a file without replacing existing data
Create a file without replacing existing data in a complete Rust program using the standard library.
Rust✓ Tested
Create a fixed-size array
Create a fixed-size array in a complete Rust program using the standard library.
Rust✓ Tested
Create a nested directory tree
Create a nested directory tree in a complete Rust program using the standard library.
Rust✓ Tested
Create a ZIP archive from a file
Python: Give a ZIP entry a relative archive name instead of exposing its source directory.
Python✓ Tested
Create and clean up a temporary file
Java: Create a unique file and remove it in finally even when the operation fails.
Java✓ Tested