Java List Remove removeAll(List idxs, List values)

Here you can find the source of removeAll(List idxs, List values)

Description

Removes all specified positions (which msut be given in ascending order) from the list.

License

LGPL

Parameter

Parameter Description

Declaration

public static <V> void removeAll(List<Integer> idxs, List<V> values) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.List;

public class Main {
    /** Removes all specified positions (which msut be given in ascending order) from the list. 
     * @param <V>*///from  w  w w  .j  av  a2  s . c  o  m
    public static <V> void removeAll(List<Integer> idxs, List<V> values) {
        int removed = 0;
        for (int idx : idxs) {
            values.remove(idx - removed);
            removed++;
        }
    }
}

Related

  1. remove(List list, T value)
  2. remove(Object o, List oldList)
  3. removeAfter(List children, int index)
  4. removeAll(List list, Object[] elements)
  5. removeAll(List list, List objects)
  6. removeAll(List strings, String string)
  7. removeAll(List list, List indexes)
  8. removeAll(List toRemoveFrom, Collection elementsToRemove)
  9. removeAllNull(List list)