Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <T> List<T> cons(T x, Collection<? extends T> xs) { ArrayList<T> result = new ArrayList<>(xs.size() + 1); result.add(x); result.addAll(xs); return result; } }