Convert map To List - Android java.util

Android examples for java.util:Map

Description

Convert map To List

Demo Code


//package com.book2s;
import java.util.ArrayList;

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

public class Main {
    public static <E> List<E> mapToList(String[] keys, Map<String, E> map) {
        List<E> list = new ArrayList<E>(keys.length);
        for (int i = 0; i < keys.length; i++) {
            list.add(map.get(keys[i]));//from   ww w  . jav  a  2s  .c  o m
        }
        return list;
    }
}

Related Tutorials