Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { /** * Combines a element and a list into a new list. * * @param t First element of the new list. * @param list Rest elements of the new list. */ public static <T extends Object> List<T> union(final T t, final List<T> list) { final ArrayList<T> result = new ArrayList<T>(); result.add(t); result.addAll(list); return result; } }