Back to project page saostar.
The source code is released under:
Apache License
If you think the Android project saostar listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.azyobuzi.azyotter.saostar.timeline_data; //from w w w . java 2 s .c o m import java.util.HashMap; import net.azyobuzi.azyotter.saostar.linq.Enumerable; public class UserCollection { private static final HashMap<Long, UserInfo> dic = new HashMap<Long, UserInfo>(); private static final Object lockObj = new Object(); public static Enumerable<UserInfo> getEnumerable() { synchronized (lockObj) { return Enumerable.from(dic.values().toArray()).cast(); } } public static UserInfo addOrMerge(twitter4j.User source) { synchronized (lockObj) { if (dic.containsKey(source.getId())) { UserInfo re = dic.get(source.getId()); re.merge(source); return re; } else { UserInfo re = UserInfo.create(source); dic.put(source.getId(), re); return re; } } } public static UserInfo get(long id) { synchronized (lockObj) { return dic.get(id); } } public static boolean containsId(long id) { synchronized (lockObj) { return dic.containsKey(id); } } }