Java tutorial
//package com.java2s; import java.util.List; public class Main { /** * Method removeAndReturn. * @param list List<E> * @param lookup E * @return E */ public static <E> E removeAndReturn(List<E> list, E lookup) { return list.remove(list.indexOf(lookup)); } }