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 23AAB1009F for ; Thu, 17 Oct 2013 05:24:56 +0000 (UTC) Received: (qmail 89344 invoked by uid 500); 17 Oct 2013 05:24:44 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 89246 invoked by uid 500); 17 Oct 2013 05:24:44 -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 89233 invoked by uid 99); 17 Oct 2013 05:24:43 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Oct 2013 05:24:43 +0000 Date: Thu, 17 Oct 2013 05:24:43 +0000 (UTC) From: "Henri Yandell (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-848) Improve StringUtils.is(Not)Blank with a CharSequence... version 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-848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13797614#comment-13797614 ] Henri Yandell commented on LANG-848: ------------------------------------ My main thought is that the JVM should auto-convert an Iterable to an Object[] for varargs :) Failing that, I think we should have an ArrayUtils.iteratorToArray() method. public static E[] iteratorToArray(Iterator iterator); That would allow for StringUtils.isAnyBlank( ArrayUtils.iteratorToArray(somecharacterList.iterator()) ); I'm not sure if I'm playing too fast and loose with the generics there without trying it :) I think we need the varargs versions of methods, but I'm not convinced by the need for Iterable. It increases the code and typically our code isn't stream based - ie: people in restricted memory situations can create custom versions of the function they want. > Improve StringUtils.is(Not)Blank with a CharSequence... version > --------------------------------------------------------------- > > Key: LANG-848 > URL: https://issues.apache.org/jira/browse/LANG-848 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* > Affects Versions: 3.1 > Reporter: Alexander Muthmann > Fix For: 3.2 > > > Currently it's only possible to compare a single CharSequence per is(Not)Blank/is(Not)Empty call. > This should be changed to support multiple CharSequences in a single call. > {code} > if(StringUtils.isNotBlank(foo) && StringUtils.isNotBlank(bar) && ...) > {code} > could be changed to > {code} > if(StringUtils.isNotBlank(foo, bar, ...) > {code} > As there are two possible ways to combine the results (AND and OR), it'd be necessary to create multiple methods. > {code} > isAnyBlank(CharSequence... cs) > isNoneBlank(CharSequence... cs) > isAnyEmpty(CharSequence... cs) > isNoneEmpty(CharSequence... cs) > {code} > I could implement those methods and contribute them via github if there is any interest from project's side. -- This message was sent by Atlassian JIRA (v6.1#6144)