How to get values from hashmap in java example

We have seen, how to insert objects in HashMap and the internal working of HashMap. In this post, we will see How to get values from hashmap in java example, How does the java hashmap get() method work? Here is the table content of the article will we will cover this topic.1. get(Object key) method2. … Read more

HashMap method in java

In java, the HashMap class has various method that helps to perform different options. The HashMap class inherits all the methods of the Map interface. So the HashMap class contains all the java map methods or java map function. How to use HashMap put() method? HashMap provides some methods that are used to add to … Read more

How to add an object in HashMap by HashMap put() method

You have read the HashMap in Java and now we will see how to insert objects in HashMap. The HashMap class provides some methods like Java HashMap put() method, putAll() method(java map put all). Here we will discuss HashMap put example. Here is the table content of the article will we will cover this topic.1. … Read more

Internal working of HashMap

We have learned HashMap in java in recent posts. As we know HashMap works based onkey-value pair that is known as the entry. But how does HashMap internal implementation works? It is one of the most common questions from HashMap interview questions. In this post, we will see the internal working of HashMap in java … Read more

TreeSet Methods in Java

JavaTreeSet class provides various methods to perform on TreeSet. In this post, we will discuss several methods with java TreeSet example. Here we will discuss all the TreeSet methods in java. Here is the table content of the article will we will cover this topic.Insert Elements to TreeSet 1. add(E e) method 2. addAll(Collection c) … Read more

TreeSet internal working

We have learned a lot of things about TreeSet in recent posts. TreeSet stores only unique elements and also sorts the elements. It sorts the elements in natural order or custom order by providing a comparator. In this post, we will learn the TreeSet internal implementation in java and TreeSet internal working. Here is the … Read more

HashSet vs LinkedHashSet

We have read HashSet and LinkedHashSet in recent posts. In this post, we will see what is the difference between HashSet and LinkedHashSet or HashSet vs LinkedHashSet? Both has different use and implementation in JDK. Let’s see how HashSet vs LinkedHashSet 1. The HashSet class doesn’t maintain the order of elements. If you iterate a … Read more

CopyOnWriteArraySet in java

The CopyOnWriteArraySet class is part of the concurrent collection and it was introduced in JDK 1.5. Some developer thinks ConcurrentHashSet in java but it’s not because there is nothing like in java ConcurrentHashSet. The CopyOnWriteArraySet is thread-safe and it internally uses the CopyOnWriteArrayList for all of its operations.  If you haven’t read CopyOnWriteArrayList yet, then you should read it … Read more

HashSet Methods In Java With Example

The HashSet class in java has a lot of methods that are used to operate the data. Here we will discuss all the methods with examples. Let’s see all the HashSet Methods In Java. How to add elements to an HashSet? 1. add(E e) method: There is only one way to add the element in … Read more

How to remove elements from HashSet?

We have learned about HashSet in java and how we can add elements in HashSet? Now we will see how to remove element from HashSet. We can use remove() method of HashSet or by use of iterator. Let’s discuss both ways in java remove from HashSet remove(Object o) method The remove(Object o) method is used to … Read more