All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.tototec.utils.jface.viewer.Util Maven / Gradle / Ivy

The newest version!
package de.tototec.utils.jface.viewer;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Function;

public enum Util {
	INSTANCE;

	public static  List map(final Iterable source, final Function convert) {
		final List result = (source instanceof Collection) ? new ArrayList(((Collection) source).size())
				: new LinkedList();
		for (final T t : source) {
			result.add(convert.apply(t));
		}
		return result;
	}

	public static  List map(final T[] source, final Function convert) {
		return map(Arrays.asList(source), convert);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy