Question: I have a Map and a HashSet.
The goal is to check the contents of the Set against the Map and add it to the Map if the elements are there in the HashSet but not in the Map. 

```
// Map is defined in a class 
private final Map<String, A> sb = new ConcurrentHashMap<>();

public void someMethod() {
    Set<A> hSet = new HashSet<>();
    for (A a : ab){
        hSet.add(a..a...);

        // Check if all elements added to hash Set are there in a Map 
        // if not present, add it to Map 
    }
}

```

Answer: 
```
for (String element : hSet) {
    if (!sb.containsKey(element)) {
        sb.put(element, A);
    }
}

```
Following could also be solution:

```
private final Map<String, A> sb = new ConcurrentHashMap<>();

public void someMethod() {
        Set<String> set = new HashSet<>();
        set.stream().filter(word -> !sb.containsKey(word))
                .forEach(word -> sb.put(word, correspondingValueOfTypeA));
    }

```