Commits

Stepan Koltsov committed 33b2c11 Merge

merge

Comments (0)

Files changed (2)

src/main/java/ru/yandex/bolts/collection/CollectionF.java

     /** Elements sorted by given comparator */
     ListF<E> sort(Function2I<? super E, ? super E> comparator);
 
+    ListF<E> sort(Comparator<? super E> comparator);
+
+    ListF<E> sort(java.util.Comparator<? super E> comparator);
+
     ListF<E> sortW(@FunctionParameter int comparator);
 
     ListF<E> sortBy(Function<? super E, ?> f);

src/main/java/ru/yandex/bolts/collection/impl/AbstractCollectionF.java

         return r.convertToReadOnly();
     }
 
-    @SuppressWarnings({"unchecked"})
-    public ListF<E> sort(Function2I<? super E, ? super E> comparator) {
+    @Override
+    public ListF<E> sort(java.util.Comparator<? super E> comparator) {
         if (size() <= 1) return toList();
 
         ArrayListF<E> r = new ArrayListF<E>(this);
-        Collections.sort(r, Comparator.wrap((Function2I<E, E>) comparator));
+        Collections.sort(r, comparator);
         return r.convertToReadOnly();
     }
 
     @Override
+    public ListF<E> sort(Comparator<? super E> comparator) {
+        return sort((java.util.Comparator<? super E>) comparator);
+    }
+
+    @Override
+    @SuppressWarnings({"unchecked"})
+    public ListF<E> sort(Function2I<? super E, ? super E> comparator) {
+        return sort(Comparator.wrap((Function2I<E, E>) comparator));
+    }
+
+    @Override
     public ListF<E> sortW(int comparator) {
         throw new RuntimeException("weaving must be enabled");
     }