Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;

import java.util.Collections;

import java.util.List;
import java.util.function.Function;

public class Main {
    public static <T, Tout> List<Tout> select(Iterable<T> source, Function<T, Tout> action) {
        if (source == null || !source.iterator().hasNext())
            return Collections.emptyList();
        List<Tout> result = new ArrayList<Tout>();
        for (T item : source) {
            result.add(action.apply(item));
        }

        return result;

    }
}