Array equality, comparison and mismatch

Chris Hegarty chris.hegarty at oracle.com
Tue Oct 6 08:58:06 UTC 2015


On 6 Oct 2015, at 09:50, Paul Sandoz <paul.sandoz at oracle.com> wrote:

>> 
>> On 5 Oct 2015, at 17:35, Chris Hegarty <chris.hegarty at oracle.com> wrote:
>> 
>> Paul,
>> 
>> On 22/09/15 17:30, Paul Sandoz wrote:
>>> Hi,
>>> 
>>> Please review the following which adds methods to Arrays for performing equality, comparison and mismatch:
>>> 
>>>  https://bugs.openjdk.java.net/browse/JDK-8033148
>>>  http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8033148-Arrays-lexico-compare/webrev/
>>>  http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8033148-Arrays-lexico-compare/specdiff/overview-summary.html
>> 
>> This looks very good.
>> 
>> I know that there has been some discussion already about the behavior when passed null, but it seems a little unfortunate that the range accepting 'equals' methods don't behave in a similar manner to that of the non-range 'equals' methods. But I do accept that it makes little sense, where would the from/to indices come from. So I think NPE makes sense for these.
>> 
> 
> Note that this consistent with other range accepting methods, such as on Arrays or Spliterators (which also usually throw null on the non-range methods too, i wish we could be consistent in that aspect).

Right. 

>> It was not immediately obvious to me that the common prefix can be 0. Should this be called out specifically?
>> 
> 
> When reading the documentation of compare or mismatch or both?

mismatch.  But maybe this is just me.

-Chris.




More information about the core-libs-dev mailing list