hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dam6923 ." <dam6...@gmail.com>
Subject Joining Strings
Date Tue, 22 Dec 2015 21:56:21 GMT

I have been looking through some of the Hadoop code and I see that
there are (at least) four different ways used to join a collection of
Strings with a delimiter:

1) org.apache.hadoop.util.StringUtils.join(...)
2) org.apache.commons.lang.StringUtils.join(...)
3) com.google.common.base.Joiner
4) Manual - StringBuilder/For-Loop

This question came to me when I was looking to replace some instances
of "Manual" with a library approach.  Is there a preferred way of
doing it?  The Hadoop StringUtils did not have the signature I was
looking for: StringUtils.join(Object[]).  However, Apache Commons and
Google Guava both support the signature.

I imagine one would want to "Eat their own dog food" and use the
Apache Commons library, however, there would be some issues on the
import list, trying to user two classes with the same name.  Should I
bring over the required Join methods from Apache Commons and place
them into the Hadoop library?  Should we be using the Joiner?


View raw message