-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashTableDemo.java
More file actions
33 lines (31 loc) · 1.02 KB
/
HashTableDemo.java
File metadata and controls
33 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package datastructure.hashtable;
/**
* The type Hash table demo.
*/
public class HashTableDemo {
/**
* The entry point of application.
*
* @param args the input arguments
*/
public static void main(String[] args)
{
HashTable table = new HashTable(); //Create a HashTable
//Before Insertion
System.out.println("Table Size = " + table.size());
table.insert("This",1 ); //Key-Value Pair
table.insert("is",2 );
table.insert("a",3 );
table.insert("Test",4 );
table.insert("Driver",5 );
System.out.println("Table Size = " + table.size());
// first search the key then delete it in the table
// see the implementation first
System.out.println(table.delete("a")+ " : This key is deleted from table");
System.out.println("Now Size of the table = " + table.size() );
if(table.isEmpty())
System.out.println("Table is Empty");
else
System.out.println("Table is not Empty");
}
}