List of usage examples for java.util List remove
E remove(int index);
From source file:com.couchbase.client.core.config.CouchbasePartitionInfo.java
private static List<Partition> fromPartitionList(List<List<Short>> input) { List<Partition> partitions = new ArrayList<Partition>(); if (input == null) { return partitions; }//from w w w.j ava 2 s .c o m for (List<Short> partition : input) { short master = partition.remove(0); short[] replicas = new short[partition.size()]; int i = 0; for (short replica : partition) { replicas[i++] = replica; } partitions.add(new DefaultPartition(master, replicas)); } return partitions; }
From source file:Main.java
public static void restoreAncestralClipping(@NonNull View view, List<Boolean> was) { if (view instanceof ViewGroup) { ViewGroup group = (ViewGroup) view; group.setClipChildren(was.remove(0)); }//w ww .j av a2s .co m ViewParent parent = view.getParent(); if (parent != null && parent instanceof ViewGroup) { restoreAncestralClipping((ViewGroup) parent, was); } }
From source file:Main.java
public static long remove(List list) { long start, stop, result = 0; for (int i = 0; i < 100; i++) { start = System.nanoTime(); list.remove(list.size() - 1 - i); stop = System.nanoTime(); result += stop - start;//w ww . ja v a2 s. c o m } return result / 100; }
From source file:Main.java
public static <T> List<T> trim(List<T> list, int count) { List<T> result = Lists.newArrayList(list); for (int i = 0; i < count && result.size() > 0; i++) { int idx = result.size() - 1; result.remove(idx); }/*w w w. j a va2 s. c o m*/ return ImmutableList.copyOf(result); }
From source file:Main.java
public static <T> boolean isSubset(List<T> subList, List<T> list) { if (subList == null || list == null || subList.isEmpty() || list.isEmpty()) { return false; }/*w w w.j a va 2 s. com*/ List<T> subList1 = new ArrayList(); subList1.addAll(subList); for (T t : list) { if (subList1.contains(t)) { subList1.remove(t); } } if (subList1.isEmpty()) { return true; } return false; }
From source file:Main.java
/** * Truncate a list to a size by removing elements at its end, if necessary. * * @param list/*from w w w . java 2s . co m*/ * a list * @param newSize * desired size */ public static void truncate(final List<?> list, final int newSize) { final int currentSize = list.size(); for (int i = currentSize - 1; i >= newSize; i--) { list.remove(i); } }
From source file:jef.testbase.JefTester.java
static List<String> printArray(List<String> oList, List<Integer> printList) { Integer more = printList.remove(0); List<String> result = new ArrayList<String>(); if (oList.size() == 0) { result.add(more.toString());/*from w w w. j av a2s . c o m*/ } else { for (int i = 0; i < oList.size(); i++) { String str = oList.get(i); for (int j = 0; j < str.length(); j++) { String rStr = str.substring(0, j) + more + str.substring(j, str.length()); result.add(rStr); } } } if (printList.size() == 0) return result; else return printArray(result, printList); }
From source file:com.aliyun.openservices.odps.console.commands.HtmlModeCommand.java
/** * ??command/*from www. j av a 2 s . c o m*/ * **/ public static HtmlModeCommand parse(List<String> optionList, ExecutionContext sessionContext) { if (optionList.contains("--html")) { optionList.remove(optionList.indexOf("--html")); return new HtmlModeCommand("--html", sessionContext); } return null; }
From source file:com.github.rinde.rinsim.central.arrays.RandomMVArraysSolver.java
static void remove(List<List<Integer>> lists, int i) { for (final List<Integer> l : lists) { l.remove(new Integer(i)); }//from www . j a va 2 s . co m }
From source file:Main.java
public static <T> List<T> difference(final List<T> list1, final List<T> list2) { final List<T> result = new ArrayList<T>(list1); for (final T e : list2) { result.remove(e); }/*from w w w . j ava 2 s. c o m*/ return result; }