In this example we shall show you how to get the size of a LinkedHashSet, that is the number of the elements that a LinkedHashSet contains. To get the size of a LinkedHashSet one should perform the following steps: Create a new LinkedHashSet. Populate the set with elements, using the add(E e) API method of LinkedHashSet. Invoke the size() API ...
Read More »Convert LinkedHashSet to Object array example
With this example we are going to demonstrate how to convert a LinkedHashSet to an Object array. In short, to convert a LinkedHashSet to an Object array you should: Create a new LinkedHashSet. Populate the set with elements, using the add(E e) API method of LinkedHashSet. Invoke toArray() method of LinkedHashSet, that returns an array containing all of the elements ...
Read More »Check for element existence in LinkedHashSet example
This is an example of how to check for an element existence in a LinkedHashSet. We will use the contains(Object o) API method of LinkedHashSet. Checking if an element exists in a LinkedHashSet implies that you should: Create a new LinkedHashSet. Populate the set with elements, using the add(E e) API method of LinkedHashSet. Check if a specific element exists ...
Read More »Remove mapping from Hashtable example
In this example we shall show you how to remove mapping from a Hashtable, that means removing a key value pair from a Hashtable. To remove mapping from a Hashtable one should perform the following steps: Create a new Hashtable. Populate the hashtable with key value pairs, using put(K key, V value) API method of Hashtable. Invoke the remove(Object key) ...
Read More »Remove all mappings from Hashtable example
With this example we are going to demonstrate how to remove all mappings from a Hashtable, that means removing all key value pairs from the Hashtable. In short, to remove all mappings from a Hashtable you should: Create a new Hashtable. Populate the hashtable with elements, using put(K key, V value) API method of Hashtable. Invoke the clear() API method ...
Read More »Hashtable values Iterator example
This is an example of how to obtain a Hashtable values Iterator, that is an iterator of the values of the Hashtable. Obtaining a Hashtable values Iterator implies that you should: Create a new Hashtable. Populate the hashtable with elements, using put(K key, V value) API method of Hashtable. Invoke elements() API method of Hashtable. It returns an Enumeration of ...
Read More »Hashtable keys Iterator example
In this example we shall show you how to obtain a Hashtable keys Iterator, that is an iterator of the keys of the Hashtable. To obtain a Hashtable keys Iterator one should perform the following steps: Create a new Hashtable. Populate the hashtable with elements, using put(K key, V value) API method of Hashtable. Invoke keys() API method of Hashtable. ...
Read More »Hashtable Iterator example
With this example we are going to demonstrate how to obtain a Hashtable Iterator, that is an iterator of the key value pairs of the Hashtable. In short, to obtain an iterator of the Hashtable’s entries you should: Create a new Hashtable. Populate the hashtable with elements, using put(K key, V value) API method of Hashtable. Invoke the entrySet() API ...
Read More »Get size of Hashtable example
This is an example of how to get the size of the Hashtable, that is the number of the key- value pairs that the Hashtable contains. Getting the size of the Hashtable implies that you should: Create a new Hashtable. Populate the hashtable with elements, using put(K key, V value) API method of Hashtable. Invoke the size() API method of ...
Read More »Get Set view of Hashtable keys example
In this example we shall show you how to get a Set view of Hashtable keys. To get a Set view of Hashtable keys one should perform the following steps: Create a new Hashtable. Populate the hashtable with elements, using put(K key, V value) API method of Hashtable. Invoke keySet() API method of Hashtable. The method returns a Set that ...
Read More »