felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r618090 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
Date Sun, 03 Feb 2008 21:13:32 GMT
Author: pauls
Date: Sun Feb  3 13:13:30 2008
New Revision: 618090

URL: http://svn.apache.org/viewvc?rev=618090&view=rev
Log:
Remove an unneccessary object creation.

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java?rev=618090&r1=618089&r2=618090&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java Sun
Feb  3 13:13:30 2008
@@ -26,6 +26,15 @@
 
 class PackageAdminImpl implements PackageAdmin, Runnable
 {
+    private static final Comparator COMPARATOR = new Comparator() {
+        public int compare(Object o1, Object o2)
+        {
+            // Reverse arguments to sort in descending order.
+            return ((ExportedPackage) o2).getVersion().compareTo(
+                ((ExportedPackage) o1).getVersion());
+        }
+    };
+
     private Felix m_felix = null;
     private Bundle[][] m_reqBundles = null;
     private Bundle m_systemBundle = null;
@@ -153,14 +162,7 @@
             return null;
         }
         // Sort the exported versions.
-        Arrays.sort(pkgs, new Comparator() {
-            public int compare(Object o1, Object o2)
-            {
-                // Reverse arguments to sort in descending order.
-                return ((ExportedPackage) o2).getVersion().compareTo(
-                    ((ExportedPackage) o1).getVersion());
-            }
-        });
+        Arrays.sort(pkgs, COMPARATOR);
         // Return the highest version.
         return pkgs[0];
     }



Mime
View raw message