Java removal of duplicates in list lists

Source: Internet
Author: User

   /*** Remove List Duplicate Item * *@paramSrclist *@return     */    Private StaticArraylist<resolveinfo>Removelistduplicateitemwithorder (List<ResolveInfo>srclist) {ArrayList<ResolveInfo> mresolveinfolist =NewArraylist<resolveinfo>(); ArrayList<String> mpkgnamelist =NewArraylist<string>();  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); }        }        returnmresolveinfolist; }    /*** Remove List Duplicate Item * *@paramSrclist *@return     */    Private StaticArraylist<string>Removelistduplicateitemwithorder (ArrayList<String>srclist) {ArrayList<String> deslist =NewArraylist<string>();  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); }        }        returndeslist; }    /*** Remove Liset Duplicate Item * *@paramSrclist *@return     */    Private StaticSet removeListDuplicateItemWithOrder2 (ArrayList<String>srclist) {Set Mlinkedhashset=NewLinkedhashset<string>();        Mlinkedhashset.add (srclist);  for(Iterator Iterator =mlinkedhashset.iterator (); Iterator.hasnext ();) {String element=(String) iterator.next (); XLOG.D (TAG,"Removelistduplicatewithorder2,element=" +element); }        returnMlinkedhashset; }

Java removal of duplicates in list lists

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.