Example #1
0
 public virtual bool TryAdvance(IntConsumer action)
 {
     if (action == null)
     {
         throw new NullPointerException();
     }
     if (Index >= 0 && Index < Limit)
     {
         action.Accept(Buffer.GetUnchecked(Index++));
         return(true);
     }
     return(false);
 }
Example #2
0
        public override 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++));
            }
        }