Source:
<code>Map<String, MessageAttributeValue> translateAttributes(Map<String, Object> headers, Exchange exchange) { Map<String, MessageAttributeValue> result = new HashMap<>(); HeaderFilterStrategy headerFilterStrategy = getEndpoint().getHeaderFilterStrategy(); for (Entry<String, Object> entry : headers.entrySet()) { if (!headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), exchange)) { Object value = entry.getValue(); if (value instanceof String && !((String)value).isEmpty()) { MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("String"); mav.withStringValue((String)value); result.put(entry.getKey(), mav); } else if (value instanceof ByteBuffer) { MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("Binary"); mav.withBinaryValue((ByteBuffer)value); result.put(entry.getKey(), mav); } else if (value instanceof Date) { MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("String"); mav.withStringValue(value.toString()); result.put(entry.getKey(), mav); } else if (value instanceof List && ((List) value).size()>0) { String delimiter = "\", \"", prefix = "[\"", suffix = "\"]"; MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("String.Array"); <START> mav.withStringValue((String) ((List)value).stream().map(Object::toString).collect(Collectors.joining(delimiter, prefix, suffix))); <END> result.put(entry.getKey(), mav); } else { log.warn("Cannot put the message header key={}, value={} into Sns MessageAttribute", entry.getKey(), entry.getValue()); } } } return result; }</code><technical_language>If cast List<?> instead of raw List, compiler warning disapear need cast String</technical_language>

Target:
Map<String, MessageAttributeValue> translateAttributes(Map<String, Object> headers, Exchange exchange) { Map<String, MessageAttributeValue> result = new HashMap<>(); HeaderFilterStrategy headerFilterStrategy = getEndpoint().getHeaderFilterStrategy(); for (Entry<String, Object> entry : headers.entrySet()) { if (!headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), exchange)) { Object value = entry.getValue(); if (value instanceof String && !((String)value).isEmpty()) { MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("String"); mav.withStringValue((String)value); result.put(entry.getKey(), mav); } else if (value instanceof ByteBuffer) { MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("Binary"); mav.withBinaryValue((ByteBuffer)value); result.put(entry.getKey(), mav); } else if (value instanceof Date) { MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("String"); mav.withStringValue(value.toString()); result.put(entry.getKey(), mav); } else if (value instanceof List) { String resultString = ((List<?>) value).stream() .map(o -> o instanceof String ? String.format("\"%s\"", o) : Objects.toString(o)) .collect(Collectors.joining(", ")); MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("String.Array"); mav.withStringValue("[" + resultString + "]"); result.put(entry.getKey(), mav); } else { log.warn("Cannot put the message header key={}, value={} into Sns MessageAttribute", entry.getKey(), entry.getValue()); } } } return result; }