about the browser Insert bookmark repeat problem has not found a good algorithm, but only temporarily write a stupid way, also please pass by the great God pointing twos, my logic is to insert the bookmark into a collection, before inserting the first query the local browser bookmarks collection, A double loop is used to determine if the URL and title are the same, which is repeated, then added to a new set, and the loop is completed from the collection that needs to be inserted remove the duplicate collection
The code is as follows:
Private list<bookmark> removerepeat (list<bookmark> restore,list<bookmark> local) {List< Bookmark> newlist=new arraylist<bookmark> (); for (int i=0;i<restore.size (); i++) {String title=restore.get (i). GetTitle (); String Url=restore.get (i). GETURL (); for (int j=0;j<local.size (); j + +) {//title and URL are the same at the same time, it is determined to repeat if (Title.trim (). Equals (Local.get (j). GetTitle (). Trim ()) &&url.trim (). Equals (Local.get (j). GETURL (). Trim ())) {Newlist.add ( Restore.get (i)); break;}}} If there are duplicates, remove all duplicates by removing the IF (newlist.size () >0) {Restore.removeall (newlist);} return restore;}
Android Browser bookmark insertion de-weight algorithm