Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import com.google.common.base.Function;
import com.google.common.collect.Iterables;

public class Main {
    public static <T> int maxInt(Iterable<T> list, Function<T, Integer> f, int defaultValue) {
        return maxInt(Iterables.transform(list, f), defaultValue);
    }

    public static int maxInt(Iterable<Integer> list, int defaultValue) {
        int max = defaultValue;
        for (Integer i : list) {
            if (i != null)
                max = Math.max(max, i);
        }
        return max;
    }
}