Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    public static <X extends Comparable<X>> Comparator<X[]> naturalArrayComparator() {
        return new Comparator<X[]>() {

            public int compare(X[] a, X[] b) {
                for (int i = 0; i < b.length; i++) {
                    int c = a[i].compareTo(b[i]);
                    if (c != 0)
                        return c;
                }
                return 0;
            }
        };
    }
}