Java tutorial
//package com.java2s; // Licensed under the Apache License, Version 2.0 import java.util.ArrayList; import java.util.HashMap; import android.content.ContentValues; public class Main { public static void removeEntriesWhereMatch(HashMap<String, ArrayList<ContentValues>> operationMap, String tableName, String idColumnName, ArrayList<ContentValues> compareContentValues, String compareColumnName) { ArrayList<ContentValues> restoreOperations = operationMap.get(tableName); if (null == restoreOperations) { return; } ArrayList<ContentValues> removeOperations = new ArrayList<ContentValues>(); for (ContentValues restoreCv : restoreOperations) { for (ContentValues compareCv : compareContentValues) { if (restoreCv.containsKey(idColumnName) && compareCv.containsKey(compareColumnName)) { if (restoreCv.getAsLong(idColumnName) == compareCv.getAsLong(compareColumnName)) { removeOperations.add(restoreCv); } } } } for (ContentValues removeCv : removeOperations) { restoreOperations.remove(removeCv); } } }