• Christopher Smith 81
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I need to print in O/P of  Stored values in Keys & Associated values line by line of Map function.

o/p required :

the current key =98
the current value for above key = Robert

What enhancement should i do to achieve o/p?

Code :

//Declare Map Variable & Show key Values, Values & Check if it is empty or not.

Map<integer, String> VarMapOfEmployeeMobileNum= New Map <integer, String>();

//add some items
VarMapOfEmployeeMobileNum.put(98,'Robert');
VarMapOfEmployeeMobileNum.put(64,'Matthew');
VarMapOfEmployeeMobileNum.put(55,'Harry');

//to see the map
System.debug('The current map ='+VarMapOfEmployeeMobileNum);


//Collect all Keys and Show 1 By 1
set<Integer> VarTempSet = new set<Integer>();
VarTempSet = VarMapOfEmployeeMobileNum.keyset();
for (integer VarMobileSetPrint: VarTempSet)
{
    system.debug('The Current Key ='+VarMobileSetPrint);
}

//Collect all Values and Show 1 By 1
List<String> VarTempList = new List<String>();
VarTempList = VarMapOfEmployeeMobileNum.Values();
for (string VarMobileListPrint: VarTempList)
{
    system.debug('The Current Value for above Key ='+VarMobileListPrint);
}
 
Build a Conference Management App --> Create an Aura Component

I have tried to Copy/Paste using CTRL+C and CTRL+V, using the mouse copy/paste functions and also writing the code manually but all attempts fail. Are there any other ways of copying the text so I can complete this challenge ?