class SetUtils {

  public static <T> List<Set<T>> split(Set<T> original, int subsetSize) {

    if(subsetSize <= 0) {
      throw new IllegalArgumentException("Incorrect max size");
    }

    if(original == null || original.isEmpty()) {
      return Collections.emptyList();
    }

    int subsetCount = (int) (Math.ceil((double)original.size() / subsetSize));
    ArrayList<Set<T>> subsets = new ArrayList<>(subsetCount);
    Iterator<T> iterator = original.iterator();

    for(int i = 0; i < subsetCount; i++) {
      Set<T> subset = new LinkedHashSet<>(subsetSize);
      for(int j = 0; j < subsetSize && iterator.hasNext(); j++) {
        subset.add(iterator.next());
      }
      subsets.add(subset);
    }
    return subsets;
  }

}