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