Question: I need to search -2 in my database. But hyphen-minus is a special character for neglation. How can I escape hyphen-minus to find sentences that contains -2 in it.

My query:

```
Message.find({ "$text": { $search: "-2", $caseSensitive: false } })

```

Best

Answer: 
Make a list of the maps and loop over them

```
List<Map<String, RspNotification>> maps = Arrays.asList(
    manageProductOrderCISStore,
    manageAppointmentWWMStore,
    manageAppointmentHWMStore,
    manageAppointmentUnifyStore
    //the rest
);

List<RspNotification> list = new ArrayList<>();
for (Map<String, RspNotification> map : maps) {
    RspNotification notification = map.get(transactionId);
    if (notification != null) {
        list.add(notification);
        return;
    }
}
return list;

```

Which you can simplify further to

```
return Stream.of(
        manageProductOrderCISStore,
        manageAppointmentWWMStore,
        manageAppointmentHWMStore,
        manageAppointmentUnifyStore
        //the rest
    )
    .map(map -> map.get(transactionId))
    .filter(Objects::nonNull)
    .findFirst()
    .map(Collections::singletonList)
    .orElse(Collections.emptyList());

```
Put all these dictionaries in a list. Run a loop that tries to extract the key from each item and add it to a list.