code: private List<CmsSessionInfo> getAllSelected(Map<CmsUUID, CmsSessionInfo> allSessions, CmsUUID userId) {
  
          List<CmsSessionInfo> userSessions = new ArrayList<CmsSessionInfo>();
          Iterator<Map.Entry<CmsUUID, CmsSessionInfo>> i = allSessions.entrySet().iterator();
          while (i.hasNext()) {
              Map.Entry<CmsUUID, CmsSessionInfo> entry = i.next();
              CmsSessionInfo sessionInfo = entry.getValue();
              if ((sessionInfo != null) && ((userId == null) || userId.equals(sessionInfo.getUserId()))) {
                  // sessionInfo == null may be the case in case of concurrent modification
                  userSessions.add(sessionInfo);
              }
          }
          return userSessions;
      }
docs: Returns all sessions or all sessions matching the user id from the provided Map.<p>
  
  @param allSessions the Map of existing sessions
  @param userId the id of the user, if null all sessions will be returned
  
  @return all sessions or all sessions matching the user id from the provided Map