Map<String, Object> extendParam =
alertMap.entrySet().stream()
.filter(map -> "labels".equals(map.getKey()) || "annotations".equals(map.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
上述代碼是,獲取map中指定的key的map集合。也就是將不是labels和annotations 鍵的數據剔除出去,組成新的map。