almost:

    public static boolean isEmpty(final CharSequence string)
    {
        return string == null || string.length() == 0 || string.toString().trim().equals("");
    }

so we could also do this:

    public static boolean isEmpty(final CharSequence string)
    {
        return string == null || string.length() == 0 || string.toString().trim().length() == 0;
    }


I am not against these changes or what ever, i am just pointing out that you will not notice these changes in real live. 
I was just reacting to the bug report that there was a 'huge' gain to be made by this change.

johan


On 9/22/06, Manuel Barzi < [EMAIL PROTECTED]> wrote:
> There's also wicket.util.string.Strings#isEmpty
> (http://wicket.sourceforge.net/apidocs/wicket/util/string/Strings.html#isEmpty(java.lang.CharSequence)
> to consider...

Just FYI, what people from Apache does (matching Erik's optimization
proposal ;)... I guess wicket does the same.

[org.apache.commons.lang.StringUtils]

// Empty checks
    //-----------------------------------------------------------------------
    /**
     * <p>Checks if a String is empty ("") or null.</p>
     *
     * <pre>
     * StringUtils.isEmpty (null)      = true
     * StringUtils.isEmpty("")        = true
     * StringUtils.isEmpty(" ")       = false
     * StringUtils.isEmpty("bob")     = false
     * StringUtils.isEmpty ("  bob  ") = false
     * </pre>
     *
     * <p>NOTE: This method changed in Lang version 2.0.
     * It no longer trims the String.
     * That functionality is available in isBlank().</p>
     *
     * @param str  the String to check, may be null
     * @return <code>true</code> if the String is empty or null
     */
    public static boolean isEmpty(String str) {
        return (str == null || str.length() == 0);
    }

(http://www.koders.com/java/fidB29436EC634995BA0A41C5DC97C3F97F549D54B9.aspx?s=apache+%22StringUtils%22 )

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to