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 java.util.Collection;

import java.util.Set;

public class Main {
    /**
     * Returns the mode in the Collection.  If the Collection has multiple modes, this method picks one
     * arbitrarily.
     */
    public static <T> T mode(Collection<T> values) {
        Set<T> modes = modes(values);
        return modes.iterator().next();
    }

    /**
     * Returns a list of all modes in the Collection.  (If the Collection has multiple items with the
     * highest frequency, all of them will be returned.)
     */
    public static <T> Set<T> modes(Collection<T> values) {
        throw new RuntimeException("Unimported from original code");
    }
}