Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

 

and many more ....

 

 

Get Set view of LinkedHashMap keys example

In this example we shall show you how to get a Set view of the LinkedHashMap keys. To get a Set view of the LinkedHashMap keys one should perform the following steps: Create a new LinkedHashMap. Populate the linkedHashMap with elements, with put(K key, V value) API method of LinkedHashMap. Invoke keySet() API method of LinkedHashMap. The method returns a ...

Read More »

Check value existence in LinkedHashMap example

With this example we are going to check a value existence in a LinkedHashMap. In short, to check if a value exists in a LinkedHashMap you should: Create a new LinkedHashMap. Populate the linkedHashMap with elements, with put(K key, V value) API method of LinkedHashMap. Invoke containsValue(Object value) API method of LinkedHashMap. The method returns true if this map maps ...

Read More »

Check key existence in LinkedHashMap example

This is an example of how to check a key existence in a LinkedHashMap. Checking if a key exists in a LinkedHashMap implies that you should: Create a new LinkedHashMap. Populate the linkedHashMap with elements, with put(K key, V value) API method of LinkedHashMap. Invoke containsKey(Object key) API method of LinkedHashMap, with a specified key as parameter. The method returns ...

Read More »

Remove element from HashSet example

In this example we shall show you how to remove an element from a HashSet if it exists in the HashSet. To remove an element from a HashSet one should perform the following steps: Create a new HashSet. Populate the HashSet with elements, using add(E e) API method of HashSet. Invoke remove(Object o) API method of HashSet, with the element ...

Read More »

Remove all elements from HashSet example

With this example we are going to demonstrate how to remove all elements from a HashSet. In short, to remove all elements from a HashSet you should: Create a new HashSet. Populate the hashSet with elements, using add(E e) API method of HashSet. Invoke clear() API method of HashSet. The method removes all the elements from the set, so that ...

Read More »

HashSet Iterator example

This is an example of how to obtain a HashSet Iterator, that is an iterator over the elements of the HashSet. Obtaining a HashSet Iterator implies that you should: Create a new HashSet. Populate the hashSet with elements, using add(E e) API method of HashSet. Invoke iterator() API method of HashSet. The method returns the Iterator over the elements in ...

Read More »

HashSet size example

In this example we shall show you how to get the HashSet size, that is the number of all the elements that the hashSet contains. To get the HashSet size one should perform the following steps: Create a new HashSet. Populate the hashSet with elements, using add(E e) API method of HashSet. Invoke size() API method of HashSet. The method ...

Read More »

Convert HashSet to Object array example

With this example we are going to demonstrate how to convert a HashSet to an Object array. In short, to convert a HashSet to an Object array you should: Create a new HashSet. Populate the hashSet with elements, using add(E e) API method of HashSet. Invoke toArray() API method. This method returns an array containing all of the elements in ...

Read More »

Check for element existence in HashSet example

This is an example of how to check for an element existence in a HashSet. Checking if an element exists in a HashSet implies that you should: Create a new HashSet. Populate the hashSet with elements, using add(E e) API method of HashSet. Invoke contains(Object value) API method of HashSet, with a specified element as parameter. The method returns true ...

Read More »

Sort Vector using Comparator example

In this example we shall show you how to sort a Vector using a Comparator. The Collections API provides methods to get a Comparator and use it to sort a Vector. To sort a Vector using a Comparator one should perform the following steps: Create a new Vector. Populate the vector with elements, using add(Object o) API method of Vector. ...

Read More »