HashTable overview

It’s basically designed to store key value pairs HashTable class implements the Map interface and it inherits Dictionary class Main features of HashTable It stores data in the form of key-value pair HashTable is the Synchronized data structure Keys in the HashTable must be unique It does not allow Null key and Null value It […]

Share this article on

TreeMap with Looping

We can iterate TreeMap using enhanced for loop with keyset() method or by using enhanced for loop with EntrySet method or by using iterator Case 1 Enhanced for loop with keyset() Example import java.util.*; public class TreeMapEnhancedForLoopExample { public static void main(String args[]) {   TreeMap<Integer,String> tm = new TreeMap<>(); tm.put(3, “Three”); tm.put(1, “One”); tm.put(2, […]

Share this article on
< Previous Next >