Skip to main content
I have requirement where I need to create a map with values can be either string or Integer. Could someone please let me know how to approach?
5 answers
  1. Nov 20, 2019, 6:08 AM
    Hi naveen,

    I have gone through your problem please refer bellow code:

    Apex class:- 

    public class TestMap {

        public static void maptest(){

            Map<Integer,String> lmap=new Map<Integer,String>();

            lmap.put(1,'Abc');

            lmap.put(2,'XYZ');

            System.debug(lmap);

        }

    }

    I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

    Thanks and Regards,

    Deepali Kulshrestha

    www.kdeepali.com
0/9000