Strings as hashmap keys

If I use a string (a file name, for example) as the key for a hashmap put call, and then later try to retrieve the stored object using the same string, but this time hard-coded, will my object be retrieved? That is, will the dynamically loaded key and the hard-coded key be seen as the same object?
that is ...
image is read in from a file
image is stored in hashmap, using filename as key
retrieval is attempted using image title "image.gif" - is it successful?

Do you mean this? String key = getStringSomehowSuchAsFielname();
map.put(key, value);
value = map.get("image.gif"); // I put with a variable but retrieve with a constant, so will it work?If that's what your'e asking, then yes, it will work. As long as the object that you use for a key properly overrides equals and hashCode, then it can be used as a key in a Map.
"Properly overrides..." means that the state of the object is used the way you want it to be used for determining equality. In the case of java.lang.String, they're overriden the way you'd expect--i.e., using the sequence of characters in the string to determine equality.
Make sense?

Similar Messages

  • Issue with passing expression to a hashmap key in a dataTable column

    hi all,
    Can someone help me with passing an expression like "123-456" to a hashmap key in my dataTable . In my dataTable i have t:columns tag which generates checkboxes for each row in the dynamic column .The value of checkbox must be identified by a combination of userID and accountID. So i want to set value of checkbox something like this'userID-account.ID' . But it never returns the right value since userID is taken as string instead i want the value of userID to be passed in that expression. Someone please help...iam struck with this issue from so long.Here is the code.
    page1.jsp:
    <t:dataTable id="groupuserlist"
                  var="user"            
                             value="#{manageuserscontroller.userList}"     // this is a list of userIDs
                 cellspacing="0"
                 preserveDataModel="false"
                 headerClass="topRow"
                 preserveSort="true"
                 summary="This table displays list of users for an accessgroup">
         <t:column>
          <f:facet name="header"><h:outputText value="User ID" /></f:facet>
          <t:outputText value="#{user.ID}" />
         </t:column>
         <t:column>
          <f:facet name="header"><t:commandSortHeader columnName="title" arrow="true"> <h:outputText value="Title"/> </t:commandSortHeader> </f:facet>
          <t:outputText value="#{user.title}" />
         </t:column>
          <t:columns var="cols" value="#{manageuserscontroller.selectedAGList}"> //selectedAGList is a list of accountIDs
          <f:facet name="header"><h:outputText value="#{cols.name}" /></f:facet>
          <h:selectBooleanCheckbox id="checkbox4" value="#{manageuserscontroller.selectedUserIds['user.ID-cols.ID]}" />
          </t:columns>
    </t:dataTable>Backing bean: In this selectedUserIds iam intentionally setting up key something like "userID-accountID" so that i can split the userID and accountID for later user
    private Map<String, Boolean> selectedUserIds = new HashMap<String, Boolean>();
             somebody please to my email. If you need further information iam very happy to provide any time. Also let me know if there is another way to get this job done..
    Thanks very much in advance

    Hi BalusC,
    I am very much thankful to you. I got my issue resolved only when i select one dynamic column. It doesn't seem to be working if i select multiple columns. Not sure where exactly my logic is going wrong. Here is a snippet of my code.. Please let me know if you find any mistake in it..Once again thanks very much..for your great help.
    jsp:
    <t:dataTable id="grouplist"
                  var="user"            
                   value="#{manageuserscontroller.userList}"     
                   styleClass="companyAdminMainTable ltgreen_Hrule marVertSml"
                 cellspacing="0"
                 preserveDataModel="false"
                 headerClass="topRow"
                 preserveSort="true"
                 summary="This table displays list of users for an account">
         <t:column>
          <f:facet name="header"><h:outputText value="User ID" /></f:facet>
          <t:outputText value="#{user.ID}" />
         </t:column>
         <t:column>
          <f:facet name="header"><t:commandSortHeader columnName="title" arrow="true"> <h:outputText value="Title"/> </t:commandSortHeader> </f:facet>
          <t:outputText value="#{user.title}" />
         </t:column>
          <t:columns id="dynamic" var="cols" value="#{manageuserscontroller.selectedAGList}">
          <f:facet name="header"><h:outputText value="#{cols.name}" /></f:facet>
          <h:selectBooleanCheckbox id="checkbox4" value="#{manageuserscontroller.selectedAGUserIds[user.ID][cols.accessGroupID]}" />
          </t:column>
          </t:columns>
    </t:dataTable>Backing bean:
    private Map<Integer, Map<Integer,Boolean>> selectedAGUserIds = new HashMap<Integer, Map<Integer,Boolean>>();
        private Map<Integer, Boolean> selectedAGIds = new HashMap<Integer, Boolean>();
    for(int j=0; j< selectedAGList.size(); j++){   //List of selected dynamic account columns
             for(int i=0; i < userList.size();i++){              // lisf of users
                   try {
                        int m = userList.get(i).getID();
                        int n = selectedAGList.get(j).getAccessGroupID();
                        selectedAGIds=(AccessGroupDAO.getUserMap1(userList.get(i).getID(),selectedAGList.get(j).getAccountID()));
                        selectedAGUserIds.put(userList.get(i).getID(),selectedAGIds);
                       System.out.println("hashmap value"+ selectedAGUserIds.get(m).get(n));
                        } catch (Exception e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                 System.out.println("outer hashmap size"+ selectedAGUserIds.size());
          }DAO:
    public static Map<Integer,Boolean> getUserMap1(Integer userID, int accountID) throws Exception {
         Map<Integer, Map<Integer,Boolean>> selectedUserAGIds = new HashMap<Integer, Map<Integer,Boolean>>();
                    Map<Integer, Boolean> selectedAGIds = new HashMap<Integer, Boolean>();
          String sql="  select iusermetaid,iaccountid from useraccountlist where iusermetaid = userID and iaccountid = accountID ";
             ResultSet rs = executeSQL(sql);
             if(rs!=null & rs.next()){
                  System.out.println("record found");
                  Integer aid = rs.getInt("iaccountid");
                        selectedAGIds.put(aid, true);
             else{
                  System.out.println("record not found");
                  selectedAGIds.put(accessGroupID, false);
                  System.out.println("get the key value"+ selectedUserAGIds.get(userID).get(accessGroupID));
            System.out.println("Exiting accessgroupDAO");
             return selectedAGIds;
    }

  • Doubt in Hashmap key

    Hi All,
    I have got few long in HashMap as key. So in my code I wrote
    long temp= Long.parseLong((String)tempmap.get(key)But at this time Iam getting number format exception but when I do
    long temp= String.valueOf(tempmap.get(key))it works fine.The above is a pseudo code and not right way of extracting key-value from hashmap. My question as hashmap key is an object
    and casting it to String and then Long.parseLong fails but String.valueOf succeeds why?
    How both treat objects differently.
    Thanks for the advice in advance

    My actual code was
    Map.Entry ent=(Map.Entry)itr.next();
    Long.parseLong(String.valueOf(ent.getKey()))
    The key is a long. I just wrote a pseudo code and not exact code as my doubt why when I do
    Map.Entry ent=(Map.Entry)itr.next();
    Long.parseLong((String)(ent.getKey())) it fails but the first code gives results.So how String casting and String.valueOf treats object.

  • HashMap keys and values not staying consistent (my fault, but why?)

    Alright, after starting out for the very first time with HashMaps a few hours ago, I've gotten the hang of them decently I think. I am encountering a problem, though, when I try to get user-selected keys + values to display. My code is:
       public void useZone(String use)
           Object used = hm.get(use);
           System.out.print("\f");
           Set set = hm.entrySet();
           Iterator i = set.iterator();
           if (used != null){
               System.out.println("Time Zone Used:");
               Map.Entry thiszone = (Map.Entry)i.next();
               Object usedzone = thiszone.getValue(); //Get the value of the zones and assign them as Object usedzone
               Integer useval = (Integer) usedzone; //Assign the Object to an Integer value so we can use it
               difference = useval;
               if (useval > 0){ //Display the hour offset correctly
                   System.out.println(use + ": GMT +" + usedzone.toString());
               else if (useval == 0){
                   System.out.println(use + ": GMT");
               else if (useval < 0){
                   System.out.println(use + ": GMT " + usedzone.toString());
           else{
               System.out.println("Invalid zone name.");
           } //End if
           ClockDisplay.getZone(difference); //Send variable difference
      }What will happen is that the first time I will be fine...
    Say the HashMap keys and values are
    "Rome", "-2"
    "Chicago", "6"
    "New York", "5"
    "Paris", "-1"
    If I type "Rome" in when I execute this method, it gives me the correct output - "Rome: GMT -2"
    If I then re-run the method, as to display a different one, I get "Chicago: GMT -2"
    It's like the name the user inputs is updating, obviously, but the value of the HashMap that goes along with the user-input doesn't match up or something. My code is confusing myself after looking at it for nearly 10 hours, so I apologize that I had to post something so trivial here - I'm sure it's just a problem with my wordings....any help would be greatly appreciated.

    Hello,
    It's very possible I'm missing some things here, but I've attempted to review your code.
    Let me just define the specs of the code as I see them:
    Method useZone accepts String input, which is "supposed" to be the key to a hashmap.
    The timezone offsets are the value's in this hashmap.
    The value is of type Integer.
    If a key is properly selected, print out GMT + or - the offset?
    If I have this correct, consider the following implementation:
       public void useZone(String use) {
           Integer offset = (Integer)hm.get(use);
           System.out.print("\f");
           if (offset != null){
               System.out.println("Time Zone Used:");
               System.out.println(use + ": GMT +" + offset.toString());
           } else{
               System.out.println("Invalid zone name.");
           ClockDisplay.getZone(offset); //Send variable difference
      }I'd guess you're getting odd behavior because you're creating an iterator to iterate through the map, but then only calling i.next() once - HashMap doesn't guarantee insertion order, so the fact it worked once correctly is "random".
    Also, if you are using java 1.5 declare the map as follows:
    Map<String, Integer> hm = new HashMap<String, Integer>();And you can get rid of the casts. I would also suggest renaming the hashmap to something that describes what it holds, rather than it's object type. Maybe something like timeZoneMap - or offsetMap. I would also consider renaming "use" to something that describes the data it might hold, instead of something that describes the workflow.
    Variable naming is very difficult! I would suggest renaming all of your variables, but I think those are the only ones I kept!
    Edited by: Adam_Schaible on Nov 28, 2007 12:09 PM

  • Problem using dynamic variable as HashMap key

    I have created a HashMap called instantHashMap and loaded it with data from a query.
    I can load a variable with a value for the HashMap key and successfully output the HashMap value:
    <c:set var = "gameno" value="150" />
    <c:out value = "${instantHashMap[gameno]}" />
    But when I load my variable value from my data like this...
    <c:set var = "gameno" value="${rvo.gameNo}" />
    <c:out value = "${instantHashMap[gameno]}" />
    ...it doesn't work.
    My loaded variable value is correct because this statement does work and reflects the data obtained from my query:
    <c:out value = "${gameno}" />
    Could rvo.gameNo be the wrong data type or something?

    My loaded variable value is correct because this statement does work >and reflects the data obtained from my query:In which case, check if your map contains a key which is the loaded variable value.
    ram.

  • Convert from String to HashMap

    Hi
    Can any body pls tell us how to convert from String to HashMap
    I have one string str="Col1=200, Col2=225";
    So how can i convert that string varibale into HashMap?

    Hi
    Can any body pls tell us how to convert from String
    to HashMap
    I have one string str="Col1=200, Col2=225";
    So how can i convert that string varibale into
    HashMap?
    Map map = new HashMap();
    String[] parts = str.split(", ");
    for (int i = 0; i < parts.length; ++i) {
        String[] entry = parts.split("=");
    map.put(entry[0], entry[1]);

  • Failure to read multiline string with Read Key.vi

    I converted 2D array into a spreadsheet string and attempetd to write it as a key value into a configuration file. This worked just fine. However, when I attempted to read this multiline string using Read Key.vi, I got just the first line in return (see two vi's attached).
    As sufficient documentation on configuration file vi's is all but missing, could you please advise on their (undocumented) features? What do I miss?
    Thank you.
    Michael
    Attachments:
    Save_2D_array_in_config_file.vi ‏29 KB
    Read_2D_array_from_config_file.vi ‏31 KB

    Hi Michael,
    MichaelS wrote in news:506500000008000000F7980000-
    [email protected]:
    > I converted 2D array into a spreadsheet string and attempetd to write
    > it as a key value into a configuration file. This worked just fine.
    > However, when I attempted to read this multiline string using Read
    > Key.vi, I got just the first line in return (see two vi's attached).
    I use Config files all the time. Much more user-friendly than the
    Registry. They are a Microsoft thing really, rather than LabView, and
    come from Windows 3.11. Each value is limited to one line, so when you
    write a spreadsheet string with end-of-line characters in it, you're
    effectively breaking the .inf file
    The solution? Try putting a "Search and Replace String
    " after your
    "Array To Spreadsheet String". Wire "Replace All" with a TRUE constant,
    and wire "Search String" with a string in "\" view and enter \r\n (or do
    0A0D in Hex view) and then then wire Replace String with a ";"
    Now your .inf file will look like:
    [Array]
    Data=1.0000,0.0000,0.0000;0.0000,2.0000,0.0000;0.0000,0.0000,3.0000;
    When reading it, just reverse the search and replace strings above.
    I hope this helps,
    Andrew

  • Converting a byte array or hex string  into DES key

    i required to covert a hex represented of DES key into key object for cryptography operation to performed ...
    can you help me to find out how to convert a hex representaion of key int DES key object

    hi friend,
    I think the key size is more than the required size. For DES algorithm, the key size is 64 bit long.But the code u have given has more than 64 bit, because of which this exception has been raised.
    Reduce the key value to 64bit and try. If it doesnt work,try the code given below .I think it might be helpful for u
    import javax.crypto.*;
    import javax.crypto.spec.*;
    public class Cryption
         public byte[] encrypt(byte[] keyData,byte[] clearMessage)
              try
                   SecretKeySpec sks = new SecretKeySpec(keyData,"DES");
                   Cipher c = Cipher.getInstance ("DES");
                   c.init(Cipher.ENCRYPT_MODE,sks);
                   byte[] encryptedMessage = c.doFinal(clearMessage);
                   return encryptedMessage;
              catch(Exception e)
                   e.printStackTrace();
              return null;
         public byte[] decrypt(byte[] keyData,byte[] cipherMessage)
              try
                   SecretKeySpec sks = new SecretKeySpec(keyData,"DES");
                   Cipher c = Cipher.getInstance ("DES");
                   c.init(Cipher.DECRYPT_MODE,sks);
                   byte[] decryptedMessage = c.doFinal(cipherMessage);
                   return decryptedMessage;
              catch(Exception e)
                   e.printStackTrace();
              return null;
         public static void main(String[] args)
              String keyString = "ABCDEF12";
              byte keyValue[] = keyString.getBytes();
              Cryption encryption = new Cryption();
              String Message = "Hello Welcome to world of Cryptography";
              System.out.println("Key Value (represented in HEX form): "+keyString);
              System.out.println("Key Value (represented in byte array form): "+keyValue);
              System.out.println("Original Message : "+Message);
              byte[] encryptedMessage = encryption.encrypt(keyValue,Message.getBytes());
              System.out.println("Encrypted Message : "+new String(encryptedMessage));
              Cryption decryption = new Cryption();
              byte[] decryptedMessage = decryption.decrypt(keyValue,encryptedMessage);
              System.out.println("Decrypted Message : "+new String(decryptedMessage));
    output :
    Key Value (represented in HEX form): ABCDEF12
    Key Value (represented in byte array form): [B@43c749
    Original Message : Hello Welcome to world of Cryptography
    Encrypted Message : "O3�?�M�,����������,�]�3�����R�?>C$
    Decrypted Message : Hello Welcome to world of Cryptography
    whenever u use any algorithm, first findout the key size or range that algorithm supports. It is very important
    regards,
    Deepa Raghuraman

  • List of keys(Strings): ArrayList, HashMap, ...

    Dear all,
    I would like to make a list of keys (Strings) such that each key can be appear only once in the list.
    If I used ArrayList, the uniqueness of key would not garanteed.
    If I used HashMap, it would fine but I did not need store any objects.
    Any better solution?
    Cheers.
    Pengyou

    > I would like to make a list of keys (Strings) such
    that each key can be appear only once in the list.
    If I used ArrayList, the uniqueness of key would not
    garanteed.
    Well you can always use the contains(...) method from the ArrayList first to see if the key already exists.
    > If I used HashMap, it would fine but I did not need
    store any objects.
    I don't understand. An ArrayList also stores the values.

  • Convert String[] to hashMap

    Hi,
    I have a array of strings which i need to convert it in to a hash Map. How should it be done?

    What would be the keys ???
    Suposing that you have the key /value pairs like (i) is the key and (i+1) is the value, create a new hashMap and make a loop putting them in the map.
    myMap.put(myArray, myArray[i+1]);
    If this is not the case... for what do you need a Map anyway ?

  • Vector as a HashMap key

    Hi all, I want to use Vector position as a key of hash map. Do you think that it is work? And could you mind show me some sample code. Thanks!!!

    It'll work. Here's some code that follows. However, in my sample, I'd rather store 'user' as the key to the HashMap. Also, the code below won't allow for the list to be sorted or anything after it is added to the HashMap.
    import java.util.*;
    public class VectorAndHashMap
        static class Preference
            String color;
            String fontSize;
            public Preference(String _color, String _fontSize) {
                color=_color;
                fontSize=_fontSize;
            public String toString() {
                return color+"/"+fontSize;
        public static void main(String[] args)
            Object[] users = {"smith", "brown", "jones"};
            // create the Vector
            Vector v = new Vector(Arrays.asList(users));
            Object[] prefs = { new Preference("blue", "big"),     // smith's
                               new Preference("blue", "small"),   // brown's
                               new Preference("red", "medium") }; // jones's
            // create the HashMap
            HashMap hashmap = new HashMap();
            // load the HashMap
            for(int i=0; i<v.size(); i++)
                hashmap.put(new Integer(i), prefs);
    // lookup index for "brown"
    int j=0;
    boolean found = false;
    for(j=0; j<v.size(); j++) {
    String user = (String)v.get(j);
    if(user.equals("brown")) {
    found = true;
    break;
    // retrieve record
    if(found) {
    Preference pref = (Preference)hashmap.get(new Integer(j));
    System.out.println("brown's record: " + pref);

  • How to get the value in a hashmap with a key of expression "123-456"?

    Hi all,
    I new to java and having a problem with getting values from a hashmap.here is the code which i wrote
    Map map = new HashMap();
    int m = 123;
    int n = 456;
    String key = String.valueOf(m) + "-" + String.valueOf(n);
        map.put(key, true);
        Now i am trying to get the value and i get an exception
    boolean b = map.get(String.valueOf(m) + "-" + String.valueOf(n));Can someone help me how to pass this expression as key in the hashamp

    Hi corlettk,
    Thanks for your reply. I have defined my map as Map<String, Boolean> selectedIds = new HashMap<String, Boolean>();
                selectedIds.put("123-456", true);           
                int m=123; int n=456;
                                     selectedIds.put(String.valueOf(m) + "-" + String.valueOf(n),true);
                boolean viv = selectedIds.get("String.valueOf(m)-String.valueOf(n)");
                System.out.println(viv);
                My problem is the hashmap key must be set dynamically ("123-456" is just an example) and when i get the value i should be able to pass those varibales in an expression correctly. Please let me know how can i pass an expression like the one above as a hashmap key. Please advise.

  • Cannot send a null Map key for type 'java.util.HashMap'

    Hi All,
      I am haing an issue with sending data from Server to the client using the AMF Channel.
      Most of the method invocations on the RemoteObject are throwing the following Exception.
    [CODE]
    (mx.rpc.events::FaultEvent)#0
      bubbles = false
      cancelable = true
      currentTarget = (null)
      eventPhase = 2
      fault = (mx.rpc::Fault)#1
        content = (null)
        errorID = 0
        faultCode = "Server.Processing"
        faultDetail = (null)
        faultString = "Cannot send a null Map key for type 'java.util.HashMap'."
        message = "faultCode:Server.Processing faultString:'Cannot send a null Map key for type 'java.util.HashMap'.' faultDetail:'null'"
        name = "Error"
        rootCause = (null)
      headers = (null)
      message = (mx.messaging.messages::ErrorMessage)#2
        body = (null)
        clientId = "22E55FB1-910E-312F-E37A-ED5167139CB0"
        correlationId = "4DB54224-662A-C596-D165-F7C3EBB64DB8"
        destination = "TimeMap"
        extendedData = (null)
        faultCode = "Server.Processing"
        faultDetail = (null)
        faultString = "Cannot send a null Map key for type 'java.util.HashMap'."
        headers = (Object)#3
        messageId = "22E56255-D62F-2ACF-4DA5-CF1E4D6353BB"
        rootCause = (null)
        timestamp = 1266877198902
        timeToLive = 0
      messageId = "22E56255-D62F-2ACF-4DA5-CF1E4D6353BB"
      statusCode = 0
      target = (null)
      token = (mx.rpc::AsyncToken)#4
        message = (mx.messaging.messages::RemotingMessage)#5
          body = (Array)#6
          clientId = (null)
          destination = "TimeMap"
          headers = (Object)#7
            DSEndpoint = "my-amf"
            DSId = "22E53936-7E0E-B21C-C936-EF1078000306"
          messageId = "4DB54224-662A-C596-D165-F7C3EBB64DB8"
          operation = "getMapKey"
          source = (null)
          timestamp = 0
          timeToLive = 0
        responders = (Array)#8
          [0] (com.universalmind.cairngorm.events::Callbacks)#9
            conflictHandler = (null)
            faultHandler = (function)
            priority = 0
            resultHandler = (function)
        result = (null)
      type = "fault"
    [CODE]
    The Spring bean which is exposed as a Remote Object has the following method signature..
    [CODE]
    public String getMapKey() {
            return mapKey;
    [/CODE]
    I am unable to understand why AMF Channel or Blaze DS is treating the String as HashMap !!!
    This was working pefectly fine till yesterday !!
    The version of the BlazeDS i am using is : blazeds_turnkey_3-0-0-544
    and the Flex SDK Version is : flex_sdk_3.5.0.12683
    We recently upgraded to Flex 3.5.0 version earlier we were using 3.3 version
    Thanks
    mars

    Hi All,
    I chcked my server side java beans ( which are managed by Spring) and they are all returning the data property and none of the Keys in the returned hashmaps are null.
    Not sure why this is happening.
    Thanks
    kumars

  • How to get first item of hashMap w/out knowing the key

    Hi
    can someone tell me if there is a way to get first item from a hashMap when you dont know what the key is. as the get method expects a defined 'key'
    reason I am asking this:
    I am using struts 2 UI <s:radio> tag. this tag takes a hashmap and creates radio maps. it has a 'value' attribute and if something is passed to this attribute then that radio button is checked by default. the list that contains radio buttons is created dynamically so i dont know what is actually in the hashMap key's. but i do know that key's are string.
    so just wondering if there is a way to get first item from a hashmap without knowing the key...

    thanks for the quick reply.
    posted in java forums because thought it was a java API/workaround question. gave a little history because i didnt want people to start questioning my use of HashMap for this purpose..
    anywhose..i've found a workaround.
    If someone has a similar problem:
    as the hashmap is being populated dynamically....set a String member of class to contain the first key thats being put in the hashmap. then have struts tag pick up that value.
    also, through your post and reading hashMap api...its usefull to know that hasMaps do not gurantee the order of elements in it. So now I am using a TreeMap.
    Thanks

  • Duplicate Keys in Hashmap

    The following code and output illustrate the core of my prolems using HashMap. I've created a simple key class wrapping a string and implementing equals, hashcode and compareTo. Entries can only be accessied via iterators and duplicates appear. Using a TreeMap instead works fine, but I need the speed of hashmap for now.:
    import java.util.*;
    import java.io.*;
    import java.awt.event.*;
    import java.awt.*;
    class GenericGraphKey implements Comparable{
    private String val="";
    public GenericGraphKey(String value){ val=value; }
    public boolean equals(GenericGraphKey k){
    System.out.println("equals()");
    return val.equals(k.val);
    public int hashCode() {
    System.out.println("hashCode():"+val.hashCode());
    return val.hashCode();
    public int compareTo(Object o) {
    System.out.println("compareTo()");
    GenericGraphKey n=(GenericGraphKey)o;
    return val.compareTo(n.val);
    public String toString(){ return ("["+val+"]"); }
    public class TestApp {
         public static void main(String[] args) {
    HashMap t=new HashMap();
    System.out.print("A:");
    GenericGraphKey k1=new GenericGraphKey("John");
    System.out.println("Put "+k1+",a :"+(String)t.put(k1,"a") );
    System.out.print("B:");
    GenericGraphKey k2=new GenericGraphKey("John");
    System.out.println("Get "+k2+":"+(String)t.get(k2));
    System.out.print("C:");
    GenericGraphKey k3=new GenericGraphKey("John");
    System.out.println("Put "+k3+",b :"+(String)t.put(k3,"b"));
    System.out.print("D:");
    GenericGraphKey k4=new GenericGraphKey("John");
    System.out.println("Get "+k4+":"+(String)t.get(k4));
    System.out.print("E:");
    GenericGraphKey k5=new GenericGraphKey("Jane");
    System.out.println("Put "+k5+",c :"+(String)t.put(k5,"c"));
    System.out.print("F:");
    GenericGraphKey k6=new GenericGraphKey("Jane");
    System.out.println("Get "+k6+":"+(String)t.get(k6));
    System.out.print("G:");
    GenericGraphKey k7=new GenericGraphKey("Allan");
    System.out.println("Put "+k7+",d :"+(String)t.put(k7,"d"));
    System.out.print("H:");
    GenericGraphKey k8=new GenericGraphKey("Allan");
    System.out.println("Put "+k8+",e :"+(String)t.put(k8,"e"));
    System.out.print("I:");
    GenericGraphKey k9=new GenericGraphKey("Allan");
    System.out.println("Get "+k9+":"+(String)t.get(k9));
    System.out.println();
    Map.Entry e=null;
    for (Iterator i=t.entrySet().iterator(); i.hasNext();){
    e = (Map.Entry) i.next();
    System.out.print("{"+(String)e.getValue()+"}");
    System.out.println();
    System.out.println(t.keySet());
    Output:
    A:hashCode():2314539
    Put [John],a :null
    B:hashCode():2314539
    Get [John]:null
    C:hashCode():2314539
    Put [John],b :null
    D:hashCode():2314539
    Get [John]:null
    E:hashCode():2301262
    Put [Jane],c :null
    F:hashCode():2301262
    Get [Jane]:null
    G:hashCode():63353198
    Put [Allan],d :null
    H:hashCode():63353198
    Put [Allan],e :null
    I:hashCode():63353198
    Get [Allan]:null
    {c}{e}{d}{b}{a}
    [[Jane], [Allan], [Allan], [John], [John]]
    Thanks to anyone who can get things moving on again.

    Hombre below is an illustration of what Chrisboy and jverd are telling you.
    If the parent class has a method with the same signature as one in an interface which the child class implements then your IDE and javac will not say anything about you not haveing implemented the class in the interface.
    The following code compiles and at least Netbeans also has no problems with it.
    public class NewClass
        public NewClass()
        public void someMethod()
    public interface NewInterface
        public void someMethod();
    public class NewClass2 extends NewClass implements NewInterface
        public NewClass2()
    }

Maybe you are looking for

  • How do I boot from an external CD drive?

    On a different thread, I've been reporting problems with my internal HD. When I went to Disk Utility and ran Verify Disk on the HD, I got the error back telling me that the Mac HD needs repairing. Now, to run the repair facility, I seem to have to re

  • How do I restore screen brightness?

    I'm working in Final Cut Pro 7 - my nephew pressed F1 several times causing the screen brightness to dim to nearly black.  What is the keystroke to restore the primary screen (I have dual screen and the secondary screen is 'normal' brightness). Help!

  • Isight firewire extension cable

    I need a 10 foot (or 3 meter) firewire cable that will fit the isight holder. Apple refers to this as a thin firewire and it must be able to snap in the transistion piece between the camera and the stand. Most aftermarket cables are too thick due to

  • Junk mail arrives in iPhone 5s mail app but not MBP mail app

    This is a strange observation and I am wondering if others have experienced this... My iPhone is a 5s running iOS v7.1.  When I access my email accounts via my iPhone each day, I am greeted with a slew of junk mail on a daily basis (typically Monday

  • How to uninstall separate CC Apps

    Hi folks.... Mac Utilities Adobe Installers Uninstall Does not show ALL apps. So how the heck can I uninstall individual CC apps not listed, like Scout CC PLEASE make this simple and straight forward. Adobe should work uninstall into the installer to