Code example for FluentIterable

Methods: toSet

  public final Set<T> getNextGroup(Set<T> idle, Set<T> active) {
    return FluentIterable
        .from(ordering.sortedCopy(doGetNextGroup(idle, active)))
        .limit(Math.max(0, maxActive - active.size()))
   * Delegate function for the subclass. The implementation may return as many or few results 
   * as they wish. If the result is larger than {@link #maxActive}, it will be truncated. 
   * @param idle Idle instances, candidate for being updated. 
   * @param active Instances currently being updated. 
   * @return A subset of {@code idle}, instances to start updating. 
  abstract Set<T> doGetNextGroup(Set<T> idle, Set<T> active);