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 ArrayList<ContentValues> removeEntriesWhenEquals( HashMap<String, ArrayList<ContentValues>> operationMap, String tableName, String idColumnName, String compareValue) { ArrayList<ContentValues> restoreOperations = operationMap.get(tableName); if (null == restoreOperations || null == compareValue) { return null; } ArrayList<ContentValues> removeOperations = new ArrayList<ContentValues>(); for (ContentValues restoreCv : restoreOperations) { if (restoreCv.containsKey(idColumnName) && compareValue.equals(restoreCv.getAsString(idColumnName))) { removeOperations.add(restoreCv); } } for (ContentValues removeCv : removeOperations) { restoreOperations.remove(removeCv); } return removeOperations; } }