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 ...
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 ...
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<...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
map × 845apex × 597
list × 138
trigger × 112
visualforce × 91
soql × 74
json × 42
set × 34
sobject × 33
collection × 33
lightning-aura-components × 31
loop × 31
javascript × 27
query × 18
lightning-web-components × 17
wrapper-class × 16
deserialize × 16
unit-test × 15
class × 15
bulkification × 15
before-trigger × 14
custom-object × 13
controller × 13
batch × 12
repeat × 12