aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs187/470633/Maps.java
blob: a46ffd2c987f2652a01f69cf75c3dd74381a323c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Jun Dong (edong@elementum.com)
 *         Created at: 6/18/15 9:50 AM
 * @since 1.0
 * Description:
 */
public class Maps {

    public static <K, V> Map<K, V> toMap(Map.Entry<K, V>... entries) {
        return Collections.unmodifiableMap(
          Stream
            .of(entries)
            .collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue())));
    }

}