code: private Set<String> extractAndRemoveUpToLimit(Set<String> source, int limit) {
          Set<String> result = new HashSet<>();
          Iterator<String> iterator = source.iterator();
          while (iterator.hasNext() && result.size() < limit) {
              result.add(iterator.next());
              iterator.remove();
          }
          return result;
      }
docs: Extracts items from source in the ammount set in 'limit' and also removes them from source