code: public static int count(SegmentedAdvancedLoadWriteStore<?, ?> salws, IntSet segments) {
        Long result = Flowable.fromPublisher(salws.publishKeys(segments, null)).count().blockingGet();
        if (result > Integer.MAX_VALUE) {
           return Integer.MAX_VALUE;
        }
        return result.intValue();
     }
docs: Counts how many entries are present in the segmented store. Only the segments provided will have entries counted.
  @param salws segmented store containing entries
  @param segments segments to count entries from
  @return count of entries that are in the provided segments