Example #1
0
 default IntConsumer andThen(IntConsumer after) {
   checkCriticalNotNull(after);
   return value -> {
     accept(value);
     after.accept(value);
   };
 }
 @Override
 public void forEachInt(IntConsumer block) {
   while (cur < length()) {
     int cp = Character.codePointAt(CharSequence.this, cur);
     cur += Character.charCount(cp);
     block.accept(cp);
   }
 }
 @Override
 public boolean tryAdvance(IntConsumer action) {
   if (action == null) throw new NullPointerException();
   if (index >= 0 && index < limit) {
     action.accept(buffer.getUnchecked(index++));
     return true;
   }
   return false;
 }
 @Override
 public void forEachRemaining(IntConsumer action) {
   if (action == null) throw new NullPointerException();
   CharBuffer cb = buffer;
   int i = index;
   int hi = limit;
   index = hi;
   while (i < hi) {
     action.accept(cb.getUnchecked(i++));
   }
 }
Example #5
0
 /**
  * Creates a {@link ObjBiIntConsumer} which uses the {@code third} parameter of this one as
  * argument for the given {@link IntConsumer}.
  *
  * @param <T> The type of the first argument to the consumer
  * @param consumer The consumer which accepts the {@code third} parameter of this one
  * @return Creates a {@code ObjBiIntConsumer} which uses the {@code third} parameter of this one
  *     as argument for the given {@code IntConsumer}.
  * @throws NullPointerException If given argument is {@code null}
  */
 @Nonnull
 static <T> ObjBiIntConsumer<T> onlyThird(@Nonnull final IntConsumer consumer) {
   Objects.requireNonNull(consumer);
   return (t, value1, value2) -> consumer.accept(value2);
 }
 @Override
 public void forEachInt(IntConsumer block) {
   for (; cur < length(); cur++) block.accept(charAt(cur));
 }