Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Comparator;
- public class Sorting {
- static void sort(Object[] a, Comparator<Object> c) {
- for (int i = 0; i < a.length; i++) {
- for (int j = i + 1; j < a.length; j++) {
- if (c.compare(a[i], a[j]) > 0) {
- Object t = a[i];
- a[i] = a[j];
- a[j] = t;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment