Question: please implement these methods and do not modify them public class YorkUnsortedMap implements Map { / / - - - - - - - -
please implement these methods and do not modify them
public class YorkUnsortedMap implements Map
nested MapEntry Class
private static class MapEntry implements Entry
private K key;
private V value;
Constructor to set the key and value of this entry
@param key the key
@param value the value
public MapEntryK key, V value
this.key key;
this.value value;
@Override
public K getKey
TODO: Your implementation of this method starts here
return null;
@Override
public V getValue
TODO: Your implementation of this method starts here
return null;
Sets the value of this Entry with specified value
@param newValue the new value
@return old value of this entry
public V setValueV newValue
TODO: Your implementation of this method starts here
return null;
String representation for map entry
@Override
public String toString
return key value ;
end of nested MapEntry class
ALREADY IMPLEMENTED; DO NOT MODIFY
Define default load factor
private static final double LOADFACTOR ;
ALREADY IMPLEMENTED; DO NOT MODIFY
Define the default hashtable size. Must be a power of
private static final int INITCAPACITY ;
ALREADY IMPLEMENTED; DO NOT MODIFY
Define the maximum hashtable size. is same as
private static final int MAXCAPACITY ;
ALREADY IMPLEMENTED; DO NOT MODIFY
The current hashtable capacity. Capacity must be a power of
private int capacity;
ALREADY IMPLEMENTED; DO NOT MODIFY
User specify a load factor used in this hash table
private double loadFactor;
ALREADY IMPLEMENTED; DO NOT MODIFY
The number of entries in the map
private int size ;
Add any other private data members or methods that are necessary to manage
the YorkUnsortedMap You can use java.util.ArrayList or java.util.LinkedList
DoublyLinked List to implement and store the map entries
ALREADY IMPLEMENTED; DO NOT MODIFY
private List entries;
no argument constructor Construct a map with the default capacity and load
factor
public YorkUnsortedMap
TODO: Your implementation of this method starts here
One argument constructor Construct a map with the specified initial capacity
and default load factor
public YorkUnsortedMapint capacity
TODO: Your implementation of this method starts here
Construct a map with the specified initial capacity and load factor. Note:
the capacity of map must be power of Userclient can specify any value as
map capacity. You should make sure that the map is created with the power of
capacity that is greater than the user's given capacity. For example, if
the user specifies the input capacity as you should create a map with a
capacity of
@param capacity map capacity specified by client
@param loadFactor map loading factor
public YorkUnsortedMapint capacity, double loadFactor
TODO: Your implementation of this method starts here
@Override
public int size
TODO: Your implementation of this method starts here
return ;
@Override
public boolean isEmpty
TODO: Your implementation of this method starts here
return false;
@Override
public V getK key throws NullPointerException
TODO: Your implementation of this method starts here
return null;
@Override
public void clear
TODO: Your implementation of this method starts here
@Override
public V putK key, V value throws NullPointerException
TODO: Your implementation of this method starts here
return null;
@Override
public V removeK key throws NullPointerException
TODO: Your implementation of this method starts here
return null;
@Override
public boolean containsKeyK key throws NullPointerException
TODO: Your implementation of this method starts here
return false;
@Override
public boolean containsValueV value
TODO: Your implementation of this method starts here
return false;
@Override
public Iterable keySet
TODO: Your implementation of this method starts here
return null;
@Override
public Iterable values
TODO: Your implementation of this method starts here
return null;
@Override
public Iterable entrySet
TODO: Your implementation of this method starts here
return null;
Return String value represent the content of map
if Map contains only two entries
putA; and putA;
the output will be
@Override
public String toString
TODO: Your implementation of this method starts here
return new String;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
