{{announcement.body}}
{{announcement.title}}

The Best of Java Collections [Tutorials]

DZone 's Guide to

The Best of Java Collections [Tutorials]

The Java Collections Framework (JCF) has become ubiquitous among Java developers.

· Java Zone ·
Free Resource

car collection

Who doesn't love a good collection?

When it comes to building Java applications, the Java Collections Framework (JCF) has become ubiquitous among developers. Since the release of JDK 2, Java objects and data structures have changed development for the better, boosting performance and reducing programming efforts.

Oracle defines collections and the JCF as:

"An object that represents a group of objects (such as the classic Vector class). A collections framework is a unified architecture for representing and manipulating collections, enabling collections to be manipulated independently of implementation details."

Below, you can find a number of articles dedicated to breaking down the JCF architecture, as well as tutorials on performance, Collection interfaces, and Maps. Enjoy!

Overview of Collections

Justin Albano's series The Developer's Guide to CollectionsLists and Sets— It's time for a deep dive into collections in Java, including the defining philosophy of collections, important methods, and advice for implementation.

Check out these stellar posts from Jay Sridar: A Look at Java Collections and Java Collections: The List and Collections Interfaces. These two posts will cover everything you need to know when getting started with the Collections framework.

An Introduction to the Java Collections Framework by Marcus Biel— A high-level introduction to the Java Collections Framework, including the class hierarchy.

Java Collections Are Evolving by Trisha Gee — Collections have seen a lot of changes in the past couple of JDKs. This post looks at how they've improved in Java 9 and Java 10.

Processing Collections

Collections and Encapsulation in Java by Dave Taubler— A core tenant of object-oriented programming is encapsulation.

Immutable Collections in Java 9 by Harinath Kuntamukkala — Java 9's Collection factory methods finally bring immutable collections. See how they work and how they can save you time and code.

How to Sort Objects in Java by Biplab Pal — Any Java developer worth their salt has used the Collection framework. Here is a simple tutorial that explains how to sort in Java.

Deep Clone Collection Objects in Java [Snippets] by Yogen Rai — Check out this post on how to deep clone an object in Java 8 using the Object.clone method and new Java streams.

Performance

Java Collection Performance by Leo Lewis — While this post is from all the way back in 2011, its contents are still relevant in the Java space. Go check it out!

Iteration Over Java Collections With High Performance by Dang Ngoc Vu — Learn more about the forEach loop in Java and how it compares to C style and Stream API in this article on dealing with collections in Java.

Performance Evaluation of Java ArrayLists by Viraj SalakaMalith JayasingheIsuru Perera, and Srinath Perera — Here's a performance breakdown of the ArrayList add operation to see how to get the most throughout out of your ArrayLists.

How to Prevent Your Java Collections From Wasting Memory by  — Wondering about the memory impact of your Java collections? Here's how to think about your collections while keeping overhead in mind.

Performance Analysis of ArrayList and LinkedList in Java by Anant MishraArrayList and LinkedList are frequently used classes in the Java collection framework. If you know only understand basic performance comparisons of ArrayList and LinkedList, but not the minor details of these two classes, then this article is for you.

Improving Java Performance by Nataliya Muriy—This article touches on an abundance of performance issues, as well as how to optimize Java collections performance.

Benchmarking Java Lists Performance by Jay Sridar — This post examines the performance characteristics of the list implementations: ArrayList and LinkedList

[DZone Refcard] Java Performance Optimization by Pierre-Hugues Charbonneau — Getting Java apps to run is one thing. But getting them to run fast is another. This Refcard covers JVM internals, class loading (updated to reflect the new Metaspace in Java 8), collections, troubleshooting, monitoring, concurrency, and more.

Lists

Convenience Factory Methods for Collections in Java 9 by Bartłomiej Słota — Java 9 brings with it some new convenience methods for dealing with collections. Here, we look at the role they play in Lists, Sets, and Maps.

How to Easily Create Lists, Sets, and Maps in Java [Video] by Marco Behler — Check out this post to learn how easy it is to create lists, sets, and maps from Java 9 onwards.

How to Convert Between List and Array in Java by John Thompson — Want to learn more about converting a list to an array in Java? Check out this tutorial to learn more using the Apache Commons Lang and Guava.

How to Create an ArrayList in Java by Mahesh Sharma — Learn more about how this widely-used function adds functionality and flexibility to your applications.

How to Convert Array to ArrayList in Java by Ryan Wang — This one is an oldie-but-a-goodie. Every Java programmer knows ArrayList — while the concept itself is relatively simple, it can be easy to make mistakes. Here's how to convert an Array to an ArrayList with no mistakes.

Different Approaches to Sorting Elements of an ArrayList in Java by John Thompson — Learn different approaches for sorting elements of an ArrayList — one using Comparable and the other using Comparator.

How to Convert an Array to a String in Java [Code Snippet] by Ramesh Fadatare — Learn the different ways to convert arrays and/or integers to a string.

Sets and Queues

The Developer's Guide to Collections: Sets by Justin Abano — Time for another deep dive into Java collections! This time, we focus on the concept of sets, the set interface, and everything you can do with sets.

The Developer's Guide to Collections: Queue by Justin Albano — Let's continue our journey into Java collections by examining the concept and proper usage of queues and deques in your code.

What Is a Queue? by Anders Olsen — Want to learn more about using a queue in Java? Check out this post to learn more about using a queue linear data structure in your next project.

HashSet Vs. TreeSet Vs. LinkedHashSet by Ryan Wang — In a set, there are no duplicate elements. That is one of the major reasons to use a set. There are three commonly used implementations of Set in Java: HashSet, TreeSet, and LinkedHashSet. 

Get Your Internal Queues Under Control in Java by Petr Bouda — There are a lot of reasons why you should be using internal queues in your program.

Java Concurrency: BlockingQueue by Jakob Jenkov— Learn more about queues in this simple implementation of a Java BlockingQueue.

Maps

Java 8 Map, Filter, and Collect Examples by Javin Paul — Read this post to learn how to use the Map and Filter functions in Java 8 to transform and filter elements of objects.

HashMap Vs. TreeMap Vs. HashTable Vs. LinkedHashMap by Ryan Wang — We look at the most commonly used implementation of Map in Java and how to differentiate between use cases.

How to Convert List to Map in Java by Hussein Terek — Want to learn how to convert List to Map in Java? Read this post to learn how to do this in both Java 7 and Java 8.

How to Sort a Map by Value in Java 8+ by Yogen Rai — Want to learn more about sorting a map value in Java 8 or above? Click here for more about sorting maps in this tutorial.

Removing Elements From a Map in Java by Dan Newton — This is a very short and simple post on removing elements from a Map in Java, focusing on removing multiple elements and ignoring the fact that you can remove a single element using Map.remove.

How to Use Java HashMap Effectively by A. N. M. Bazlur Rahman — Struggling with HashMaps? Here's how to effectively use Java HashMaps.

Java HashMap Implementation in a Nutshell by Yogen Rai — Want to learn more about custom HashMap implementation in Java? Check out this tutorial on how we can implement this data structure using arrays.


Further Reading

Topics:
java ,collections ,tutorials ,links

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}