Results for “Queues & collection operations”
Small, practical examples. Search by task or narrow things down below.
Process a file as a lazy line sequence
C#: ReadLines avoids allocating one string containing the entire file.
C#✓ Tested
Process a text file one line at a time
Java: Use a buffered reader to avoid loading a large file into memory.
Java✓ Tested
Process items by numeric priority
C#: PriorityQueue removes the item with the smallest priority value first.
C#✓ Tested
Read a file lazily through the .NET line iterator
PowerShell: ReadLines avoids creating one string containing the entire file.
PowerShell✓ Tested
Read a file length in bytes
Java: Files.size inspects metadata without loading the file into a Java string.
Java✓ Tested
Read a file size in bytes
Python: Use stat().st_size to read the logical byte length without loading the file.
Python✓ Tested
Read a file size in bytes
PowerShell: The Length property of a file item reports its logical byte size.
PowerShell✓ Tested
Read a filename stem and extension
C#: Use Path helpers instead of splitting a path on dots or directory separators.
C#✓ Tested
Read an element’s document coordinates
jQuery: offset returns coordinates relative to the document.
jQuery✓ Tested
Read an ISO-style weekday number
JavaScript: Convert Sunday from zero to seven when using Monday-through-Sunday numbering.
JavaScript✓ Tested
Read an ISO-style weekday number
TypeScript: Convert Sunday from zero to seven when using Monday-through-Sunday numbering.
TypeScript✓ Tested
Read an object’s own enumerable values
JavaScript: Object.values provides values without their corresponding keys.
JavaScript✓ Tested