Java tutorial
//package com.java2s; import java.util.*; public class Main { public static <T> List<T> listOf(T a) { List<T> list = newEmptyList(); list.add(a); return list; } public static <T> List<T> newEmptyList() { return new ArrayList<>(); } public static <T> List<T> add(List<T> list, T a) { List<T> newList = newEmptyList(); newList.addAll(list); newList.add(a); return newList; } }