Press "Enter" to skip to content

DevCubicle

How Generics Work in Java?

Let’s examine how generics work in Java. Also, we will look at how generics is a compile-time feature. To demonstrate this concept, we are going…

Autoboxing with Generics in Java

In this post, we are going to look at how autoboxing works with Generics in Java. Autoboxing is a feature that got introduced in Java…

Why Generics in Java?

Generics got introduced in Java SE 5.0, but the question is why use generics in the first place? In this tutorial, we are going to…

HashMap clear() Method in Java

The clear() method of HashMap removes all the mappings from the map. After a call to the clear method, the HashMap becomes empty and the…

HashMap keySet() Method in Java

The keySet() method of HashMap returns a set of keys contained in it. Any changes to the map also modify the returned set and vice…

HashMap isEmpty() Method in Java

The isEmpty() method of HashMap checks if the map contains any key/value pairs. It returns true if the map does not contain any entries. More…

HashMap size() Method in Java

The size() method of HashMap returns the number of key-value entries present in the map. When we create the HashMap its size is zero. This…

HashMap remove() Method in Java

The remove(K key) method of HashMap removes the entry for the specified key from the map. It returns the value associated with the key. To…