Thread: Question about HashMaps

Results 1 to 5 of 5
  1. #1 Question about HashMaps 
    Apple Computers
    Bridget7298's Avatar
    Join Date
    Aug 2007
    Age
    32
    Posts
    1,088
    Thanks given
    99
    Thanks received
    49
    Rep Power
    219
    Hey I have a quick question but HashMaps... Ok here is all the information that has to do with my HashMap:
    Code:
    public Map<Integer, String> sms = new HashMap<Integer, String>(5);
    
    sms.put(0, "Welcome to Classic PimpScape PvP!");
    sms.put(1, "Train in the training room, ancients is in the tab");
    sms.put(2, "to the left of the frends list.");
    sms.put(3, "Training takes 5 minutes at longest.");
    sms.put(4, "Have Fun!");
    sms.get(3);
    for(String s : sms.values()) {
    System.out.println(s);
    }
    What I'm doing here is trying to make make my client.java smaller by getting rid of unneeded text, so i created a HashMap. The question is would this work:
    Code:
    sendMessage(" + sms.get(0) + ");
    So basically the
    Code:
    sms.put(0, "Welcome to Classic PimpScape PvP!");
    would appear where I added the
    Code:
    sendMessage(" + sms.get(0) + ");
    ?

    The reason I'm not trying it is because I'm at school and can't access my server files.
    Reply With Quote  
     

  2. #2  
    Brown
    Guest
    Pretty sure that would work, but it would only make your client.java bigger, rofl.
    Reply With Quote  
     

  3. #3  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,871
    Thanks given
    1,854
    Thanks received
    4,745
    Rep Power
    5000
    Yeah

    Attached image

    Reply With Quote  
     

  4. #4  
    Apple Computers
    Bridget7298's Avatar
    Join Date
    Aug 2007
    Age
    32
    Posts
    1,088
    Thanks given
    99
    Thanks received
    49
    Rep Power
    219
    how so?
    Reply With Quote  
     

  5. #5  
    Question about HashMaps



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    Yeh that works but don't over use them as lots of for loops will eat your mem.

    Attached image
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •