This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
In arrayEquals we could perhaps simplify/optimize slightly:
String tname1 = arg1.getClass().getName();
String tname2 = arg2.getClass().getName();
// int[].class.getName() returns "[I" etc
if (tname1.length() == 2 && tname2.equals(tname1)) { // matching primitive types
switch (tname1.charAt(1)) {
case 'Z': return Arrays.equals((boolean[]) arg1, (boolean[]) arg2);
... etc ...
}
I'm a little uncertain what the correct behavior should be for edge cases like comparing a String[] to an FString[] in which each pair of elements are equal?. For now, that will return #f because the array component types are not equal (in the Java sense).
I think the result should be #f because the types are different.
OK, that was my suspicion. It makes the implementation a little simpler, too, because I can shortcut the test with
-- Jamison Hope The PTR Group www.theptrgroup.com
Attachment:
IsEqual.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |