slim recents: Favlist creation: use HashSet instead of Arraylist
well, we usually set a few favs only, so this change won't probably do anything noticeable. But let's be nerd and try to achieve the best anyway :D We create the favlist in the doInBackground just to check if the current item is an user fav, so we don't really need to do a "for" iteration to do stuff for each element, we don't need an ordered list of the elements, we won't never have duplicates in the list. Thus we don't need a lot of features provided by the ArrayList. And for HashSet the dev wiki says this: "This class offers constant time performance for the basic operations (add, remove, contains and size), assuming the hash function disperses the elements properly among the buckets." That's just what we need. PS: i didn't know this HashSet thing but was trying to learn more from OmniSwitch code by Max and found this, so out of curiosity i tried to understand it. Don't blame me if i wrote some bullshit here lol Change-Id: I305eacb76c0da7666962b505f6093df2ca00aabc
Loading
Please sign in to comment