Implement the Iterator in Java
Implement the Iterator in Java
(1) Implement the Data Structure Iterator. The iterator should be able to iterate through the following data structures :
Stacks, Lists, Queue. NOTE: The Iterator should be able to iterate through the array, vector or linked data implementations
(2) Implement the Data Structure Dictionary from the interface provided. NOTE: The Dictionary you will implement may have one KEY map to multiple VALUES.
Compress your Iterator and Dictionary files into one zip file
import java.util.Iterator;_x000D_
/**_x000D_
An interface for a dictionary with distinct search keys._x000D_
@author Frank M. Carrano_x000D_
@author Timothy M. Henry_x000D_
@version 4.0_x000D_
*/_x000D_
public interface DictionaryInterface<K, V>_x000D_
{_x000D_
/** Adds a new entry to this dictionary. If the given search key already_x000D_
exists in the dictionary, replaces the corresponding value._x000D_
@param key An object search key of the new entry._x000D_
@param value An object associated with the search key._x000D_
@return Either null if the new entry was added to the dictionary_x000D_
or the value that was associated with key if that value_x000D_
was replaced. */_x000D_
public V add(K key, V value);_x000D_
_x000D_
/** Removes a specific entry from this dictionary._x000D_
@param key An object search key of the entry to be removed._x000D_
@return Either the value that was associated with the search key_x000D_
or null if no such object exists. */_x000D_
public V remove(K key);_x000D_
_x000D_
/** Retrieves from this dictionary the value associated with a given_x000D_
search key._x000D_
@param key An object search key of the entry to be retrieved._x000D_
@return Either the value that is associated with the search key_x000D_
or null if no such object exists. */_x000D_
public V getValue(K key);_x000D_
_x000D_
/** Sees whether a specific entry is in this dictionary._x000D_
@param key An object search key of the desired entry._x000D_
@return True if key is associated with an entry in the dictionary. */_x000D_
public boolean contains(K key);_x000D_
_x000D_
/** Creates an iterator that traverses all search keys in this dictionary._x000D_
@return An iterator that provides sequential access to the search_x000D_
keys in the dictionary. */_x000D_
public Iterator<K> getKeyIterator();_x000D_
_x000D_
/** Creates an iterator that traverses all values in this dictionary._x000D_
@return An iterator that provides sequential access to the values_x000D_
in this dictionary. */_x000D_
public Iterator<V> getValueIterator();_x000D_
_x000D_
/** Sees whether this dictionary is empty._x000D_
@return True if the dictionary is empty. */_x000D_
public boolean isEmpty();_x000D_
_x000D_
/** Gets the size of this dictionary._x000D_
@return The number of entries (key-value pairs) currently_x000D_
in the dictionary. */_x000D_
public int getSize();_x000D_
_x000D_
/** Removes all entries from this dictionary. */_x000D_
public void clear();_x000D_
} // end DictionaryInterface
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


