Jump to content

urgent need solution for this java program


rajumaharaju

Recommended Posts

Problem: create an implementation of the CellMap interface.



class Cell {

    Object value;

}



/** A CellMap is a collection of key/value Cell pairs. 

*/

interface CellMap {



    /** a call to put() will add the input key/value pair to the collection. 

        If the key has already been added to the collection, then the latest value will replace the existing value.

        A null "key" is not valid.  A null "value" will remove any existing key from the collection.

        Two keys are the same if key1.value.equals(key2.value).

    */

    void put( Cell key, Cell value );



    /** @return the "value" from a previous call of put(key,value).

        If the key is not part of the collection, then return null.

    */

    Cell get( Cell key );

}





You can create one or more implementation classes that can use Cell objects, or primitive values (including primitive arrays).



Do not use any other existing classes, no toolkits, no collection classes, no JDK classes.



BONUS:  extra credit if your implementation does not include the use of primitive arrays.


You can also use Throwable, or one of the derived classes.



Some things to consider or discuss if interesting...

- performance characteristics.

- error handling.

- bugs or areas of improvement.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...