Tagged articles
90 articles
Page 1 of 1
JakartaEE China Community
JakartaEE China Community
Oct 20, 2025 · Fundamentals

How to Prevent ConcurrentModificationException in Java Collections

The article explains why ConcurrentModificationException occurs when a Java collection is structurally modified during iteration, illustrates typical scenarios such as enhanced‑for loops and multithreaded access, and provides practical solutions including iterator.remove(), thread‑safe collections, synchronized blocks and iterating over copies.

CollectionsConcurrentHashMapConcurrentModificationException
0 likes · 7 min read
How to Prevent ConcurrentModificationException in Java Collections
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.

IteratorLazy Evaluationdata-processing
0 likes · 10 min read
Unlock Python’s itertools: The Swiss‑Army Knife for Efficient Data Pipelines
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
Ma Wei Says
Ma Wei Says
Feb 19, 2025 · Fundamentals

Safe List Operations: Remove, SubList Casting, and Efficient Traversal in Java

This article explains why modifying a List inside a foreach loop causes ConcurrentModificationException, shows the proper ways to remove elements using iterators or lambda expressions, warns against casting subList to ArrayList, clarifies correct toArray and Arrays.asList usage, compares LinkedList and ArrayList performance, and recommends the most efficient traversal techniques.

CollectionsIteratorList
0 likes · 9 min read
Safe List Operations: Remove, SubList Casting, and Efficient Traversal in Java
MaGe Linux Operations
MaGe Linux Operations
Jan 11, 2025 · Fundamentals

Master Python Iterators and Generators: From Basics to Advanced Usage

This article explains Python iterators, iterables, and generators, detailing their definitions, core methods, advantages, disadvantages, and practical code examples—including iterator objects, generator creation via comprehensions and the yield keyword, decorator integration, and mutable data handling—providing a comprehensive guide for developers.

DecoratorIterableIterator
0 likes · 14 min read
Master Python Iterators and Generators: From Basics to Advanced Usage
Taobao Frontend Technology
Taobao Frontend Technology
Nov 4, 2024 · Frontend Development

What New ECMAScript Proposals Will Shape JavaScript in 2023?

This article reviews the latest Stage 4 ECMAScript proposals—including ArrayBuffer transfer, iterator helpers, RegExp modifiers, import attributes, Promise.try, duplicate named capture groups, and Set methods—explaining their purpose, syntax, and example usage for modern JavaScript development.

ArrayBufferECMAScriptIterator
0 likes · 13 min read
What New ECMAScript Proposals Will Shape JavaScript in 2023?
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.

Iteratorapi-testingautomation
0 likes · 10 min read
Understanding Python Generator Functions and Their Applications in API Automation Testing
Satori Komeiji's Programming Classroom
Satori Komeiji's Programming Classroom
Sep 18, 2024 · Fundamentals

How Python Implements Iterators: From __iter__ to __next__

This article explains Python's iterator protocol by showing how objects become iterable through __iter__, how the built‑in iter function creates iterator objects, the CPython internals of PyObject_GetIter, and how the __next__ method advances elements, with concrete code examples and source‑level snippets.

CPythonIterableIterator
0 likes · 16 min read
How Python Implements Iterators: From __iter__ to __next__
Full-Stack Cultivation Path
Full-Stack Cultivation Path
Jul 30, 2024 · Frontend Development

What’s New in the TypeScript 5.6 Beta?

The TypeScript 5.6 beta, released on July 27 2024, adds stricter nullish and truthy checks, new iterator helper methods, support for arbitrary module identifiers, and compiler flags like --noUncheckedSideEffectImports and --noCheck, with installation instructions and concrete code examples.

BetaIteratorTypeScript
0 likes · 10 min read
What’s New in the TypeScript 5.6 Beta?
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.

Iteratorcode-examplesfunctional-programming
0 likes · 10 min read
Introduction to Python itertools: Common Functions and Usage
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.

Iteratorfunctional-programmingitertools
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
Java Architect Essentials
Java Architect Essentials
Nov 16, 2023 · Backend Development

Why Does HashMap.keySet() Iterate Twice? Uncovering Java’s Internal Iterator Mechanics

This article explains why iterating a Java HashMap with keySet() results in two traversals, detailing the internal iterator creation, the role of KeyIterator and HashIterator classes, and how the do‑while loop in HashIterator’s constructor locates the first entry, with code examples and bytecode analysis.

HashIteratorHashMapIterator
0 likes · 9 min read
Why Does HashMap.keySet() Iterate Twice? Uncovering Java’s Internal Iterator Mechanics
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
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.

IteratorMemory OptimizationPython
0 likes · 10 min read
Useful Python Tricks: String Cleaning, Iterator Slicing, Keyword‑Only Arguments, Context Managers, __slots__, Resource Limits, __all__, and Total Ordering
macrozheng
macrozheng
Feb 20, 2023 · Fundamentals

8 Reliable Ways to Remove Elements from a Java List (And Why Some Fail)

This article examines eight common techniques for deleting elements from a Java List, explains why certain loop‑based approaches cause errors or unexpected results, and highlights the three reliable methods—including reverse for‑loops, iterator.remove, and Stream filtering—that work correctly.

/loopCollectionConcurrentModificationException
0 likes · 9 min read
8 Reliable Ways to Remove Elements from a Java List (And Why Some Fail)
Top Architect
Top Architect
Jul 23, 2022 · Backend Development

Four Methods to Traverse a Java Map Using keySet, entrySet and Iterators

This article demonstrates four practical ways to iterate over a Java HashMap—including enhanced for loops with keySet(), iterator-based loops with keySet(), enhanced for loops with entrySet(), and iterator-based loops with entrySet()—and provides a complete example that filters employee objects by salary, complete with full source code.

BackendCollectionsHashMap
0 likes · 10 min read
Four Methods to Traverse a Java Map Using keySet, entrySet and Iterators
Programmer DD
Programmer DD
Jul 9, 2022 · Backend Development

When Is Java Stream Faster Than Traditional Loops? A Performance Comparison

This article explains Java 8 Stream fundamentals, compares intermediate and terminal operations, outlines its advantages over collections, and presents benchmark results showing when streams outperform iterator loops, especially with large data sets and parallel execution.

IteratorJava 8Java Stream
0 likes · 12 min read
When Is Java Stream Faster Than Traditional Loops? A Performance Comparison
NetEase LeiHuo UX Big Data Technology
NetEase LeiHuo UX Big Data Technology
Jul 3, 2022 · Fundamentals

Why Some Design Patterns Should Be Forgotten When Using Python

This article explains why traditional object‑oriented design patterns such as Strategy, Factory Method, Singleton, and Iterator often become unnecessary or overly complex in Python, illustrating with concise code examples how Python’s first‑class functions, dynamic typing, and built‑in constructs can replace them for clearer, more maintainable solutions.

Design PatternsFactory MethodIterator
0 likes · 12 min read
Why Some Design Patterns Should Be Forgotten When Using Python
Architect's Tech Stack
Architect's Tech Stack
Jun 7, 2022 · Backend Development

Java Stream Efficiency Analysis and Performance Comparison with Iterator

This article examines Java 8 Stream's data flow operations, compares its performance against traditional iterator loops across various tasks such as mapping, filtering, sorting, reduction, and string joining, and provides recommendations on when to use Stream, parallel Stream, or iterator based on data size and CPU cores.

IteratorParallel StreamStream API
0 likes · 10 min read
Java Stream Efficiency Analysis and Performance Comparison with Iterator
Programmer DD
Programmer DD
May 9, 2022 · Fundamentals

Can You Remove Items Inside a Java foreach Loop? Why It Fails and How to Fix It

This article explores how Java's foreach loop handles collection traversal, demonstrates why removing or modifying elements directly within a foreach causes ConcurrentModificationException, compares it with traditional for loops, and shows the correct way to delete or update elements using an iterator or element properties.

/loopCollectionConcurrentModificationException
0 likes · 9 min read
Can You Remove Items Inside a Java foreach Loop? Why It Fails and How to Fix It
Python Programming Learning Circle
Python Programming Learning Circle
May 4, 2022 · Fundamentals

Common Python Interview Questions and Answers

This article provides concise explanations of ten fundamental Python topics, covering differences between lists and tuples, arrays and lists, append versus extend, equality operators, shallow and deep copying, loop control statements, variable scopes, range versus xrange, decorators, and the concepts of iterators and generators.

ArrayDecoratorIterator
0 likes · 7 min read
Common Python Interview Questions and Answers
Cognitive Technology Team
Cognitive Technology Team
Apr 4, 2022 · Fundamentals

Why Removing Elements from a HashMap During a For‑Each Loop Causes ConcurrentModificationException and How to Fix It

Iterating a HashMap with a for‑each loop while calling its remove method triggers a ConcurrentModificationException because the loop uses an internal iterator that becomes inconsistent with the map’s modCount, and the article explains the cause, shows decompiled code, and provides correct removal approaches using the iterator or removeIf.

CollectionsConcurrentModificationExceptionHashMap
0 likes · 6 min read
Why Removing Elements from a HashMap During a For‑Each Loop Causes ConcurrentModificationException and How to Fix It
Python Programming Learning Circle
Python Programming Learning Circle
Dec 15, 2021 · Fundamentals

Understanding Iteration, Iterables, Iterators, Generators, Coroutines, Greenlet and Gevent in Python

This tutorial explains Python's iteration concepts, how to identify and create iterable objects, implement custom iterables and iterators, use the iter() and next() functions, build generators with yield, control execution with coroutines, and leverage greenlet and gevent for cooperative multitasking.

Iteratorcoroutinegenerator
0 likes · 22 min read
Understanding Iteration, Iterables, Iterators, Generators, Coroutines, Greenlet and Gevent in Python
Selected Java Interview Questions
Selected Java Interview Questions
Nov 27, 2021 · Backend Development

Understanding Java Stream API: Operations, Characteristics, and Performance Compared to Iterator

This article introduces Java 8's Stream API, explains its intermediate and terminal operations, highlights its functional characteristics, compares its performance with traditional iterator loops through benchmark tests, and offers practical recommendations for using streams and parallel streams in backend development.

BackendIteratorParallel Stream
0 likes · 12 min read
Understanding Java Stream API: Operations, Characteristics, and Performance Compared to Iterator
WeDoctor Frontend Technology
WeDoctor Frontend Technology
Nov 4, 2021 · Frontend Development

Master JavaScript Object Traversal: keys(), values(), entries() & Custom Iterators

This article explains the differences between Object.keys/values/entries and their array counterparts, shows how to use them for object property iteration, demonstrates creating custom iterator methods for plain objects, and compares iterator results with array returns, providing code examples and visual diagrams.

IteratorKEYSObject Traversal
0 likes · 10 min read
Master JavaScript Object Traversal: keys(), values(), entries() & Custom Iterators
Programmer DD
Programmer DD
Oct 27, 2021 · Backend Development

Why Removing Elements from a Java List Often Fails and How to Fix It

This article explains common pitfalls when deleting elements from a Java List—such as index shifting, ConcurrentModificationException in foreach loops, and the difference between removing by index versus by object—and provides reliable solutions using index adjustment, reverse iteration, and Iterator.remove().

ConcurrentModificationExceptionIteratorList
0 likes · 8 min read
Why Removing Elements from a Java List Often Fails and How to Fix It
Programmer DD
Programmer DD
Oct 24, 2021 · Fundamentals

Why Adding or Removing Elements Inside a Java foreach Loop Fails

This article explains why modifying a collection during a Java foreach loop triggers a ConcurrentModificationException, explores the underlying fail‑fast mechanism in ArrayList, and demonstrates safe alternatives such as using an Iterator's remove method or a CopyOnWriteArrayList.

ArrayListConcurrentModificationExceptionIterator
0 likes · 9 min read
Why Adding or Removing Elements Inside a Java foreach Loop Fails
Tencent Cloud Developer
Tencent Cloud Developer
Oct 14, 2021 · Fundamentals

C++ to Rust: Key Differences in Move Semantics, Option Type, and Iterator

The article compares C++ and Rust for developers switching languages, explaining how Rust enforces move semantics instead of copy defaults, uses the safe Option enum with exhaustive pattern matching instead of nullable pointers, and favors lazy, chainable iterators over index‑based loops for performance and safety.

C++IteratorMemory Safety
0 likes · 15 min read
C++ to Rust: Key Differences in Move Semantics, Option Type, and Iterator
Java Backend Technology
Java Backend Technology
Oct 9, 2021 · Fundamentals

Avoid Common Pitfalls When Removing Elements from Java Lists

This article explains why naïve removal of elements from a Java List can produce unexpected results or throw ConcurrentModificationException, and demonstrates seven safe techniques—including index adjustment, reverse iteration, and iterator‑based removal—along with code samples and detailed reasoning.

CollectionsIteratorjava
0 likes · 8 min read
Avoid Common Pitfalls When Removing Elements from Java Lists
Java Tech Enthusiast
Java Tech Enthusiast
Aug 29, 2021 · Fundamentals

Java ArrayList: Constructors, add/addAll, set/get, and Iterator Mechanics

Java’s ArrayList offers a no‑arg constructor initializing an empty internal array, lazy default capacity of ten, and overloads for initial capacity or collection copying; its add/addAll methods ensure and grow capacity, set/get access elements, and its iterator tracks modCount to detect concurrent modifications.

ArrayListCollectionsDataStructure
0 likes · 16 min read
Java ArrayList: Constructors, add/addAll, set/get, and Iterator Mechanics
JavaEdge
JavaEdge
Jul 3, 2021 · Backend Development

Mastering Java's Iterator: Simplify Collection Traversal and Internals

This article explains Java's Iterator pattern, compares it with traditional loop approaches, shows how it abstracts collection traversal, details the Iterator interface methods, and walks through the internal ArrayList iterator implementation with code examples and diagrams.

ArrayListBackendCollections
0 likes · 7 min read
Mastering Java's Iterator: Simplify Collection Traversal and Internals
Top Architect
Top Architect
Jul 1, 2021 · Fundamentals

Five Best Ways to Iterate a Java HashMap

This article demonstrates five optimal techniques for traversing a Java HashMap—including using an Iterator over the entry set or key set, a for‑each loop, Lambda expressions, and the Stream API—providing complete code examples and sample outputs for each method.

HashMapIteratorLambda
0 likes · 7 min read
Five Best Ways to Iterate a Java HashMap
Top Architect
Top Architect
Jun 29, 2021 · Backend Development

Performance Comparison of Java Stream API vs Iterator and Recommendations

This article explains Java 8 Stream fundamentals, compares its intermediate and terminal operations with traditional iterator loops through a series of benchmark tests (mapping, filtering, sorting, reduction, string joining, and mixed operations), analyzes results for different data sizes and CPU configurations, and provides practical guidance on when to use Stream, parallel Stream, or iterator in backend development.

IteratorParallel StreamStream API
0 likes · 12 min read
Performance Comparison of Java Stream API vs Iterator and Recommendations
Python Programming Learning Circle
Python Programming Learning Circle
Jun 9, 2021 · Fundamentals

Python Tips: String Manipulation, Iterator Slicing, Context Managers, Slots, Resource Limits, and More

This article presents a collection of practical Python techniques—including string cleaning with translation tables, iterator slicing with itertools, skipping file headers, keyword‑only arguments, custom context‑manager objects, memory‑saving __slots__, CPU and memory resource limits, export control via __all__, and simplified total ordering—illustrated with concise code examples.

IteratorPythonString Manipulation
0 likes · 9 min read
Python Tips: String Manipulation, Iterator Slicing, Context Managers, Slots, Resource Limits, and More
Selected Java Interview Questions
Selected Java Interview Questions
Jun 4, 2021 · Fundamentals

Why Removing Elements During forEach on an ArrayList Triggers ConcurrentModificationException and How to Fix It

The article explains that deleting elements from an ArrayList inside a forEach loop can cause a ConcurrentModificationException because the iterator's expected modification count diverges from the actual count, and it shows correct ways to remove items safely using an explicit Iterator or a CopyOnWriteArrayList.

ArrayListConcurrentModificationExceptionCopyOnWriteArrayList
0 likes · 5 min read
Why Removing Elements During forEach on an ArrayList Triggers ConcurrentModificationException and How to Fix It
Programmer DD
Programmer DD
May 17, 2021 · Backend Development

Java Stream vs Iterator: Performance Benchmarks and Best Practices

This article explains Java 8 Stream fundamentals, compares intermediate and terminal operations, outlines stream characteristics and advantages over collections, and presents detailed benchmark results comparing Stream, parallel Stream, and traditional iterator across various data‑processing tasks.

IteratorParallel StreamStream API
0 likes · 13 min read
Java Stream vs Iterator: Performance Benchmarks and Best Practices
php Courses
php Courses
Dec 9, 2020 · Backend Development

Understanding PHP Generators and the yield Keyword

This article explains PHP's Generator feature introduced in version 5.5, demonstrating how the yield keyword enables memory‑efficient iteration, how to implement custom xrange functions, and how to control generators with methods like next, current, valid, send, rewind, and throw.

IteratorYieldgenerator
0 likes · 6 min read
Understanding PHP Generators and the yield Keyword
MaGe Linux Operations
MaGe Linux Operations
Aug 30, 2020 · Fundamentals

Unlock Hidden Python Tricks: From String Cleanup to Memory Limits

Explore a collection of lesser‑known Python tricks—including string sanitization, iterator slicing, context‑manager shortcuts, memory‑saving slots, resource limits, controlled imports, and simplified ordering—each illustrated with concise code examples to help you write cleaner, more efficient programs.

IteratorMemory OptimizationString Manipulation
0 likes · 10 min read
Unlock Hidden Python Tricks: From String Cleanup to Memory Limits
ITPUB
ITPUB
Jul 3, 2020 · Fundamentals

Master Python File I/O: Reading, Writing, and Mode Pitfalls Explained

This guide walks through Python file I/O by comparing manual Windows text handling to code, explains file handles, demonstrates reading and writing with various modes, clarifies read vs. readline vs. readlines, and shows how to efficiently process large files without exhausting memory.

IteratorPythonRead/Write
0 likes · 12 min read
Master Python File I/O: Reading, Writing, and Mode Pitfalls Explained
Python Programming Learning Circle
Python Programming Learning Circle
Jun 30, 2020 · Fundamentals

Understanding Python Data Types: Sequences, Iterators, Conversions, and Comprehensions

This article provides a comprehensive overview of Python’s core data structures—including lists, dictionaries, tuples, sets, and strings—detailing their similarities, differences, conversion methods, and the use of comprehensions and concise conditional expressions to write more efficient and readable code.

ConversionIteratorList
0 likes · 9 min read
Understanding Python Data Types: Sequences, Iterators, Conversions, and Comprehensions
macrozheng
macrozheng
Jun 15, 2020 · Backend Development

Avoid ConcurrentModificationException: Safe Ways to Remove Elements While Iterating in Java

This article explains why removing items from a Java List inside a foreach loop triggers java.util.ConcurrentModificationException and demonstrates three reliable alternatives—using Iterator.remove(), a forward for‑loop with index adjustment, and a reverse for‑loop—to safely modify collections during iteration.

ConcurrentModificationExceptionIteratorfor loop
0 likes · 7 min read
Avoid ConcurrentModificationException: Safe Ways to Remove Elements While Iterating in Java
Java Backend Technology
Java Backend Technology
Jun 13, 2020 · Fundamentals

Why Does foreach Throw ConcurrentModificationException and How to Fix It?

During a Java interview, a common mistake of using a foreach loop to remove elements from an ArrayList triggers a ConcurrentModificationException; this article explains the underlying iterator mechanism, shows the bytecode behavior, and presents four safe alternatives—including iterator.remove(), forward and backward for-loops—to avoid the error.

ArrayListConcurrentModificationExceptionIterator
0 likes · 7 min read
Why Does foreach Throw ConcurrentModificationException and How to Fix It?
Architect's Tech Stack
Architect's Tech Stack
Jun 7, 2020 · Backend Development

How to Avoid java.util.ConcurrentModificationException When Removing Elements from a List

This article explains why a foreach loop over an ArrayList can throw java.util.ConcurrentModificationException when removing elements, analyzes the underlying iterator mechanism, and presents three safe alternatives—using Iterator.remove(), a forward-index for loop with index correction, and a reverse for loop—to modify collections without errors.

/loopArrayListConcurrentModificationException
0 likes · 7 min read
How to Avoid java.util.ConcurrentModificationException When Removing Elements from a List
Selected Java Interview Questions
Selected Java Interview Questions
Apr 30, 2020 · Fundamentals

Java Collections Framework Interview Questions and Answers

This article compiles a comprehensive set of Java Collections Framework interview questions, explaining its purpose, advantages, generic benefits, core interfaces, iterator behavior, fail‑fast vs fail‑safe, map views, differences among implementations, thread‑safety, and sorting mechanisms.

CollectionsData StructuresGenerics
0 likes · 18 min read
Java Collections Framework Interview Questions and Answers
Java Captain
Java Captain
Apr 29, 2020 · Fundamentals

Comprehensive Overview of the Java Collection Framework: Interfaces, Implementations, and Usage

This article provides a detailed introduction to Java's collection framework, covering the core interfaces (Collection and Map), concrete implementations such as List, Set, and Map, iterator mechanisms, differences among classes like ArrayList, LinkedList, HashSet, TreeSet, and practical code examples illustrating their behavior.

CollectionsFrameworkIterator
0 likes · 33 min read
Comprehensive Overview of the Java Collection Framework: Interfaces, Implementations, and Usage
Selected Java Interview Questions
Selected Java Interview Questions
Apr 27, 2020 · Fundamentals

How to Remove Elements from a List Without Causing java.util.ConcurrentModificationException

This article explains why removing items from a Java List inside a foreach loop triggers a ConcurrentModificationException and demonstrates three correct approaches—using Iterator.remove(), a forward indexed for loop with index correction, and a reverse for loop—each with full code examples and output.

ArrayListConcurrentModificationExceptionIterator
0 likes · 6 min read
How to Remove Elements from a List Without Causing java.util.ConcurrentModificationException
Java Backend Technology
Java Backend Technology
Mar 23, 2020 · Fundamentals

Why Removing Elements in a Java foreach Loop Can Crash Your Code

This article explains why using a foreach loop to remove items from a Java ArrayList can trigger a ConcurrentModificationException, analyzes the underlying iterator mechanism, and shows the correct way to modify collections safely with an explicit Iterator.

ArrayListCollectionsConcurrentModificationException
0 likes · 5 min read
Why Removing Elements in a Java foreach Loop Can Crash Your Code
ITFLY8 Architecture Home
ITFLY8 Architecture Home
Mar 17, 2020 · Backend Development

5 Best Ways to Iterate a Java HashMap: Code Examples & Tips

This article demonstrates five practical techniques for traversing a Java HashMap—including Iterator over EntrySet and KeySet, enhanced for‑each loops, lambda expressions, and the Stream API—each accompanied by complete, ready‑to‑run code samples.

IteratorLambdaStream
0 likes · 5 min read
5 Best Ways to Iterate a Java HashMap: Code Examples & Tips
MaGe Linux Operations
MaGe Linux Operations
Mar 10, 2020 · Fundamentals

Master Python Iterables, Iterators, and Generators: A Complete Guide

This article explains the concepts and differences between Python iterables, iterators, and generators, shows how to create custom iterable and iterator classes, demonstrates the use of __iter__ and __next__ magic methods, and provides practical generator examples for efficient lazy evaluation.

IterableIteratorfundamentals
0 likes · 8 min read
Master Python Iterables, Iterators, and Generators: A Complete Guide
Architecture Digest
Architecture Digest
Jan 11, 2020 · Backend Development

Design Patterns Used in MyBatis Source Code

This article examines how MyBatis implements numerous classic design patterns—including Builder, Factory, Singleton, Proxy, Composite, Template Method, Adapter, Decorator, and Iterator—through its source code, explaining each pattern's role, related classes, and code examples to deepen developers' understanding of backend architecture.

AdapterBuilderDecorator
0 likes · 17 min read
Design Patterns Used in MyBatis Source Code
Test Development Learning Exchange
Test Development Learning Exchange
Dec 9, 2019 · Fundamentals

Understanding Python's yield Keyword and Generators

This article explains the purpose and behavior of Python's yield keyword, how generators work, their difference from regular functions, and demonstrates practical examples including iterator concepts, itertools utilities, and memory‑efficient looping techniques.

IteratorMemory OptimizationPython
0 likes · 10 min read
Understanding Python's yield Keyword and Generators
Architect's Tech Stack
Architect's Tech Stack
Aug 31, 2019 · Backend Development

Performance Comparison of Java Stream API vs Iterator for Common Operations

This article analyzes Java 8 Stream API versus traditional iterator approaches across mapping, filtering, sorting, reduction, string concatenation and mixed operations, presenting benchmark results on various data sizes and offering practical recommendations for when to use streams, parallel streams, or iterators.

IteratorParallel StreamStream API
0 likes · 12 min read
Performance Comparison of Java Stream API vs Iterator for Common Operations
Sohu Tech Products
Sohu Tech Products
Jul 17, 2019 · Fundamentals

Understanding Swift Sequence and Collection Protocols: From Basics to Advanced Types

This article explains Swift's protocol‑oriented collection system, covering the Sequence and IteratorProtocol basics, demonstrating custom infinite sequences, exploring type‑erasing wrappers like AnySequence and AnyIterator, and detailing the Collection hierarchy including Collection, BidirectionalCollection, RandomAccessCollection, MutableCollection and RangeReplaceableCollection.

AnySequenceBidirectionalCollectionCollection
0 likes · 12 min read
Understanding Swift Sequence and Collection Protocols: From Basics to Advanced Types
Java Captain
Java Captain
Mar 16, 2019 · Fundamentals

Common Java Containers and Their Differences

This article explains the most frequently used Java containers, clarifies the distinctions between Collection and Collections, compares List, Set, and Map, and details the implementation principles and usage differences of HashMap, HashSet, ArrayList, LinkedList, and related collection classes.

ArrayListCollectionsHashMap
0 likes · 9 min read
Common Java Containers and Their Differences
Yuewen Frontend Team
Yuewen Frontend Team
Sep 28, 2018 · Frontend Development

Master JavaScript Generators: Control Iteration and Boost Your Code

This article explains ES6 JavaScript generators, covering their syntax, how they differ from regular iterators, the role of the yield keyword, available generator methods, and practical examples such as custom generators, random number streams, throttling, Fibonacci sequences, and integrating generators with HTML to simplify iterative tasks.

AsynchronousIteratorJavaScript
0 likes · 13 min read
Master JavaScript Generators: Control Iteration and Boost Your Code
Youzan Coder
Youzan Coder
Sep 21, 2018 · Fundamentals

First Encounter with Lazy List: Implementing Lazy Evaluation in JavaScript

The article explains Haskell‑style lazy lists, shows why lazy evaluation is useful, and walks through implementing lazy lists in JavaScript using custom classes, the ES6 iterable protocol, and generator functions, providing examples such as repeat, cycle, iterate, range and lazy operators like map, filter, take, and zip.

Infinite ListIteratorJavaScript
0 likes · 10 min read
First Encounter with Lazy List: Implementing Lazy Evaluation in JavaScript
Java Captain
Java Captain
Sep 25, 2017 · Fundamentals

Java Collection Framework Overview with Code Examples

This article explains the Java collection class diagram, distinguishes concrete classes, abstract classes, and interfaces, describes Iterator and ListIterator behavior, and provides detailed code demonstrations of HashSet, ArrayList, ListIterator, and WeakHashMap usage along with their outputs.

ArrayListData StructuresIterator
0 likes · 13 min read
Java Collection Framework Overview with Code Examples
Java Captain
Java Captain
Jul 11, 2017 · Fundamentals

Understanding Java Collection Framework: Interfaces, Implementations, and Usage

This article provides a comprehensive overview of Java's collection framework, covering the core Collection interface, List, Set, and Map interfaces, their common implementations such as ArrayList, LinkedList, Vector, Stack, Hashtable, and HashMap, and demonstrates traversal using the Iterator pattern with code examples.

Data StructuresIteratorList
0 likes · 12 min read
Understanding Java Collection Framework: Interfaces, Implementations, and Usage
ITPUB
ITPUB
Nov 12, 2015 · Fundamentals

Essential Differences and Usage Tips for Java Collections

This article explains why Map does not extend Collection, compares HashMap with Hashtable, clarifies Comparable versus Comparator, shows how to sort object lists, distinguishes fail‑fast from fail‑safe iterators, and outlines key differences among Set, List, ArrayList, Vector, and related Java collection classes.

ArrayListCollectionsHashMap
0 likes · 7 min read
Essential Differences and Usage Tips for Java Collections