String (List<CharSequence> list) { StringBuilder sb = new StringBuilder(); Set<CharSequence> uniqueValues = new HashSet<>(); boolean first = true; for (CharSequence charSequence : list) { if (first) { first = false; continue; } if (uniqueValues.add(charSequence)) { sb.append(charSequence); } } return sb.toString(); }