private void onUsersSynced(Set<JsonUser> syncedUsers) throws UserSyncException {
  if (syncedUsers == null || syncedUsers.isEmpty()) {
    throw new UserSyncException("Set of users retrieved from server is null or empty.");
  }
synchronized (mLock) {
    ImmutableSet<JsonUser> addedUsers=ImmutableSet.copyOf(Sets.difference(syncedUsers,mKnownUsers));
    ImmutableSet<JsonUser> deletedUsers=ImmutableSet.copyOf(Sets.difference(mKnownUsers,syncedUsers));
    mKnownUsers.clear();
    mKnownUsers.addAll(syncedUsers);
    mEventBus.post(new KnownUsersSyncedEvent(addedUsers,deletedUsers));
    if (mActiveUser != null && deletedUsers.contains(mActiveUser)) {
      mEventBus.post(new ActiveUserUnsetEvent(mActiveUser,ActiveUserUnsetEvent.REASON_USER_DELETED));
    }
  }
}

private void onUsersSynced ( Set < JsonUser > syncedUsers ) throws UserSyncException { if ( syncedUsers == null || syncedUsers . isEmpty ( ) ) { throw new UserSyncException ( "Set of users retrieved from server is null or empty." ) ; } synchronized ( mLock ) { ImmutableSet < JsonUser > addedUsers = ImmutableSet . copyOf ( Sets . difference ( syncedUsers , mKnownUsers ) ) ; ImmutableSet < JsonUser > deletedUsers = ImmutableSet . copyOf ( Sets . difference ( mKnownUsers , syncedUsers ) ) ; mKnownUsers . clear ( ) ; mKnownUsers . addAll ( syncedUsers ) ; mEventBus . post ( new KnownUsersSyncedEvent ( addedUsers , deletedUsers ) ) ; if ( mActiveUser != null && deletedUsers . contains ( mActiveUser ) ) { mEventBus . post ( new ActiveUserUnsetEvent ( mActiveUser , ActiveUserUnsetEvent . REASON_USER_DELETED ) ) ; } } }
called when users are retrieved from the server , in order to send events and update user state as necessary .
