Java List to Map listToMap(final String... strings)

Here you can find the source of listToMap(final String... strings)

Description

list To Map

License

Open Source License

Declaration

public static Map<String, String> listToMap(final String... strings) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

public class Main {
    public static Map<String, String> listToMap(final String... strings) {
        final Map<String, String> map = new LinkedHashMap<>();
        final Iterator<String> stringIterator = Arrays.asList(strings).iterator();

        while (stringIterator.hasNext()) {
            final String key = stringIterator.next();
            final String value = stringIterator.next();
            map.put(key, value);/*from  w w  w  . j  a  va  2s .  c om*/
        }
        return map;
    }
}

Related

  1. listToMap(List input)
  2. listToMap(List> list)
  3. listToMap(List> list)
  4. listToMap(Object... objects)