Using hashmaps with longs

Discussion in 'Plugin Development' started by Mike111177, Jun 9, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Mike111177

    Code:
    Map<String, > myMap = new HashMap<String, >();
    long time = new Date().getTime();
    
    Thats all i got. does anyone know how to fill the blanks.
     
  2. Use "Long" in generics, that's the auto-boxed type of the primitive "long".
    You should read about auto-boxing, it's kind of important when working with Java.
     
  3. Offline

    gjossep

    Im not sure on what exactly want but....
    PHP:
    Map<StringLongmyMap = new HashMap<StringLong>();
    long time = new Date().getTime();
    myMap.put("Time"time);
    Hope that helps! Message if you need help!
     
  4. Offline

    Mike111177

    Ill read up on it
    That is very useful Thankyou!

    no how do i recieve the time back out of it?
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  5. Offline

    gjossep

    You can do:
    Code:
    myMap.get("Time");
    Hope it helps!
     
Thread Status:
Not open for further replies.

Share This Page