Tagged articles
arraylist
59 articles · Page 1 of 1
This article walks through ten core Java collection topics—including ArrayList vs LinkedList, HashMap internals across JDK 7 and 8, the put and resize processes, ConcurrentHashMap design, HashSet implementation, fail‑fast vs fail‑safe iterators, and the difference between Collection and Collections—providing the detailed analysis and code examples interviewers expect.
ConcurrentHashMapHashMapInterview
0 likes · 10 min read

This article shares Lenovo's 2026 graduate hiring salary breakdown, explains deadlock conditions and prevention, outlines DNS resolution steps, details the TLS handshake process, and provides an in‑depth guide to Java's ArrayList implementation, performance, and thread‑safety concerns.
DNSJavaSalary Analysis
0 likes · 18 min read

This article explains why using Java's Arrays.asList() to convert an array into a List can cause UnsupportedOperationException at runtime, illustrates the hidden fixed‑size list implementation, shows the severe impact on an e‑commerce system, and provides a safe solution using java.util.ArrayList to avoid such crashes.
Arrays.asListUnsupportedOperationExceptionarraylist
0 likes · 8 min read

This article explains why using Arrays.asList to convert an array into a List can produce an immutable, fixed‑size list that throws UnsupportedOperationException on add or remove operations, illustrates the issue with real‑world incident details, analyzes the internal implementation, and provides a safe replacement using java.util.ArrayList.
Arrays.asListBest PracticesJava
0 likes · 9 min read

This article explains how Java’s ArrayList uses the transient keyword during serialization to skip the underlying array, reducing redundant data, and details the custom writeObject and readObject methods that ensure only actual elements are stored and restored efficiently.
JavaSerializationarraylist
0 likes · 5 min read

This article explains how using Arrays.asList() to convert an array into a List creates a fixed‑size collection that throws UnsupportedOperationException on add or remove operations, illustrates the issue with a real e‑commerce incident, and shows how to safely wrap the result with a mutable java.util.ArrayList.
Arrays.asListUnsupportedOperationExceptionarraylist
0 likes · 9 min read

This article explains why using Java's Arrays.asList to convert an array into a List can cause UnsupportedOperationException when modifying the list, illustrates the underlying implementation details, and provides a safe solution using java.util.ArrayList to prevent serious runtime failures.
Arrays.asListJavaList
0 likes · 9 min read

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.
ConcurrentModificationExceptionJavaarraylist
0 likes · 4 min read

This article explains the overloaded remove methods in Java's List interface, demonstrates common mistakes when removing elements from ArrayList, clarifies the behavior of Arrays.asList with primitive arrays versus object arrays, and highlights related issues such as unsupported add/remove operations and index‑based deletions.
Arrays.asListJavaList
0 likes · 10 min read

This article explains the importance and challenges of concurrent programming, details Java's memory model and synchronization primitives, analyzes a real‑world case where concurrent addAll on ArrayList caused missing UI elements, and demonstrates how using thread‑safe collections resolves the issue.
ConcurrencyJMMJava
0 likes · 14 min read

This article systematically examines ten typical pitfalls encountered when converting arrays to lists, performing add/remove operations, using subList, handling memory consumption, and working with thread‑safe collections such as CopyOnWriteArrayList in Java, and provides concrete code‑level solutions and performance recommendations.
ConcurrencyCopyOnWriteArrayListLinkedList
0 likes · 20 min read

This article examines common traps when using Java List structures such as Arrays.asList, ArrayList, LinkedList, and CopyOnWriteArrayList, explains why they occur, and provides practical solutions—including proper conversion, avoiding unsupported operations, handling subList references, and mitigating memory and concurrency issues.
Arrays.asListCopyOnWriteArrayListJava
0 likes · 19 min read

This article reveals common pitfalls when using Java List implementations—such as Arrays.asList with primitive arrays, unsupported add/remove operations, side‑effects on the original array, subList memory leaks, LinkedList performance myths, and CopyOnWriteArrayList’s memory and iterator quirks—while providing practical solutions and best‑practice recommendations.
CopyOnWriteArrayListJavaLinkedList
0 likes · 19 min read

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.
ConcurrentModificationExceptionJavaMemory Leak
0 likes · 9 min read

This article explains why Java’s ArrayList uses a default initial capacity of 10, contrasts it with HashMap’s 16‑element default, and walks through the lazy‑initialization logic and growth algorithm that keep the capacity at ten until the first element is added.
Default CapacityHashMapJava
0 likes · 9 min read

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.
ConcurrentModificationExceptionJavaarraylist
0 likes · 9 min read

This article explains the thread‑unsafe nature of Java’s ArrayList, HashSet and HashMap, details their internal implementations and growth mechanisms, and presents three common solutions—Vector, synchronized wrappers, and CopyOnWrite collections—to achieve thread safety in concurrent environments.
ConcurrencyJavaarraylist
0 likes · 15 min read

This article provides a comprehensive overview of Java collections, covering the definition, characteristics, differences from arrays, advantages, common collection classes, underlying data structures, fail‑fast mechanism, detailed List, Set, Queue, and Map interfaces, as well as HashMap and ConcurrentHashMap implementations and best practices.
ConcurrencyHashMapJava
0 likes · 30 min read

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.
ConcurrencyDataStructureJava
0 likes · 16 min read


JavaEdgeJul 3, 2021 · Backend Development
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.
BackendJavaarraylist
0 likes · 7 min read

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.
ConcurrentModificationExceptionCopyOnWriteArrayListJava
0 likes · 5 min read

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.
Arrays.asListConcurrentModificationExceptionJava
0 likes · 9 min read

This article presents five distinct techniques for eliminating duplicate elements from a Java ArrayList, including using LinkedHashSet, Java 8 Stream distinct, HashSet with order preservation, manual contains checks, and a double‑for‑loop approach, each accompanied by complete code examples and output results.
HashSetJavaStream
0 likes · 6 min read

This article explains why Java's ArrayList is not thread‑safe, illustrates the two main concurrency problems—array index out‑of‑bounds and element overwriting—through source‑code analysis and multithreaded examples, and presents several practical solutions such as synchronized wrappers, explicit locking, CopyOnWriteArrayList and ThreadLocal.
ConcurrencyCopyOnWriteArrayListJava
0 likes · 11 min read

This article presents five distinct methods for eliminating duplicate elements from a Java ArrayList, including using LinkedHashSet, Java 8 streams, HashSet with order preservation, manual iteration with contains checks, and nested loops, each accompanied by complete code examples and output results.
HashSetJavaarraylist
0 likes · 6 min read

This article demonstrates five distinct techniques for eliminating duplicate entries from a Java ArrayList, including using LinkedHashSet, Java 8 streams, HashSet with order preservation, manual contains checks, and nested loops, each accompanied by complete code examples and output results.
Streamarraylistcollections
0 likes · 5 min read

This article compares three common methods for converting Java arrays to List—Arrays.asList, using an ArrayList constructor, and Collections.addAll—detailing their advantages, limitations, performance, and appropriate scenarios, while also explaining common type conversion errors and best practices for primitive and wrapper types.
Arrays.asListCollections.addAllJava
0 likes · 8 min read

This article explains why core Java collection classes such as ArrayList, HashSet, and HashMap are not thread‑safe, demonstrates the underlying mechanisms of their initialization and resizing, and presents multiple approaches—including Vector, synchronized wrappers, and CopyOnWrite variants—to achieve safe concurrent access.
ConcurrencyHashMapHashSet
0 likes · 16 min read

This article explains the internal workings of Java's ArrayList and LinkedList, covering their dynamic array and linked list structures, growth mechanisms, performance characteristics for random access, insertion, and deletion, and includes source code excerpts and visual diagrams to illustrate key differences.
JavaLinkedListarraylist
0 likes · 4 min read

This article explains why ArrayList implements the RandomAccess marker interface while LinkedList does not, shows how Java's Collections.binarySearch chooses different algorithms based on this interface, and presents benchmark results that reveal the most efficient traversal method for each list type.
LinkedListRandomAccessarraylist
0 likes · 7 min read

This article reviews the most frequently asked Java collection framework interview questions, covering differences between ArrayList, LinkedList, Vector, ArrayDeque, HashSet, HashMap, Hashtable, and the distinction between Collection and Collections, while explaining underlying implementations and performance considerations.
arraylistcollectionsperformance
0 likes · 11 min read

This article provides an in‑depth explanation of Java's ArrayList, covering its purpose, lack of thread safety, detailed source‑code analysis of fields, constructors and core methods, serialization mechanics, capacity handling, and a simplified hand‑written implementation for interview preparation.
CodingInterviewDataStructureJava
0 likes · 13 min read

This article explains Java's ArrayList structure, compares four traversal methods with benchmark code, analyzes their performance across different list sizes, and outlines safe deletion techniques and common pitfalls such as subList casting and concurrency issues.
JavaTraversalarraylist
0 likes · 10 min read

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.
ConcurrentModificationExceptionJavaarraylist
0 likes · 7 min read

This article explains why using a foreach loop to remove elements from a Java List triggers java.util.ConcurrentModificationException, analyzes the underlying iterator mechanism, and presents three safe alternatives: iterator.remove(), forward-index loop with index adjustment, and reverse-index loop.
ConcurrentModificationExceptionJavaLoop
0 likes · 6 min read

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.
ConcurrentModificationExceptionLooparraylist
0 likes · 7 min read

This article explains how Java's ArrayList.clone() creates a shallow copy that shares object references, demonstrates the resulting behavior with string and custom object lists, and shows how to implement a deep copy by manually cloning each element, complete with runnable code samples and console output.
CloneDeep CopyJava
0 likes · 7 min read

This article explains why Java's Arrays.asList and List.subList can produce unexpected behavior, how mutable and immutable List implementations interact with their backing arrays, and provides safe alternatives and best practices to prevent ConcurrentModificationException and hidden memory leaks.
ImmutableJavaList
0 likes · 10 min read

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.
ConcurrentModificationExceptionJavaarraylist
0 likes · 6 min read

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.
ConcurrentModificationExceptionJavaarraylist
0 likes · 5 min read

This article provides concise English explanations for common Java collection interview questions, covering differences between HashMap and Hashtable, internal structures, thread‑safety, ArrayList vs LinkedList vs Vector, Array vs ArrayList, HashSet implementation, and the distinctions among List, Set, and Map.
HashMapInterviewJava
0 likes · 11 min read

This article lists the ten most common errors Java developers make, explains why each is problematic, and provides clear code examples and best‑practice alternatives to help you write safer, more efficient Java code.
HashMapImmutableJava
0 likes · 11 min read

This article explains the differences between Java's ArrayList and LinkedList, detailing their internal implementations, performance characteristics for adding, inserting, deleting, and iterating elements, and provides code examples and benchmark results to guide when to choose each collection.
JavaLinkedListarraylist
0 likes · 11 min read

This article provides a detailed comparison of Java's List interface implementations—ArrayList, LinkedList, Vector, and Stack—explaining their underlying data structures, key methods such as get, set, add, and remove, performance characteristics, thread safety, and appropriate usage scenarios.
JavaLinkedListList
0 likes · 18 min read

This article provides a comprehensive overview and source‑code dissection of Java's ArrayList, covering its inheritance hierarchy, fields, constructors, addition, removal, modification, traversal, serialization, sorting, array conversion, thread‑safety considerations, and practical usage tips.
ConcurrencyJavaSerialization
0 likes · 16 min read

This article lists and explains ten of the most common errors Java developers make—from misusing Arrays.asList and raw types to incorrect loop deletions, mutable versus immutable objects, and constructor pitfalls—providing correct code examples and best‑practice recommendations.
arraylistbest-practicescoding-errors
0 likes · 11 min read

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.
HashMapJavaarraylist
0 likes · 9 min read

This article introduces Java's ArrayList as a dynamic array implementation, explains its non‑thread‑safe nature, details its constructors, capacity‑growth strategy, key methods such as ensureCapacity, add, remove, toArray, and examines the underlying source code including array copying utilities.
DataStructureGenericsJava
0 likes · 13 min read

This article provides a comprehensive overview of Java's ArrayList, covering its internal structure, key fields, constructors, core operations such as adding, removing, and searching elements, traversal techniques, fail‑fast behavior, and a comparison with Vector, all illustrated with original source code snippets.
ConcurrencyJavaarraylist
0 likes · 18 min read

The article recounts a Java interview where the interviewer explains the memory layout, random‑access capability, and time‑complexity differences between ArrayList (array‑based) and LinkedList (node‑based), using clear examples and code snippets to illustrate fundamental data‑structure concepts.
InterviewJavaLinkedList
0 likes · 8 min read

This article systematically explains the most frequently used Java data structures—including LinkedList, ArrayList, Stack, Queue, HashMap, and LinkedHashMap—detailing their internal implementations, typical operations, performance characteristics, and providing illustrative code snippets and animations.
HashMapJavaLinkedList
0 likes · 8 min read

This article systematically explains common Java collection classes—including LinkedList, ArrayList, Stack, Queue, HashMap, and LinkedHashMap—highlighting their internal structures, key operations, performance characteristics, and JDK 8 differences, and it provides animated illustrations and full code snippets for each concept.
HashMapJavaLinkedList
0 likes · 9 min read

This article provides a comprehensive overview of the Java Collections Framework, detailing its core interfaces, common implementations such as List, Set, Queue, and Map, their underlying data structures, performance characteristics, and usage examples including legacy classes and specialized collections like PriorityQueue and LinkedHashMap.
HashMapJavaarraylist
0 likes · 8 min read

This article provides an overview of Java's ArrayList class, explaining its dynamic array implementation, thread-safety considerations, key interfaces, constructors, capacity management, core methods, and internal mechanisms such as ensureCapacity, trimToSize, and serialization, accompanied by detailed source code excerpts and practical insights.
JavaSerializationarraylist
0 likes · 13 min read

This article explains ten frequent Java pitfalls—including array‑to‑list conversion, containment checks, element removal during iteration, Hashtable vs. HashMap, raw types, access modifiers, List implementations, mutability, constructor issues, and string creation—and provides clear, correct code examples for each.
HashMaparraylistprogramming
0 likes · 9 min read

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.
HashSetWeakHashMaparraylist
0 likes · 13 min read

This article explores Java's ArrayList implementation in depth, covering its core interfaces, member variables, constructors, and the most commonly used methods, while illustrating how the internal array expands and how each operation manipulates the underlying data structure.
Javaarraylistdata structures
0 likes · 14 min read

This article explains the principles behind Java's mutable array implementations, details the characteristics and use‑cases of List, ArrayList, LinkedList, and Vector, and provides code examples for common operations such as adding, removing, setting, retrieving elements, and using iterators.
LinkedListListVector
0 likes · 8 min read


ITPUBNov 12, 2015 · Fundamentals
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.
HashMapJavaList
0 likes · 7 min read
