code: public void getEntriesAndAddListener(RosterListener rosterListener, RosterEntries rosterEntries) {
          Objects.requireNonNull(rosterListener, "listener must not be null");
          Objects.requireNonNull(rosterEntries, "rosterEntries must not be null");
  
          synchronized (rosterListenersAndEntriesLock) {
              rosterEntries.rosterEntries(entries.values());
              addRosterListener(rosterListener);
          }
      }
docs: Add a roster listener and invoke the roster entries with all entries of the roster.
  <p>
  The method guarantees that the listener is only invoked after
  {@link RosterEntries#rosterEntries(Collection)} has been invoked, and that all roster events
  that happen while <code>rosterEntries(Collection) </code> is called are queued until the
  method returns.
  </p>
  <p>
  This guarantee makes this the ideal method to e.g. populate a UI element with the roster while
  installing a {@link RosterListener} to listen for subsequent roster events.
  </p>
  
  @param rosterListener the listener to install
  @param rosterEntries the roster entries callback interface
  @since 4.1