Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C4E36DB6D for ; Fri, 9 Nov 2012 17:46:13 +0000 (UTC) Received: (qmail 59935 invoked by uid 500); 9 Nov 2012 17:46:12 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 59843 invoked by uid 500); 9 Nov 2012 17:46:12 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 59834 invoked by uid 99); 9 Nov 2012 17:46:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Nov 2012 17:46:12 +0000 Date: Fri, 9 Nov 2012 17:46:12 +0000 (UTC) From: "Matt Benson (JIRA)" To: issues@commons.apache.org Message-ID: <1240266610.92654.1352483172625.JavaMail.jiratomcat@arcas> In-Reply-To: <2081536002.33622.1305996407898.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (LANG-701) StringUtils join with var args MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494155#comment-13494155 ] Matt Benson commented on LANG-701: ---------------------------------- The current {{join}} APIs allow Objects for greatest ease. Often the user may want a quick way to format several objects into a delimited String. The whole {{joinWith}} approach seems to be feinting in the fluent direction of which several of us, myself included, seem to have become so fond. Possible approaches include forgetting about the {{boolean}} parameter as Gary suggests; Another possibility could be making it the first argument in the overloaded form in which it appears. This seems to obscure the semantic intent of the method, however (IMO, boolean arguments often do). I am inclined to do the following: * forget about the end separator... I'll come back to this. * create similar APIs in {{StringUtils}} and {{StrBuilder}} to handle joins with varargs: ** {{StrBuilder#appendAllWith(String separator, T... objects)}} doesn't necessarily make sense; I might therefore prefer to reintroduce {{WithSeparator}} for consistency across both APIs * if a user needs the end separator as well, just use {{new StrBuilder().appendAllWithSeparator(separator, ...).append(separator)}} Thoughts? > StringUtils join with var args > ------------------------------ > > Key: LANG-701 > URL: https://issues.apache.org/jira/browse/LANG-701 > Project: Commons Lang > Issue Type: New Feature > Components: lang.* > Reporter: Gabriele Kahlout > Priority: Minor > Fix For: 3.x > > Attachments: VarArgJoinTest.java > > > > 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); > > 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: http://www.atlassian.com/software/jira