Hot answers tagged

3 votes

Is it possible to use a date range as map's key and then use a date to find the entry?

tl;dr: You're gonna have a loop one way or another, be it explicit or implicit. The long version It could at least in in theory be done, but neither the Map class nor any Object nor SObject support ...
user avatar
  • 49.6k
1 vote

Map optimization

Generally speaking, you can't. If you have a nested collection like a List<List<Object>> or Map<String, Map<String, Object>>, using a nested loop is the sensible way to get ...
user avatar
  • 49.6k
1 vote

How do I relate this map to the parent object?

Answering the question as asked You just need an additional layer of nesting in your collection. Instead of a Map<String, List<contact>>, you could use a Map<Id, Map<String, List<...
user avatar
  • 49.6k

Only top scored, non community-wiki answers of a minimum length are eligible