79393281

Date: 2025-01-28 09:25:36
Score: 1.5
Natty:
Report link

SORTED MULTIMAP WITH PUBLIC NON-PARAMETRIC MAPPINGS The multimap abstract data type, a container of key-value associations where

dublicate keys are allowed, is defined with the following interface

public interface SortedMultimapek extends Comparable<K,5 [ /**Returns a value to which the specifted key is napped.

@param key the key whose associated value is to be returned.

@return a value to which the specifled key is mapped, or null if this sorted multimap contains no mapping for the key.

*V find(K key):

/**Returns true if this sorted multimap contains no key-value mappings.

*/ boolean LsEmpty();

@return true if this sorted multimap contains no key-value mappings.

/**Associates the specified value with the specified key in this sorted multimap. @param key the key with which the specifled value is to be associated.

@param value the value to be associated with the specified key. @throw java.lang. IllegalArgumentException if the specified key or value is null.

*/ void insert(K key, V value);

/**Removes a mapping for a key from this sorted multimap if it is present. @param key the key whose mapping is to be removed from this sorted multimap. @return the previous value associated with key, or null if there was no mapping for key.

*/V remove(K key);

/**Returns the number of key-value mappings in this sorted multimap.

*/ int size();

@return the number of key-value mappings in this sorted multimap.

/**Returns a sorted array view of the keys contained in this sorted multimap. @return an array view of the sorted keys contained in this sorted multimap where keys are sorted in ascending order according to their natural order.

*/ Object[] sortedKeys();

where K and V are the parametric data types for the key and value. The class to be used for the mappings is the following public class

public class Entry {

// instance variables

/**Constructs a new mapping with the specified key and value.

private Object key, value;

@param k the specified key of this mapping.

@param v the specified value of this mapping.

*/ public Entry(Object k, Object v) { setKey(k); setValue(v); }

/**Returns the key of this mapping.

@return the key of this mapping.

*/ public Object getKey() { return key; }

/**Returns the value of this mapping.

@return the value of this mapping.

*/ public Object getValue() { return value; }

Sets the key of this mapping with the specified key. /

@param k the specified key.

*/ public void setKey(Object k) (key = k; }

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • User mentioned (1): @param
  • User mentioned (0): @return
  • User mentioned (0): @return
  • User mentioned (0): @param
  • User mentioned (0): @param
  • User mentioned (0): @throw
  • User mentioned (0): @param
  • User mentioned (0): @return
  • User mentioned (0): @return
  • User mentioned (0): @return
  • User mentioned (0): @param
  • User mentioned (0): @param
  • User mentioned (0): @return
  • User mentioned (0): @return
  • User mentioned (0): @param
  • Low reputation (1):
Posted by: ZEYNAL ÖZTÜRK