commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <>
Subject [jira] [Commented] (LANG-701) StringUtils join with var args
Date Thu, 08 Nov 2012 17:58:12 GMT


Gary Gregory commented on LANG-701:

Let's review what we have:

join(Iterable<?>, char)
join(Iterable<?>, String)
join(Iterator<?>, char)
join(Iterator<?>, String)
join(Object[], char)
join(Object[], char, int, int)
join(Object[], String)
join(Object[], String, int, int)

The first arg is always the collection.

Instead, you want the collection to come last in order to use var args.

Matt's suggestion is sensible, a new API name would avoid confusion. I would use the term
"separated" instead of "delimited" though because:
- It is consistent with our current use of "separator" as parameter name in the current method.
- It dovetails nicely with concepts like CSV, Comma Separated Values.

> StringUtils join with var args
> ------------------------------
>                 Key: LANG-701
>                 URL:
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Gabriele Kahlout
>            Priority: Minor
>             Fix For: 3.x
>         Attachments:
> <code>
> final String apple = "apple";
>         final String banana = "banana";
>         final String orange = "orange";
>         final String expected = apple +  SPACE + banana + SPACE + orange;
>         final String  actual = join(SPACE, apple, banana, orange);
>         final int expLength = expected.length();
>         final int actLength = actual.length();
>         assertEquals(expLength, actLength);
>         assertEquals(expected, actual);
> </code>
> I missed the functionality of joining strings with the space separator in one line. BTW,
why space ' ' not a constant field anywhere?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message