code: @GuardedBy("lock")
      public void forEach(long from, long to, Visitor<T> visitor) {
          if(from - to > 0) // same as if(from > to), but prevents long overflow
              return;
          int row=computeRow(from), column=computeIndex(from);
          int distance=(int)(to - from +1);
          T[] current_row=row+1 > matrix.length? null : matrix[row];
  
          for(int i=0; i < distance; i++) {
              T element=current_row == null? null : current_row[column];
              if(!visitor.visit(from, element, row, column))
                  break;
  
              from++;
              if(++column >= elements_per_row) {
                  column=0;
                  row++;
                  current_row=row+1 > matrix.length? null : matrix[row];
              }
          }
      }
docs: Iterates over the matrix with range [from .. to] (including from and to), and calls
  {@link Visitor#visit(long,Object,int,int)}. If the visit() method returns false, the iteration is terminated.
  <p/>
  This method must be called with the lock held
  @param from The starting seqno
  @param to The ending seqno, the range is [from .. to] including from and to
  @param visitor An instance of Visitor