Here you can find the source of removeIndex(ArrayList arr, ArrayList idNames)
Parameter | Description |
---|---|
arr | The array of treatment data |
idNames | The array of id want be removed |
public static void removeIndex(ArrayList arr, ArrayList idNames)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.HashMap; public class Main { /**/*from w w w .j a v a2 s .c o m*/ * remove all the relation index for the input array * * @param arr The array of treatment data * @param idNames The array of id want be removed */ public static void removeIndex(ArrayList arr, ArrayList idNames) { for (Object item : arr) { if (item instanceof ArrayList) { removeIndex((ArrayList) item, idNames); } else if (item instanceof HashMap) { removeIndex((HashMap) item, idNames); } } } /** * remove all the relation index for the input map * * @param m the array of treatment data * @param idNames */ public static void removeIndex(HashMap m, ArrayList idNames) { Object[] keys = m.keySet().toArray(); for (Object key : keys) { Object item = m.get(key); if (item instanceof ArrayList) { removeIndex((ArrayList) item, idNames); } else if (item instanceof HashMap) { removeIndex((HashMap) item, idNames); } else if (item instanceof String && idNames.contains(key)) { m.remove(key); } } } }