In this post, we covered the TCS java interview questions. The candidate got asked about the Java 8 Stream operations where he was given two…
Posts published 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…
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…
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…
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…
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…
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…
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…
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…
The entrySet() method of HashMap returns the set view of the entries in this map. Syntax Set<Entry<K, V>> entrySet() Parameters It does not take any…