private void putFriendEntries(long userId, FriendEntries fes) { fes.trimFriends(); fes = fes.copy(); if (CollectionUtils.isNotEmpty(fes.circles)) { for (int i = fes.circles.size() - 1; i >= 0; i--) { Circle c = fes.circles.get(i); if (ArrayUtils.contains(Circle.BUILTIN_ACTUAL_CIRCLES, c.getCircleId())) fes.circles.remove(i); } } friends.put(userId, fes.copy()); }
@Override protected FriendEntries getFriendEntries(Context ctx, long userId) { FriendEntries fes = friends.get(userId); if (fes == null) { fes = new FriendEntries(); } else { fes = fes.copy(); } Circles circles = new Circles(); if (CollectionUtils.isNotEmpty(fes.circles)) { for (Circle c : fes.circles) circles.add(c.copy()); } for (int circleId : Circle.BUILTIN_ACTUAL_CIRCLES) { circles.add(new Circle(circleId, Circle.getBuiltinCircleName(circleId, ""), 0)); } fes.circles = circles; return fes; }