[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] Commented: (LANG-238) [lang] Add equals(type[]) to
From:       "Henri Yandell (JIRA)" <jira () apache ! org>
Date:       2006-12-31 19:52:22
Message-ID: 32991821.1167594742343.JavaMail.jira () brutus
[Download RAW message or body]

    [ http://issues.apache.org/jira/browse/LANG-238?page=comments#action_12461587 ] 
            
Henri Yandell commented on LANG-238:
------------------------------------

Trying again: 

NumberUtils.

public boolean allEqual( <T>[] array )  for  T = long, int, short, byte

public boolean allEqual( <T>[] array, T error ) for T = float, double

BooleanUtils.

public boolean allEqual( boolean[] array )
// allTrue and allFalse worth having? They seem useful.

ObjectUtils.

public boolean allEqual( Object[] array )  [uses .equals()]

----

equals(...) seems a dangerous name to choose, so I did allEqual(...) above.

The contract from min(...) would imply that an IllegalArgumentException should be \
thrown for:

allEqual( null )
allEqual( new int[0] )

I imagine that allEqual( new int[] { i } ) would be considered true rather than \
throwing an exception; except for the case of Double.NaN and Float.NaN.

Should the double/float alternatives have an error value? 



> [lang] Add equals(type[]) to NumberUtils
> ----------------------------------------
> 
> Key: LANG-238
> URL: http://issues.apache.org/jira/browse/LANG-238
> Project: Commons Lang
> Issue Type: Improvement
> Affects Versions: Nightly Builds
> Environment: Operating System: other
> Platform: Other
> Reporter: Paul Benedict
> Priority: Minor
> Fix For: 3.0
> 
> 
> It would be useful to add an equals() method like the current min and max
> methods which take an array type and determine if all the values are equal.
> I have found myself in need of this often. I have to retrieve objects from
> multiple data sources in parallel to build an array of complex object. To ensure
> validity, I always compare that my sub-retrievals returned the same number of
> objects as expected.

-- 
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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic