Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashMap;

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

public class Main {
    public static <S> Map<Integer, S> asIndexMap(List<S> pList) {
        final HashMap<Integer, S> map = new HashMap<Integer, S>(pList.size());
        for (final S s : pList) {
            map.put(pList.indexOf(s), s);
        }
        return map;
    }
}