/[classpath]/classpath/java/util/Arrays.java
ViewVC logotype

Diff of /classpath/java/util/Arrays.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by ericb, Fri Oct 19 00:17:44 2001 UTC revision 1.12 by ericb, Thu Oct 25 07:34:19 2001 UTC
# Line 391  public class Arrays Line 391  public class Arrays
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;
# Line 425  public class Arrays Line 426  public class Arrays
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;
# Line 451  public class Arrays Line 453  public class Arrays
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;
# Line 493  public class Arrays Line 494  public class Arrays
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;
# Line 526  public class Arrays Line 528  public class Arrays
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;
# Line 559  public class Arrays Line 562  public class Arrays
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;
# Line 593  public class Arrays Line 597  public class Arrays
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;
# Line 627  public class Arrays Line 632  public class Arrays
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;
# Line 661  public class Arrays Line 667  public class Arrays
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;
# Line 2406  public class Arrays Line 2413  public class Arrays
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)
# Line 2423  public class Arrays Line 2427  public class Arrays
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;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26