Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;

import java.util.List;
import java.util.Map;

public class Main {

    public static <K, V> List<Integer> getIndexListByValues(Map<K, V> map, Object[] values) {
        if ((values == null) || (values.length == 0)) {
            return null;
        }
        List<Integer> indexList = new ArrayList<Integer>(map.size());
        Integer i = Integer.valueOf(0);
        for (V v : map.values()) {
            for (Object value : values) {
                if ((v == value) || (v.equals(value))) {
                    indexList.add(i);
                }
            }
            i = Integer.valueOf(i.intValue() + 1);
        }
        return indexList;
    }
}