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 {
    private static <T extends Comparable<T>> T getExtremum(Collection<T> vals, int comparator) {
        if (vals.size() == 0)
            return null;
        Iterator<T> it = vals.iterator();
        T ret = it.next();
        while (it.hasNext()) {
            T v = it.next();
            if (v.compareTo(ret) * comparator > 0)
                ret = v;
        }
        return ret;
    }
}