function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HydHyd 

Reg: Maps

Hi,

 

Please send some simple programs to understand map concept?

 

 

Thanks & Regards:

Hyd

 

 

Ryan-GuestRyan-Guest

Do you mean Google Maps or map as in a data sturcutre?

 

If it is google maps, are you looking for something like this:

http://code.google.com/p/salesforce-googlemaps-mashup/

Lucy YuanLucy Yuan

hi

  Map is collection class.  it  is composed of unique key object and value object.

 

i.e  Map<integer , String > mapSample = new Map<integer , String>();

it will like a table below. 

 

---------------------------------

key               value

1                    "hello world"

2                    "hello world"

3                    "hi"

..                     ..

 

----------------------------------

The key for every value should be unique.

there are alreay have many method to get or  every value or key from map.map you can download  the book named "apex_language_reference". it will help you understand it well. 

Pradeep_NavatarPradeep_Navatar

Maps are collections of key-value pairs. The key for a map entry must be a primitive data type, while the value can be a primitive sObject, Apex object, or collection. You can have up to five levels of collections within a map.

 

You can assign key-value pairs to a map when you declare the map, with a syntax of the following :

 

Map<String, String> cityState = new Map<String, String>

{'Toledo' => 'Ohio', 'Chicago' => 'Illinois',

'Ann Arbor' => 'Michigan'}

Maps require the use of methods to retrieve values, and map methods are slightly different

from the common methods used by lists and sets.

 

For more information about methods, go through this link,

 

http://www.salesforce.com/us/developer/docs/apexcode/index.htm