@Test public void expandHeaders_NoHeadersGiven_ShouldExpandToEmptyMap() { Map<String, String> flatHeaders = new HashMap<>(); Map<String, List<String>> expandedHeaders = expandHeaders(flatHeaders); assertEquals(ImmutableMap.of(), expandedHeaders); }
public static Map<String, List<String>> expandHeaders(Map<String, String> headers) { return headers.entrySet().stream() .filter(h -> h.getKey() != null) .filter(h -> h.getValue() != null) .collect(Collectors.collectingAndThen( Collectors.toMap( Map.Entry::getKey, HeaderUtils::expandHeaders), Collections::unmodifiableMap)); }
HeaderUtils { public static Map<String, List<String>> expandHeaders(Map<String, String> headers) { return headers.entrySet().stream() .filter(h -> h.getKey() != null) .filter(h -> h.getValue() != null) .collect(Collectors.collectingAndThen( Collectors.toMap( Map.Entry::getKey, HeaderUtils::expandHeaders), Collections::unmodifiableMap)); } }
HeaderUtils { public static Map<String, List<String>> expandHeaders(Map<String, String> headers) { return headers.entrySet().stream() .filter(h -> h.getKey() != null) .filter(h -> h.getValue() != null) .collect(Collectors.collectingAndThen( Collectors.toMap( Map.Entry::getKey, HeaderUtils::expandHeaders), Collections::unmodifiableMap)); } private  HeaderUtils(); }
HeaderUtils { public static Map<String, List<String>> expandHeaders(Map<String, String> headers) { return headers.entrySet().stream() .filter(h -> h.getKey() != null) .filter(h -> h.getValue() != null) .collect(Collectors.collectingAndThen( Collectors.toMap( Map.Entry::getKey, HeaderUtils::expandHeaders), Collections::unmodifiableMap)); } private  HeaderUtils(); static Map<String, String> flattenHeaders(Map<String, List<String>> headers); static Map<String, String> flattenHeaders(Map<String, List<String>> headers,
			Predicate<String> headerNameFilter); static Map<String, List<String>> expandHeaders(Map<String, String> headers); }
HeaderUtils { public static Map<String, List<String>> expandHeaders(Map<String, String> headers) { return headers.entrySet().stream() .filter(h -> h.getKey() != null) .filter(h -> h.getValue() != null) .collect(Collectors.collectingAndThen( Collectors.toMap( Map.Entry::getKey, HeaderUtils::expandHeaders), Collections::unmodifiableMap)); } private  HeaderUtils(); static Map<String, String> flattenHeaders(Map<String, List<String>> headers); static Map<String, String> flattenHeaders(Map<String, List<String>> headers,
			Predicate<String> headerNameFilter); static Map<String, List<String>> expandHeaders(Map<String, String> headers);  }