FWIW, Java 8 also comes with a String joiner. On Tue, Jan 12, 2016 at 12:44 AM, Colin Patrick McCabe <rarecac...@gmail.com > wrote:
> Guava is a good library, but it has had some versioning issues in the > past. I don't see why we shouldn't just use the hadoop util version or a > stringbuilder, as appropriate. > > Best, > Colin > On Dec 22, 2015 1:56 PM, "dam6923 ." <dam6...@gmail.com> wrote: > > > Hello! > > > > 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? > > > > Thanks. > > >