code: public static Map<HeaderName<?>, Object> copyFromStream(@Nullable final Stream<Map.Entry<HeaderName<?>, Object>> stream) {
          Map<HeaderName<?>, Object> headerMap;
  
          if (stream == null) {
              headerMap = new HashMap<>();
          } else {
              headerMap = stream.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
          }
  
          return headerMap;
      }
docs: Creates a new map, by picking all header entries from the
  provided stream.