Stepan Koltsov avatar 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");
     }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.