Engineering
In a previous assignment, you created a set class which could store numbers. This class, called ArrayNumSet, implemented the NumSet interface. In this project, you will implement the NumSet interface for a hash-table based set class, called HashNumSet. Your HashNumSet class, as it implements NumSet, will be generic, and able to store objects of type Number or any child type of Number (such as Integer, Double, etc).Notice that the NumSet interface is missing a declaration for the get method. This method is typically used for lists, and made sense in the context of our ArrayNumSet implementation. Here though, because we are hashing elements to get array indices, having a method take an array index as a parameter is not intuitive. Indeed, Java's Set interface does not have it, so it's been removed here as well.The hash table for your set implementation will be a primitive array, and you will use the chaining method to resolve collisions. Each chain will be represented as a linked list, and the node class, ListNode, is given for you. Any additional methods you need to work with objects of ListNode you need to implement in your HashNumSet class.You'll need to write a hash function which computes the index in an array which an element can go / be looked up from. One way to do this is to create a private method in your HashNumSet class called hash like so:private int hash(Number element)This method will compute an index in the array corresponding to the given element. When we say we are going to 'hash an element', we mean computing the index in the array where that element belongs. Use the element's hash code and the length of the array in which you want to compute the index from. You must use the modulo operator (%).The hash method declaration given above takes a single parameter, the element, as a Number instead of E (the generic type parameter defined in NumSet). This is done to avoid any casting to E, for example if the element being passed to the method is retrieved from the array.When the number of elements in your array (total elements among all linked lists) becomes greater than 75% of the capacity, resize the array by doubling it. This is called a load factor, and here we will define it as num_elements / capacity, in which num_elements is the current number of elements in your array (what size() returns), and capacity is the current length of your array (what capacity() returns).Whenever you resize your array, you need to rehash all the elements currently in your set. This is required as your hash function is dependent on the size of the array, and increasing its size will affect which indices in the array your elements hash to. Hint: when you copy your elements to the new array of 2X size, hash each element during the copy so you will know which index to put each one.Be sure to resize your array as soon as the load factor becomes greater than 75%. This means you should probably check your load factor immediately after adding an element.Do not use any built-in array copy methods from Java.Your HashNumSet constructor will take a single argument for the initial capacity of the array. You will take this capacity value and use it to create an array in which the size (length) is the capacity. Then when you need to resize the array (ie, create a new one to replace the old one), the size of the new array will be double the size of the old one.null values are not supported, and a NullPointerException should be thrown whenever a null element is passed into add/contains/remove methods.Example input / outputYour program is really a class, HashNumSet, which will be instantiated once per test case and various methods called to check how your program is performing. For example, suppose your HashNumSet class is instantiated as an object called numSet holding type Integer and with initialCapacity = 2:NumSet numSet = new HashNumSet(2);Three integers are added to your set:numSet.add(5);numSet.add(3);numSet.add(7);Then your size() method is called:numSet.size();It should return 3, the number of elements in the set. Your capacity() method is called:numSet.capacity();It should return 4, the length of the primitive array. Now add another element:numSet.add(12);Now if you call numSet.size() and numSet.capacity(), you should get 4 and 8 returned, respectively. Finally, lets remove an element:numSet.remove(3);Now if you call numSet.size() and numSet.capacity(), you should get 3 and 8 returned, respectively. The test cases each have a description of what each one will be testing.