harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r417916 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util: Arrays.java Collections.java
Date Thu, 29 Jun 2006 01:42:48 GMT
Author: ndbeyer
Date: Wed Jun 28 18:42:47 2006
New Revision: 417916

URL: http://svn.apache.org/viewvc?rev=417916&view=rev
Log:
Add override, suppress warnings annotations and misc code cleanup.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java?rev=417916&r1=417915&r2=417916&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
Wed Jun 28 18:42:47 2006
@@ -39,6 +39,7 @@
             a = storage;
         }
 
+        @Override
         public boolean contains(Object object) {
             if (object != null) {
                 for (E element : a) {
@@ -56,6 +57,7 @@
             return false;
         }
 
+        @Override
         public E get(int location) {
             try {
                 return a[location];
@@ -64,6 +66,7 @@
             }
         }
 
+        @Override
         public int indexOf(Object object) {
             if (object != null) {
                 for (int i = 0; i < a.length; i++) {
@@ -81,6 +84,7 @@
             return -1;
         }
 
+        @Override
         public int lastIndexOf(Object object) {
             if (object != null) {
                 for (int i = a.length - 1; i >= 0; i--) {
@@ -98,6 +102,7 @@
             return -1;
         }
 
+        @Override
         public E set(int location, E object) {
             try {
                 E result = a[location];
@@ -110,14 +115,17 @@
             }
         }
 
+        @Override
         public int size() {
             return a.length;
         }
 
+        @Override
         public Object[] toArray() {
             return a.clone();
         }
 
+        @Override
         @SuppressWarnings("unchecked")
         public <T> T[] toArray(T[] contents) {
             int size = size();
@@ -344,8 +352,9 @@
      *                not implement Comparable, or cannot be compared to each
      *                other
      */
+    @SuppressWarnings("unchecked")
     public static int binarySearch(Object[] array, Object object) {
-        Comparable key = (Comparable) object;
+        Comparable<Object> key = (Comparable<Object>) object;
         int low = 0, mid = 0, high = array.length - 1, result = 0;
         while (low <= high) {
             mid = (low + high) >> 1;
@@ -2176,6 +2185,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     private static void sort(int start, int end, Object[] array) {
         int middle = (start + end) / 2;
         if (start + 1 < middle) {
@@ -2188,7 +2198,7 @@
             return; // this case can only happen when this method is called by
         }
         // the user
-        if (((Comparable) array[middle - 1]).compareTo(array[middle]) <= 0) {
+        if (((Comparable<Object>) array[middle - 1]).compareTo(array[middle]) <=
0) {
             return;
         }
         if (start + 2 == end) {
@@ -2200,7 +2210,7 @@
         int i1 = start, i2 = middle, i3 = 0;
         Object[] merge = new Object[end - start];
         while (i1 < middle && i2 < end) {
-            merge[i3++] = ((Comparable) array[i1]).compareTo(array[i2]) <= 0 ? array[i1++]
+            merge[i3++] = ((Comparable<Object>) array[i1]).compareTo(array[i2]) <=
0 ? array[i1++]
                     : array[i2++];
         }
         if (i1 < middle) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java?rev=417916&r1=417915&r2=417916&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
Wed Jun 28 18:42:47 2006
@@ -58,7 +58,8 @@
 		}
 	}
 
-	private static final class EmptyList extends AbstractList implements
+	@SuppressWarnings("unchecked")
+    private static final class EmptyList extends AbstractList implements
 			Serializable {
 		private static final long serialVersionUID = 8842843931221139166L;
 
@@ -75,7 +76,8 @@
 		}
 	}
 
-	private static final class EmptySet extends AbstractSet implements
+	@SuppressWarnings("unchecked")
+    private static final class EmptySet extends AbstractSet implements
 			Serializable {
 		private static final long serialVersionUID = 1582296315990362920L;
 
@@ -104,7 +106,8 @@
 		}
 	}
 
-	private static final class EmptyMap extends AbstractMap implements
+	@SuppressWarnings("unchecked")
+    private static final class EmptyMap extends AbstractMap implements
 			Serializable {
 		private static final long serialVersionUID = 6428348081105594320L;
 
@@ -133,11 +136,14 @@
 		}
 	}
 
+    @SuppressWarnings("unchecked")
     public static final List EMPTY_LIST = new EmptyList();
 
-	public static final Set EMPTY_SET = new EmptySet();
+	@SuppressWarnings("unchecked")
+    public static final Set EMPTY_SET = new EmptySet();
 
-	public static final Map EMPTY_MAP = new EmptyMap();
+	@SuppressWarnings("unchecked")
+    public static final Map EMPTY_MAP = new EmptyMap();
 
 	private static final class ReverseComparator<T> implements Comparator<T>, Serializable
{
 		private static final long serialVersionUID = 7207038068494060240L;



Mime
View raw message