Submitted On 05-MAR-2007
miiken
This is in progress for 3 years now...
PLEASE add this to next release
Submitted On 28-MAR-2007
This is a really simple enhancement that is done over and over in many external libraries. It's about time that it gets done...
Submitted On 03-JUL-2008
Please add this feature!
Submitted On 03-JUL-2008
http://forum.java.sun.com/thread.jspa?threadID=5310610&tstart=0
Submitted On 17-JUL-2008
Sch104
Yes it is a simple feature that is done in many external libraries. It would be quite simple to add and there really isn't a reason to not have it.
Submitted On 02-OCT-2008
gforman
Don't just accept a list of Strings, make it more general:
join(CharSequence delim, **Collection/Iterable** list)
.toString() will be called on each object in the list.
Submitted On 22-DEC-2008
tstyblo
public static <T> String joinCollection (final Collection<T> objs, String delimiter)
{
if (objs == null || objs.isEmpty())
return "";
Iterator<T> iter = objs.iterator();
StringBuffer buffer = new StringBuffer(iter.next().toString());
while (iter.hasNext())
buffer.append(delimiter).append(iter.next().toString());
return buffer.toString();
}
Submitted On 19-JAN-2009
ivarru
I propose the following implementation, which is both more general and slightly optimized w.r.t. joining one element collections:
public static String join(Object delimiter, Iterable<?> elements) {
final Iterator<?> it;
if (elements == null || !(it = elements.iterator()).hasNext()) {
return "";
}
final String first = it.next().toString();
if (!it.hasNext()) {
return first;
}
final StringBuilder result = new StringBuilder(first);
do {
result.append(delimiter)
.append(it.next());
} while (it.hasNext());
return result.toString();
}
public static String join (Object delimiter, Object... elements) {
return join(delimiter, Arrays.asList(elements));
}
Submitted On 29-MAY-2009
MartinHilpert
We badly need high performance string concatenation in Java!
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|