Tag: Java Collections

Core Java

Java – Remove all nulls from a List

Introduction: In this article, we’ll learn how to remove nulls from a Java List using plain-old Java, Java 8 lambda expression, and some third-party libraries. So, let’s get started! Removing nulls from a List In Java: Let’s explore different ways in which we can remove nulls from a Java List: 1. Java 7 or lower versions: […]

Be the First to comment. Read More
Core Java

LinkedList In Java

Introduction: A LinkedList is a linear data-structure composed of nodes. In a singly linked list, each node contains data and a reference. Here, the reference-part refers to the next node in the linked list. In a doubly linked list, on the other hand, we have data and references to both previous and next nodes. Java […]

Be the First to comment. Read More
Core Java

Java Queue Interface

Introduction: A Queue is a FIFO (First In First Out) abstract data type (ADT). In other words, the elements are removed in the order in which they were inserted. The java.util.Queue is an interface in Java and extends from java.util.Collection. Some of the commonly used Queue implementation classes include a LinkedList, an ArrayDeque and a […]

One comment Read More
Core Java

Java TreeMap vs HashMap

Introduction: In this quick post, we’re gonna look at the similarities as well as the differences between Java HashMap and TreeMap. Similarities: Before we dive into the differences between Java HashMap and TreeMap, let’s first look at their similarities: Both extend java.util.AbstractMap class and are part of Java Collections API Both of these Map implementations aren’t […]

Be the First to comment. Read More
Core Java

HashMap vs HashTable In Java

Introduction: Both HashMap and HashTable implements java.util.Map interface and are used to store key-value pairs but there are some important differences between them. In this tutorial, we’ll cover the differences between HashMap and HashTable. Similarities Between HashMap and HashTable: Before we cover the differences, let’s look first at the similarities between a HashMap and a […]

Be the First to comment. Read More
Core Java

TreeSet In Java

Introduction: TreeSet in Java is a sorted set of items stored in a tree-like structure. It implements the NavigableSet interface and extends AbstractSet class. Some of the properties of TreeSet includes: Unique collection of items Elements stored in a sorted order Faster access and retrieval of items The default ordering in a TreeSet is in […]

Be the First to comment. Read More
Core Java

OCA Java 8 Preparation : ArrayList

Java Collection framework provides an ArrayList class in package java.util which is used to hold a collection of objects. It implements the List interface(List extends Collection interface).The benefit of using ArrayList over Array is that you do not need to know the size of ArrayList<E> while creating it. It could be thought of as a […]

2 comments Read More