package ru.ulstu.core.util;

import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

public class StreamApiUtils {

    public static <T, R> List<T> convert(List<R> entities, Function<R, T> converter) {
        return entities == null
                ? Collections.EMPTY_LIST
                : entities.stream().map(e -> converter.apply(e)).collect(Collectors.toList());
    }
}
