Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Map;

public class Main {
    public static String getMaximumKey(Map<String, Double> input) {
        String bestFeature = null;
        Double bestValue = null;
        for (String feature : input.keySet()) {
            if (bestValue == null || bestValue.compareTo(input.get(feature)) < 0) {
                bestFeature = feature;
                bestValue = input.get(feature);
            }
        }
        return bestFeature;
    }
}