391 |
// If they're the same length, test each element |
// If they're the same length, test each element |
392 |
if (a1.length == a2.length) |
if (a1.length == a2.length) |
393 |
{ |
{ |
394 |
for (int i = 0; i < a1.length; i++) |
int i = a1.length; |
395 |
|
while (--i >= 0) |
396 |
if (a1[i] != a2[i]) |
if (a1[i] != a2[i]) |
397 |
return false; |
return false; |
398 |
return true; |
return true; |
426 |
// If they're the same length, test each element |
// If they're the same length, test each element |
427 |
if (a1.length == a2.length) |
if (a1.length == a2.length) |
428 |
{ |
{ |
429 |
for (int i = 0; i < a1.length; i++) |
int i = a1.length; |
430 |
|
while (--i >= 0) |
431 |
if (a1[i] != a2[i]) |
if (a1[i] != a2[i]) |
432 |
return false; |
return false; |
433 |
return true; |
return true; |
453 |
// Quick test which saves comparing elements of the same array, and also |
// Quick test which saves comparing elements of the same array, and also |
454 |
// catches the case that both are null. |
// catches the case that both are null. |
455 |
if (a1 == a2) |
if (a1 == a2) |
456 |
{ |
return true; |
|
return true; |
|
|
} |
|
457 |
|
|
458 |
try |
try |
459 |
{ |
{ |
460 |
// If they're the same length, test each element |
// If they're the same length, test each element |
461 |
if (a1.length == a2.length) |
if (a1.length == a2.length) |
462 |
{ |
{ |
463 |
for (int i = 0; i < a1.length; i++) |
int i = a1.length; |
464 |
|
while (--i >= 0) |
465 |
if (a1[i] != a2[i]) |
if (a1[i] != a2[i]) |
466 |
return false; |
return false; |
467 |
return true; |
return true; |
494 |
// If they're the same length, test each element |
// If they're the same length, test each element |
495 |
if (a1.length == a2.length) |
if (a1.length == a2.length) |
496 |
{ |
{ |
497 |
for (int i = 0; i < a1.length; i++) |
int i = a1.length; |
498 |
|
while (--i >= 0) |
499 |
if (a1[i] != a2[i]) |
if (a1[i] != a2[i]) |
500 |
return false; |
return false; |
501 |
return true; |
return true; |
528 |
// If they're the same length, test each element |
// If they're the same length, test each element |
529 |
if (a1.length == a2.length) |
if (a1.length == a2.length) |
530 |
{ |
{ |
531 |
for (int i = 0; i < a1.length; i++) |
int i = a1.length; |
532 |
|
while (--i >= 0) |
533 |
if (a1[i] != a2[i]) |
if (a1[i] != a2[i]) |
534 |
return false; |
return false; |
535 |
return true; |
return true; |
562 |
// If they're the same length, test each element |
// If they're the same length, test each element |
563 |
if (a1.length == a2.length) |
if (a1.length == a2.length) |
564 |
{ |
{ |
565 |
for (int i = 0; i < a1.length; i++) |
int i = a1.length; |
566 |
|
while (--i >= 0) |
567 |
if (a1[i] != a2[i]) |
if (a1[i] != a2[i]) |
568 |
return false; |
return false; |
569 |
return true; |
return true; |
597 |
// If they're the same length, test each element |
// If they're the same length, test each element |
598 |
if (a1.length == a2.length) |
if (a1.length == a2.length) |
599 |
{ |
{ |
600 |
for (int i = a1.length - 1; i >= 0; i--) |
int i = a1.length; |
601 |
|
while (--i >= 0) |
602 |
if (Float.compare(a1[i], a2[i]) != 0) |
if (Float.compare(a1[i], a2[i]) != 0) |
603 |
return false; |
return false; |
604 |
return true; |
return true; |
632 |
// If they're the same length, test each element |
// If they're the same length, test each element |
633 |
if (a1.length == a2.length) |
if (a1.length == a2.length) |
634 |
{ |
{ |
635 |
for (int i = a1.length - 1; i >= 0; i--) |
int i = a1.length; |
636 |
|
while (--i >= 0) |
637 |
if (Double.compare(a1[i], a2[i]) != 0) |
if (Double.compare(a1[i], a2[i]) != 0) |
638 |
return false; |
return false; |
639 |
return true; |
return true; |
667 |
// If they're the same length, test each element |
// If they're the same length, test each element |
668 |
if (a1.length == a2.length) |
if (a1.length == a2.length) |
669 |
{ |
{ |
670 |
for (int i = 0; i < a1.length; i++) |
int i = a1.length; |
671 |
|
while (--i >= 0) |
672 |
if (! AbstractCollection.equals(a1[i], a2[i])) |
if (! AbstractCollection.equals(a1[i], a2[i])) |
673 |
return false; |
return false; |
674 |
return true; |
return true; |
2413 |
|
|
2414 |
public boolean contains(Object o) |
public boolean contains(Object o) |
2415 |
{ |
{ |
2416 |
for (int i = a.length - 1; i >= 0; i--) |
return lastIndexOf(o) >= 0; |
|
if (equals(o, a[i])) |
|
|
return true; |
|
|
return false; |
|
2417 |
} |
} |
2418 |
|
|
2419 |
public int indexOf(Object o) |
public int indexOf(Object o) |
2427 |
|
|
2428 |
public int lastIndexOf(Object o) |
public int lastIndexOf(Object o) |
2429 |
{ |
{ |
2430 |
for (int i = a.length - 1; i >= 0; i--) |
int i = a.length; |
2431 |
|
while (--i >= 0) |
2432 |
if (equals(o, a[i])) |
if (equals(o, a[i])) |
2433 |
return i; |
return i; |
2434 |
return -1; |
return -1; |