Browse by Topic

Popular

Latest

Latest Java Posts

Illustration comparing Java List and Set collections, showing an ordered sequence with duplicates versus a group of unique elements.
Java

Java List vs Set: When to Use Each Collection

Understand the behavioral differences between Java List and Set, including order, duplicates, implementations, conversion, and performance tradeoffs.

Java CollectionsList InterfaceSet InterfaceData Structures
Illustration of a Java List with an index pointer selecting an element, showing constant-time access for ArrayList and linear traversal for LinkedList.
Java

Java List get: Usage, Performance, and Edge Cases

java list get: Learn how to use Java List.get, what it costs on different implementations, and how to avoid IndexOutOfBoundsException.

JavaListArrayListCollections
Illustration of removing elements from a Java List with methods and pitfalls.
Java

Java List Remove: Methods, Pitfalls, and Performance

java list remove: Learn how to remove elements from a Java List using index, object, removeAll, and removeIf, and avoid common pitfalls like ConcurrentModificationExce...

JavaListArrayListremoveIf
A Java List with elements being added, showing an array and linked nodes representing ArrayList and LinkedList.
Java

Java List Add: Methods, Behavior, and Performance

Learn how to add elements to a Java List using add(), addAll(), and index-based insertion, and understand the behavior and performance of ArrayList and LinkedList.

JavaArrayListLinkedListCollection
Illustration of a Java list with elements indexed, showing methods like add, remove, and sort
Java

Java List Methods: A Practical Guide

Explore the core methods of Java's List interface, their behavior, and how to choose between ArrayList and LinkedList for your use case.

java collectionsarraylistlinkedlistlist interface
Illustration of Java List interface showing ordered collection with index access and multiple implementations.
Java

Java List Interface: Contract and Implementations

Learn the Java List interface, its core methods, and how to choose between ArrayList and LinkedList for your use case.

JavaCollectionsArrayListLinkedList
Illustration of a Java LinkedList used as a stack with nodes linked together and LIFO operations highlighted.
Java

Using Java LinkedList as a Stack

Learn how to use Java's LinkedList as a stack, including push/pop operations, performance tradeoffs, and how it compares with the legacy Stack class.

JavaLinkedListStackCollections
Diagram showing a LinkedList used as a queue with elements entering at tail and leaving at head.
Java

Java LinkedList as Queue: Implementation and Tradeoffs

Learn how to use Java's LinkedList as a queue, including FIFO behavior, offer/poll/peek methods, thread-safety considerations, and when ArrayDeque is usually the better choice.

JavaLinkedListQueueData Structures
Illustration of a Java LinkedList stack with push and pop operations moving elements at the head of the list
Java

Java LinkedList push pop: Stack Operations Explained

Learn how push and pop work on Java's LinkedList through the Deque interface, with code examples, performance tradeoffs, and comparisons to ArrayDeque.

JavaLinkedListDequeStack
Diagram of Java LinkedList poll removing the head element and returning it
Java

Java LinkedList poll: How It Works

Understand how LinkedList.poll() works in Java: what it removes, what it returns on empty lists, and how it compares with remove(), peek(), and ArrayDeque.

JavaLinkedListQueueDeque