Browse souce code repository at: https://github.com/jjYBdx4IL/java-evaluation/blob/master/src/test/java/tests/java/util/stream/CollectorsTest.java
package tests.java.util.stream;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class CollectorsTest {

    @Test
    public void testListToMap() {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");

        Map<String, String> result1 = list.stream().collect(
                Collectors.toMap(String::toLowerCase, String::toUpperCase));

        assertEquals("A", result1.get("a"));

        Map<String, String> result2 = list.stream().collect(
                Collectors.toMap(-> x.toLowerCase(), x -> x.toUpperCase()));

        assertEquals("A", result2.get("a"));
    }
}
-------------------------------------------------------------------------------
Test set: tests.java.util.stream.CollectorsTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in tests.java.util.stream.CollectorsTest
testListToMap  Time elapsed: 0 s