+ Start a Discussion
Michael MMichael M 

How to fetch items from Map<Date, SeekExtension.DataWrapper>

Hello, I have a class called SeekExtension, in which there is a datawrapper class like this Public Class DataWrapper{
String toDate;
String NPI;
String locationType;    

In that class, I have instantiated some DataWrapper class instances and added to a map like this: Map<Date, DataWrapper>.

Now, I have a second class in which I am calling those maps. My questoin is, how can I fetch the details of the DataWrapper class from those Maps? E.g. I want to see the toDate string and the NPI string. How can I get those when my map is my starting point?
Best Answer chosen by Michael M
Suraj Tripathi 47Suraj Tripathi 47

Hi Michael,

Once your map is filled then after iterating over the map of keyset you can get the values. You can take reference from the below code.

SeekExtension.DataWrapper obj=new SeekExtension.DataWrapper();
        Map<Date, SeekExtension.DataWrapper> MapName=new Map<Date, SeekExtension.DataWrapper>();
        for(Date d:MapName.keySet()){
            system.debug('toDate::::: '+MapName.get(d).toDate);
            system.debug('NPI::::: '+MapName.get(d).NPI);

Please let me know it is working or not?

If it helps you please mark it as Best Answer so that other people would take reference from it.

Thank You!