Java HashMap – Remove Entries

Learn about removing entries from a HashMap, including removing by key, with an iterator and bulk removal with a filter.

“To live is the rarest thing in the world. Most people exist, that is all.”
― Oscar Wilde


1. Introduction

After covering HashMap basics, iteration and searching/sorting, let us look at a few ways of removing entries from a HashMap.

Continue reading “Java HashMap – Remove Entries”

Java HashMap Search and Sort

Search and sort a HashMap by key as well as by value.

“What you stay focused on will grow.”
― Roy T. Bennett

1. Introduction

Having explored HashMap in several previous articles (here and here), let us now learn how to search and sort a HashMap by key as well as value.

Continue reading “Java HashMap Search and Sort”

Java Collections – HashMap

Create a HashMap by parsing CSV. Declare and use a multi-map (a HashMap inside a HashMap).

“Don’t judge each day by the harvest you reap but by the seeds that you plant.”
― Robert Louis Stevenson

Check out the previous parts of this Java Collections Guide: Introduction, Part 1 – Collection, Part 2 – Sets and Part 3 – ArrayList.

1. Introduction

The HashMap implements the Map interface and provides the abstraction of a dictionary mapping of keys to values. It is a part of the Java Collections Framework but does not fall under the Iterable and Collection hierarchy. In this article, we learn how to use HashMaps.

Continue reading “Java Collections – HashMap”