Here you can find the source of prepend(List
public static <E> List<E> prepend(List<E> list, E e)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static <E> List<E> prepend(List<E> list, E e) { List<E> newList = new ArrayList<>(list); newList.add(0, e);/*from w w w. j av a 2 s .c o m*/ return newList; } }