abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r443117 - /incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java
Date Wed, 13 Sep 2006 20:51:23 GMT
Author: jmsnell
Date: Wed Sep 13 13:51:22 2006
New Revision: 443117

URL: http://svn.apache.org/viewvc?view=rev&rev=443117
Log:
Not exactly sure what I was thinking with the first rev of this. Fix the method up a bit

Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java?view=diff&rev=443117&r1=443116&r2=443117
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java
(original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java
Wed Sep 13 13:51:22 2006
@@ -19,7 +19,6 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
@@ -156,20 +155,20 @@
    */
   public static String[] condense(String... types) {
     if (types.length <= 1) return types;
-    List<String> list = new ArrayList<String>(Arrays.asList(types));
     List<String> res = new ArrayList<String>();
-    Collections.sort(list, getComparator());
-    for (String t:list) {
-      if (!contains(t,res) && !res.contains(t)) res.add(t); 
+    Arrays.sort(types, getComparator());
+    for (String t:types) {
+      if (!contains(t,res, true)) res.add(t); 
     }
     for (int n = 0; n < res.size(); n++) {
-      String t = res.get(n).intern();
-      if (contains(t, res)) res.remove(t);
+      String t = res.get(n);
+      if (contains(t, res,false)) res.remove(t);
     }
     return res.toArray(new String[res.size()]);
   }
   
-  private static boolean contains(String t1, List<String> t) {
+  private static boolean contains(String t1, List<String> t, boolean self) {
+    if (self && t.contains(t1)) return true;
     for (String t2 : t) {
       int c = compare(t1,t2);
       if (c == 1) return true;



Mime
View raw message