activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1211883 - /activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.scala
Date Thu, 08 Dec 2011 13:44:38 GMT
Author: chirino
Date: Thu Dec  8 13:44:37 2011
New Revision: 1211883

URL: http://svn.apache.org/viewvc?rev=1211883&view=rev
Log:
Avoid creating a TreeSet if it's not needed or if the values are not sortable.

Modified:
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.scala

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.scala?rev=1211883&r1=1211882&r2=1211883&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.scala
Thu Dec  8 13:44:37 2011
@@ -91,6 +91,10 @@ class PathMap[Value] {
     if ((set == null) || set.isEmpty) {
       return null.asInstanceOf[Value]
     }
+    var first: Value = set.iterator().next()
+    if( set.size()==1 || !first.isInstanceOf[java.lang.Comparable[_]]) {
+      return first;
+    }
     var sortedSet: SortedSet[Value] = new TreeSet[Value](set)
     return sortedSet.last
   }



Mime
View raw message