Java List Subtract subtractFromList(List op1, Object op2)

Here you can find the source of subtractFromList(List op1, Object op2)

Description

This is not a documented feature but we are leaving this in for now.

License

Open Source License

Parameter

Parameter Description
op1 a parameter
op2 a parameter

Declaration

@SuppressWarnings({ "unchecked", "rawtypes" })
private static Object subtractFromList(List<?> op1, Object op2) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * This file is part of Pebble.//from   w w w.  j av  a 2  s .  c  om
 *
 * Copyright (c) 2014 by Mitchell B?secke
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 ******************************************************************************/

import java.util.Collection;
import java.util.List;

public class Main {
    /**
     * This is not a documented feature but we are leaving this in for now. I'm
     * unsure if there is demand for this feature.
     *
     * @param op1
     * @param op2
     * @return
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    private static Object subtractFromList(List<?> op1, Object op2) {
        if (op2 instanceof Collection) {
            op1.removeAll((Collection) op2);
        } else {
            op1.remove(op2);
        }
        return op1;
    }
}

Related

  1. subtract(List a, List b)
  2. subtract(List aList, List bList)
  3. subtract(String[] list1, String[] list2)
  4. subtractAsList(T[] array1, T[] array2)
  5. subtractFloatLists(List listA, List listB)
  6. subtractQ(LinkedList Q, List P)