I have one application where I process messages from Kafka, in the object that I receive from the Kafka, I have one value that is basically ID, after each Kafka message I have to process message in the following way:
- use that id value to check if it is in the IDs list
- if it is not in the list, then I add that id to the list and process it
I wonder whether instead of saving id to the list it would be more efficient to save it in the hashmap and then check whether there exist particular key in the hash map, instead of checking whether there is id in the list