class CollectionFunctions {

    public static <T, K, U> Map<K, U> simpleToMap(
            Collection<T> list,
            Function<? super T, ? extends K> keyMapper,
            Function<? super T, ? extends U> valueMapper) {

        if (list == null || list.isEmpty()) {
            return Collections.emptyMap();
        }

        Map<K,U> map = new HashMap<K,U>();
        list.forEach(item -> map.put(keyMapper.apply(item), valueMapper.apply(item)));
        return map;
    }

    private  CollectionFunctions();

}