diff --git a/src/classes/Collection.cls b/src/classes/Collection.cls index 777855d..7cfe276 100644 --- a/src/classes/Collection.cls +++ b/src/classes/Collection.cls @@ -534,12 +534,11 @@ public inherited sharing class Collection { private Map> groupNodesByField() { final Map> values = new Map>(); for (PredicateNode predicateNode : predicateNodes) { - List nodes = values.get(predicateNode.field); - if (nodes == null) { - nodes = new List(); - values.put(predicateNode.field, nodes); + if (values.containsKey(predicateNode.field) { + values.get(predicateNode.field).add(predicateNode); + } else { + values.put(predicateNode.field, new List{ predicateNode }); } - nodes.add(predicateNode); } return values; } @@ -693,4 +692,4 @@ public inherited sharing class Collection { } public class CollectionException extends Exception { } -} \ No newline at end of file +}