#vulnerable code 
                                Optional<List<Chunk>>
            assemble(Map<ChunkReference, Chunk> map, List<ChunkReference> references) {
        if (map.keySet().containsAll(references)) {
            logger.warn("-- assemble() - missing chunks");
            return Optional.empty();
        }

        List<Chunk> chunkList = references.stream()
                .map(map::get)
                .collect(Collectors.toList());
        return Optional.of(chunkList);
    } 
                            #location 4 
                            #vulnerability type INTERFACE_NOT_THREAD_SAFE
#fixed code
                                Optional<Map<ChunkReference, Chunk>>
            fetch(HttpClient httpClient, ChunkKeyEncryptionKeys keks, Map<Integer, StorageHostChunkList> containers,
                    Asset asset) {
        Map<ChunkReference, Chunk> map = new HashMap<>();
        for (Map.Entry<Integer, StorageHostChunkList> entry : containers.entrySet()) {
            Optional<Map<ChunkReference, Chunk>> chunks = keks.apply(entry.getValue())
                    .flatMap(kek -> fetch(httpClient, kek, entry.getValue(), entry.getKey()));
            if (!chunks.isPresent()) {
                return Optional.empty();
            }
            map.putAll(chunks.get());
        }
        return Optional.of(map);
    }