Tag

Iterator

0 views collected around this technical thread.

Architecture Digest
Architecture Digest
May 13, 2025 · Fundamentals

Understanding HashMap Traversal: keySet vs entrySet and Iterator Mechanics

This article explains the various ways to traverse a Java HashMap, compares keySet and entrySet approaches, shows why keySet involves two passes, and demonstrates the underlying iterator implementation with detailed code examples and decompiled snippets.

HashMapIteratorJava
0 likes · 8 min read
Understanding HashMap Traversal: keySet vs entrySet and Iterator Mechanics
Code Mala Tang
Code Mala Tang
Apr 22, 2025 · Fundamentals

Unlock Python’s itertools: The Swiss‑Army Knife for Efficient Data Pipelines

This article introduces Python’s built‑in itertools module, explains its infinite, finite, and combinatorial iterator utilities, demonstrates advanced techniques like grouping and pipeline construction, and compares its lazy evaluation memory benefits to traditional list comprehensions for large‑scale data processing.

Data ProcessingFunctional ProgrammingIterator
0 likes · 10 min read
Unlock Python’s itertools: The Swiss‑Army Knife for Efficient Data Pipelines
Code Mala Tang
Code Mala Tang
Apr 15, 2025 · Fundamentals

What Really Happens Inside a Python for-loop? Uncover the Magic of Iterators

This article demystifies Python’s for-loop by explaining how iterable objects and iterators work under the hood, illustrating the iterator protocol with code examples, and providing practical custom iterator implementations, common pitfalls, and tips for efficient data processing.

Data ProcessingGeneratorIterable
0 likes · 9 min read
What Really Happens Inside a Python for-loop? Uncover the Magic of Iterators
Architecture Digest
Architecture Digest
Mar 18, 2025 · Fundamentals

Understanding Java foreach Loop, HashMap Iteration, and ConcurrentModificationException

This article explains how Java's foreach loop is implemented using iterators, demonstrates the bytecode differences between array and collection traversal, analyzes why modifying a HashMap during foreach can trigger ConcurrentModificationException, and shows the correct way to safely modify collections with an iterator.

CollectionsConcurrentModificationExceptionHashMap
0 likes · 11 min read
Understanding Java foreach Loop, HashMap Iteration, and ConcurrentModificationException
Test Development Learning Exchange
Test Development Learning Exchange
Oct 8, 2024 · Fundamentals

Understanding Python's Iteration Protocol: Iterable and Iterator with Practical Examples

This article explains Python's iteration protocol, detailing how iterable objects and iterators work, and provides multiple code examples—including custom iterables, generators, and iterator-based test data handling—to demonstrate their use in building flexible and memory‑efficient applications.

GeneratorIterableIterator
0 likes · 11 min read
Understanding Python's Iteration Protocol: Iterable and Iterator with Practical Examples
Test Development Learning Exchange
Test Development Learning Exchange
Oct 1, 2024 · Fundamentals

Understanding Python Generator Functions and Their Applications in API Automation Testing

This article explains Python generator functions, their memory‑efficient iteration mechanism, and demonstrates through multiple examples—including basic generators, Fibonacci sequences, large file processing, HTTP streaming, and API test data generation—how they can streamline and optimize interface automation testing workflows.

API TestingGeneratorIterator
0 likes · 10 min read
Understanding Python Generator Functions and Their Applications in API Automation Testing
Test Development Learning Exchange
Test Development Learning Exchange
Sep 18, 2024 · Fundamentals

Understanding Python Generators: Functions, Expressions, and Internal Implementation

This article explains Python generators, covering generator functions and expressions, their usage with yield, the send method, and the underlying CPython state‑machine implementation, illustrated with clear code examples; it also discusses how generators manage execution flow and improve memory efficiency.

GeneratorsIteratoryield
0 likes · 6 min read
Understanding Python Generators: Functions, Expressions, and Internal Implementation
Architect's Guide
Architect's Guide
Sep 9, 2024 · Fundamentals

Why HashMap.keySet() Traversal Performs Two Iterations and How entrySet() Is More Efficient

This article explains the internal mechanism of Java's HashMap traversal, showing that using keySet() triggers two passes—once to create an iterator and once to fetch values—while entrySet() or Map.forEach() can iterate in a single pass, and it walks through the relevant source code to illustrate the process.

HashMapIteratorJava
0 likes · 9 min read
Why HashMap.keySet() Traversal Performs Two Iterations and How entrySet() Is More Efficient
Python Programming Learning Circle
Python Programming Learning Circle
Jun 21, 2024 · Fundamentals

Introduction to Python itertools: Common Functions and Usage

This article provides a concise, English-language overview of Python's itertools library, explaining its purpose, demonstrating how its iterator‑producing functions such as accumulate, chain, combinations, compress, count, cycle, dropwhile, filterfalse, groupby, islice, permutations, product, repeat, starmap, takewhile, tee, and zip_longest work, and offering clear code examples for each.

Functional ProgrammingIteratorcode examples
0 likes · 10 min read
Introduction to Python itertools: Common Functions and Usage
Architect's Tech Stack
Architect's Tech Stack
Jun 1, 2024 · Backend Development

Understanding HashMap keySet Traversal and Iterator Mechanism in Java

This article explains why iterating a Java HashMap with keySet() involves two passes, examines the underlying iterator implementation, and walks through the relevant source code of HashMap’s KeySet, KeyIterator, and HashIterator classes to clarify the internal traversal mechanism.

BackendHashMapIterator
0 likes · 8 min read
Understanding HashMap keySet Traversal and Iterator Mechanism in Java
Python Programming Learning Circle
Python Programming Learning Circle
Jan 27, 2024 · Fundamentals

An Introduction to Python's itertools Library and Its Common Functions

This article introduces Python's itertools module, explains why iterator-based tools improve code readability and performance, and provides concise examples of functions such as accumulate, chain, combinations, compress, count, cycle, dropwhile, filterfalse, groupby, islice, permutations, product, repeat, starmap, takewhile, tee, and zip_longest.

Functional ProgrammingIteratorPython
0 likes · 9 min read
An Introduction to Python's itertools Library and Its Common Functions
IT Services Circle
IT Services Circle
Jan 10, 2024 · Backend Development

Why Using forEach to Remove Elements from an ArrayList Throws ConcurrentModificationException and How to Delete Safely

The article explains why iterating an ArrayList with forEach and removing elements causes a ConcurrentModificationException, analyzes the underlying fail‑fast iterator behavior, and presents three correct ways—using Iterator.remove, removeIf, and collecting then removing—to delete elements safely.

ArrayListConcurrentModificationExceptionIterator
0 likes · 4 min read
Why Using forEach to Remove Elements from an ArrayList Throws ConcurrentModificationException and How to Delete Safely
Architecture Digest
Architecture Digest
Nov 21, 2023 · Backend Development

Understanding Why HashMap.keySet() Traverses Twice in Java

This article explains the internal mechanics of HashMap traversal in Java, comparing iterator, keySet, entrySet and stream approaches, and reveals why using keySet results in two passes—once to obtain an iterator and once to fetch values—by examining the underlying KeySet, KeyIterator, and HashIterator implementations.

HashMapIteratorJava
0 likes · 8 min read
Understanding Why HashMap.keySet() Traverses Twice in Java
Architect's Tech Stack
Architect's Tech Stack
Nov 14, 2023 · Backend Development

Understanding Why HashMap.keySet() Traversal Involves Two Iterations and Its Internal Mechanism

This article explains the internal workings of HashMap traversal in Java, showing why using keySet() results in two passes—first converting to an iterator and then fetching values—and details the underlying iterator, KeyIterator, and HashIterator implementations with code examples.

BackendHashMapIterator
0 likes · 9 min read
Understanding Why HashMap.keySet() Traversal Involves Two Iterations and Its Internal Mechanism
Architecture & Thinking
Architecture & Thinking
Nov 13, 2023 · Fundamentals

Mastering Java Collections: From Interfaces to Iterators

This comprehensive guide explains Java's collection framework, covering the core interfaces Collection, List, Set, and Map, their abstract and concrete implementations, iterator mechanisms, and key differences that are essential for both interview preparation and real‑world backend development.

BackendCollectionsIterator
0 likes · 29 min read
Mastering Java Collections: From Interfaces to Iterators
Code Ape Tech Column
Code Ape Tech Column
Nov 10, 2023 · Fundamentals

Why HashMap.keySet() Traversal Performs Two Passes While entrySet() Traversal Performs One

This article explains the internal mechanics of HashMap traversal in Java, showing that keySet() uses an iterator that iterates twice to locate entries, whereas entrySet() (or Map.forEach) iterates only once, and it walks through the relevant source code and decompiled bytecode to illustrate the process.

HashMapIteratorJava
0 likes · 8 min read
Why HashMap.keySet() Traversal Performs Two Passes While entrySet() Traversal Performs One
Top Architect
Top Architect
Aug 24, 2023 · Backend Development

Understanding Java foreach Loop Limitations and Proper Element Deletion/Modification

This article explains how Java's foreach loop iterates over arrays and collections, demonstrates why removing or reassigning elements within a foreach causes ConcurrentModificationException or has no effect, and shows the correct ways to delete or modify elements using traditional for loops or iterator methods, complete with code examples.

BackendCollectionIterator
0 likes · 10 min read
Understanding Java foreach Loop Limitations and Proper Element Deletion/Modification
Python Programming Learning Circle
Python Programming Learning Circle
Jun 27, 2023 · Fundamentals

Useful Python Tricks: String Cleaning, Iterator Slicing, Keyword‑Only Arguments, Context Managers, __slots__, Resource Limits, __all__, and Total Ordering

This article presents a collection of lesser‑known Python tricks—including string normalization, iterator slicing, keyword‑only functions, custom context managers, memory‑saving __slots__, CPU/memory limits, import control with __all__, and simplified ordering with total_ordering—to help developers write cleaner and more efficient code.

Context ManagerIteratorMemory Optimization
0 likes · 10 min read
Useful Python Tricks: String Cleaning, Iterator Slicing, Keyword‑Only Arguments, Context Managers, __slots__, Resource Limits, __all__, and Total Ordering