code: public static <T> Collector<T, ?, List<T>> first(final int n) {
          N.checkArgNotNegative(n, "n");
  
          final Supplier<List<T>> supplier = new Supplier<List<T>>() {
              @Override
              public List<T> get() {
                  return new ArrayList<T>(N.min(256, n));
              }
          };
  
          final BiConsumer<List<T>, T> accumulator = new BiConsumer<List<T>, T>() {
              @Override
              public void accept(List<T> c, T t) {
                  if (c.size() < n) {
                      c.add(t);
                  }
              }
          };
  
          final BinaryOperator<List<T>> combiner = new BinaryOperator<List<T>>() {
              @Override
              public List<T> apply(List<T> a, List<T> b) {
                  if (N.notNullOrEmpty(a) && N.notNullOrEmpty(b)) {
                      throw new UnsupportedOperationException("The 'first' and 'last' Collector only can be used in sequential stream");
                  }
  
                  return a.size() > 0 ? a : b;
              }
          };
  
          return new CollectorImpl<>(supplier, accumulator, combiner, CH_ID);
      }
docs: Only works for sequential Stream.
  
  @param n
  @return
  @throws UnsupportedOperationException operated by multiple threads