/** * Remove list duplicate item * * @param srcList * @return */ private static ArrayListremoveListDuplicateItemWithOrder( List srcList) { ArrayList mResolveInfoList = new ArrayList (); ArrayList mPkgNameList = new ArrayList (); for (ResolveInfo resolveInfo : srcList) { String pkgName = resolveInfo.activityInfo.packageName; XLog.d(TAG, "removeListDuplicateWithOrder,pkgName=" + pkgName); // remove duplicate package name if (!mPkgNameList.contains(pkgName)) { mPkgNameList.add(pkgName); mResolveInfoList.add(resolveInfo); } } if (DEBUG_MODE) { for (ResolveInfo resolveInfo : mResolveInfoList) { XLog.d(TAG, "kkkk,removeDuplicateWithOrder,resolveInfo=" + resolveInfo); } } return mResolveInfoList; } /** * Remove list duplicate item * * @param srcList * @return */ private static ArrayList removeListDuplicateItemWithOrder( ArrayList srcList) { ArrayList desList = new ArrayList (); for (String src : srcList) { XLog.d(TAG, "removeListDuplicateWithOrder,src=" + src); if (!desList.contains(src)) { desList.add(src); } } if (DEBUG_MODE) { for (String des : desList) { XLog.d(TAG, "removeDuplicateWithOrder,des=" + des); } } return desList; } /** * Remove liset duplicate item * * @param srcList * @return */ private static Set removeListDuplicateItemWithOrder2( ArrayList srcList) { Set mLinkedHashSet = new LinkedHashSet (); mLinkedHashSet.add(srcList); for (Iterator iterator = mLinkedHashSet.iterator(); iterator.hasNext();) { String element = (String) iterator.next(); XLog.d(TAG, "removeListDuplicateWithOrder2,element=" + element); } return mLinkedHashSet; }