Here you can find the source of joinStringValues(Collection
private static Collection<Object> joinStringValues(Collection<Object> values)
//package com.java2s; /* $This file is distributed under the terms of the license in /doc/license.txt$ */ import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main { /**//w ww . ja va 2s . c om * Join the String values while preserving the non-String values. It * shouldn't affect the score, and it produces better snippets. */ private static Collection<Object> joinStringValues(Collection<Object> values) { StringBuilder buffer = new StringBuilder(); List<Object> betterValues = new ArrayList<>(); for (Object value : values) { if (value instanceof String) { if (buffer.length() > 0) { buffer.append(" "); } buffer.append((String) value); } else { betterValues.add(value); } } if (buffer.length() > 0) { betterValues.add(buffer.toString()); } return betterValues; } }