Tagged articles
5 articles
Page 1 of 1
macrozheng
macrozheng
Apr 17, 2023 · Fundamentals

How to Efficiently Split Large Java Lists into Smaller Chunks

This article explains why MySQL’s SQL length limit can cause batch‑insert failures and demonstrates five practical ways to partition a large Java List—using Guava, Apache Commons, Hutool, JDK Stream, and custom subList—complete with code examples and execution results.

Apache CommonsGuavaJava
0 likes · 9 min read
How to Efficiently Split Large Java Lists into Smaller Chunks
Java Backend Technology
Java Backend Technology
Jun 28, 2022 · Backend Development

Why ArrayList.subList Can Leak Memory, Loop Forever, and Crash Your Java App

This article explains how improper use of Java's ArrayList.subList can cause hidden memory leaks, infinite loops, ConcurrentModificationExceptions, and serialization failures in RPC frameworks, and provides concrete best‑practice solutions such as copying to a new list or using stream operations.

ArrayListConcurrentModificationExceptionJava
0 likes · 9 min read
Why ArrayList.subList Can Leak Memory, Loop Forever, and Crash Your Java App
Programmer DD
Programmer DD
Jan 13, 2022 · Backend Development

Why Arrays.asList and subList Can Throw Unexpected Exceptions in Java

This article explains the hidden pitfalls of Java's Arrays.asList and ArrayList.subList methods, showing why add operations may trigger UnsupportedOperationException and how modifications to original or sub‑lists can cause ConcurrentModificationException, with code examples and visual illustrations.

Arrays.asListCollectionsException
0 likes · 8 min read
Why Arrays.asList and subList Can Throw Unexpected Exceptions in Java
Java Backend Technology
Java Backend Technology
Jun 1, 2021 · Fundamentals

Why Arrays.asList and subList Can Surprise You: Hidden Pitfalls

This article examines common pitfalls when using Java's Arrays.asList and ArrayList.subList methods, explaining why add operations throw UnsupportedOperationException, how subList creates a view that links modifications between original and sublists, and offers best‑practice recommendations to avoid runtime errors.

ArrayListArrays.asListCollections
0 likes · 9 min read
Why Arrays.asList and subList Can Surprise You: Hidden Pitfalls