Tag

removeIf

0 views collected around this technical thread.

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
Java Architect Essentials
Java Architect Essentials
Sep 7, 2021 · Backend Development

Understanding the Difference Between Java Stream filter and Collection removeIf

This article explains how Java 8's Stream filter method and Collection removeIf default method differ in functionality, predicate handling, and performance, and provides code examples and source snippets to illustrate their respective implementations and use cases.

CollectionsFilterPerformance
0 likes · 6 min read
Understanding the Difference Between Java Stream filter and Collection removeIf