IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Java
Search Java Group:

Advanced
-Collapse +Expand Java To/From
To/FromCODEGuides
-Collapse +Expand Java Store
PRESTWOODSTORE

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingJavaStandard JavaLanguage Det...   Print This     
  From the March 2009 Issue of Prestwood eMag
 
Java Language Details:
Java Associative Array (HashMap())
 
Posted 16 years ago on 11/4/2008 and updated 1/20/2009
Java Code Snippet:
 A flashcard from our Java Flashcards Library
 A code snippet from our Java Code Snippets Page

KB101515

General Info: Associative Array

A set of unique keys linked to a set of values. Each unique key is associated with a value. Think of it as a two column table. MyArray['CA'] = 'California' MyArray['AR'] = 'Arizona'

Languages Focus: Associative Array

Associative arrays are also known as a dictionary or a hash table in other languages.

Java Associative Array

An associative array links a set of keys to a set of values. In Java, associative arrays are implemented as Maps.

This will print "Arizona."

Syntax Example:
import java.util.*;

public class Maps
{
    public static void main(String[] args)
    {
        Map states = new HashMap();
       
        states.put("CA", "California");
        states.put("FL", "Florida");
        states.put("AZ", "Arizona");

        System.out.println(states.get("AZ"));
    }
}


About Associative Array
A set of unique keys linked to a set of values. Each unique key is associated with a value. Think of it as a two column table. MyArray['CA'] = 'California' MyArray['AR'] = 'Arizona'

More Info

Definition:  Associative Array
Code:  Associative Arrays in Java (a Map)

Comments

1 Comments.
Share a thought or comment...
First Comment
Comment 1 of 4

Get the best treatment from the doctors of the best heart care hospital. Even check more facilities from the given link to get information about the best heart care in Kurukshetra.

Best Heart Care In Kurukshetra

Best Knee Replacement in Kurukshetra

Best Ortho And Joint Centre In Kurukshetra

Posted 32 months ago

Comment 2 of 4

I am sure that the information you provide here will benefit many people, I appreciate such information sharing, there is a game that I can recommend to you if you have some time, basketball legends game, this game will allow you to have a good time and make you happy.

Posted 28 months ago

Comment 3 of 4

The vast selection of fun games available on the internet is a major source of relaxation for us. Every hour on the hour, I take a break from work to play run 3, an excellent endless runner game.

Posted 23 months ago

Latest Comment
Comment 4 of 4

suika game provides the convenience of playing without the need for download accessible directly from the browser on PC. This not only enhances the user experience but also allows for quick gameplay with a stable internet connection.

Posted 11 months ago
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P161A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101515 Counter
31783
Since 11/4/2008
Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]