CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: How to use Map

  1. #1
    Join Date
    May 2012
    Location
    Australia
    Posts
    15

    How to use Map

    I need to use Java 1.4 Map. But no templates. How to use it? What is objects?

    -----------------------------------------------------------
    Defence Science and Technology Organisation (DSTO)

  2. #2
    Join Date
    Nov 2006
    Location
    Barcelona - Catalonia
    Posts
    364

    Re: How to use Map

    There are no templates in Java 1.4, which are called 'Generics'. They are part of Java 1.5.

    What do you mean by "What is objects?"? There are thousands of sites to find out how to use a Map.
    Anyway, a simple example:
    Code:
    // Create
    Map myMap = new HashMap();
    
    // Set data
    myMap.put("1", "One");
    myMap.put("2", "Two);
    myMap.put("3", "Three");
    
    //Get data
    String name = (String) myMap.get("1");
    [...]
    Albert.
    Please, correct me. I'm just learning.... and sorry for my english :-)

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured