I have searched and can’t seem to find an answer on this. I understand what an Enumeration type is, but I can’t for the life of me determine how to create and return one in a function. Basically, I have a function:
public Enumeration getKeys(){
//Returns an Enumeration of valid keys in the hash table
}
that needs to return an Enumeration.
My hashtable contains a key object and a value object, and I have already implemented methods like containsKey(Object key) and retrieve(Object key) to help me determine if a key is valid in the table and what the contents of the table at the key value are. Any help on understanding where to start with building an Enumeration type and returning it would be greatly appreciated.
It is “relatively” easy, change your code like this:
Now it is up to you to implement the two methods with respect of you business rules.