commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LANG-266) Wish for StringUtils.join(Collection, *)
Date Mon, 03 Jul 2006 19:04:30 GMT
     [ http://issues.apache.org/jira/browse/LANG-266?page=all ]

Henri Yandell updated LANG-266:
-------------------------------

    Fix Version: 2.3

Seems like a lot to save on 11 characters, though it would add null protecting. 

The modification to String.join needs a bit of investigation, quite the code change in the
patch for something that sounds pretty simple. Could just be whitespace changes, there are
others of those in the patch.

> Wish for StringUtils.join(Collection, *)
> ----------------------------------------
>
>          Key: LANG-266
>          URL: http://issues.apache.org/jira/browse/LANG-266
>      Project: Commons Lang
>         Type: Wish

>     Versions: Nightly Builds
>     Reporter: Stepan Koltsov
>     Priority: Trivial
>      Fix For: 2.3
>  Attachments: commons-lang-join-collection-stepancheg.diff
>
> There is a lack of StringUtils.join(Collection, String) method in commons-lang. Could
you please add it?
> Commons-lang has method join(Iterator, String), however join(Collection, String) is still
useful. Join is used very often, and in most situations it is used with Collection, not with
Iterator, because almost all methods return Collections, not Iterators and a lot of data is
stored as Collections, not as Iterators. The string ".iterator()" has 11 characters while
line for code is only 72 chars. I've found that in my code there are several methods that
could be one line shorter if it was StringUtils.join(Collection, String). Compare:
> // with StringUtils.join(Collection, String)
> return "UNIQUE (" + StringUtils.join(unique.getColumnNames(), ", ") + ")";
> against:
> // without
> Iterator columnNames = unique.getColumnNames().iterator();
> return "UNIQUE (" + StringUtils.join(columnNames, ", ") + ")";
> Motivation is almost same as "Why we have StringUtils.join(Object[], String) while we
could write StringUtils.join(Arrays.asList(array).iterator(), separator)?"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message