List of usage examples for java.util List remove
E remove(int index);
From source file:Main.java
public static <T> List<T> tail(List<T> list) { if (list.size() == 0) { throw new IllegalStateException("tail of empty list"); }//from www . ja va 2 s.co m List<T> workList = copy(list); workList.remove(0); return Collections.unmodifiableList(workList); }
From source file:Main.java
public static void clearTempFile(List<File> listTempFile, File skipfile) { listTempFile.remove(skipfile); for (File file : listTempFile) { if (file.exists()) { file.delete();//w w w.j a v a 2 s.co m } } listTempFile.clear(); }
From source file:Main.java
public static <T> void removeLast(List<T> list) { if (!isNullOrEmpty(list)) list.remove(list.size() - 1); }
From source file:Main.java
/** * Delete item in <code>list</code> from position <code>indexFrom</code> and insert it to <code>indexTwo</code> * * @param list/*from w ww .ja va2s .co m*/ * @param indexFrom * @param indexTwo */ public static void reorder(List list, int indexFrom, int indexTwo) { Object obj = list.remove(indexFrom); list.add(indexTwo, obj); }
From source file:Main.java
public static <A> List<A> tail(List list) { List result = new ArrayList<>(list); result.remove(0); return Collections.unmodifiableList(result); }
From source file:Main.java
public static <T1> void difference(List<T1> lst1, List<T1> lst2) { for (T1 elem : lst2) { lst1.remove(elem); }/*from w w w . j a v a 2 s . co m*/ }
From source file:Main.java
public static JSONArray remove(final int idx, final JSONArray from) { final List<JSONObject> objs = asList(from); objs.remove(idx); final JSONArray ja = new JSONArray(); for (final JSONObject obj : objs) { ja.put(obj);//from ww w . j av a 2s. c o m } return ja; }
From source file:Main.java
public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b) { List<T> list = new ArrayList<>(a); for (T element : b) { list.remove(element); }/*from w w w . ja v a 2s . com*/ return list; }
From source file:Main.java
public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b, Object object) { List<T> list = new ArrayList<T>(a); for (T element : b) { list.remove(element); }/*from w w w . j a v a2 s. c o m*/ return list; }
From source file:Main.java
public static <V> void resize(List<V> list, int size) { while (list.size() > size) list.remove(list.size() - 1); while (list.size() < size) list.add(null);/*from www .j a v a 2 s . c om*/ }