code: public int next() {
          if (dir_ > 1) {
              // Continue forward iteration. Test this first.
              if (otherHalf_ != 0) {
                  int oh = otherHalf_;
                  otherHalf_ = 0;
                  return oh;
              }
          } else if (dir_ == 1) {
              // next() after setOffset()
              dir_ = 2;
          } else if (dir_ == 0) {
              // The iter_ is already reset to the start of the text.
              dir_ = 2;
          } else /* dir_ < 0 */{
              // illegal change of direction
              throw new IllegalStateException("Illegal change of direction");
              // Java porting note: ICU4C sets U_INVALID_STATE_ERROR to the return status.
          }
          // No need to keep all CEs in the buffer when we iterate.
          iter_.clearCEsIfNoneRemaining();
          long ce = iter_.nextCE();
          if (ce == Collation.NO_CE) {
              return NULLORDER;
          }
          // Turn the 64-bit CE into two old-style 32-bit CEs, without quaternary bits.
          long p = ce >>> 32;
          int lower32 = (int) ce;
          int firstHalf = getFirstHalf(p, lower32);
          int secondHalf = getSecondHalf(p, lower32);
          if (secondHalf != 0) {
              otherHalf_ = secondHalf | 0xc0; // continuation CE
          }
          return firstHalf;
      }
docs: Get the next collation element in the source string.
  
  <p>This iterator iterates over a sequence of collation elements
  that were built from the string. Because there isn't
  necessarily a one-to-one mapping from characters to collation
  elements, this doesn't mean the same thing as "return the
  collation element [or ordering priority] of the next character
  in the string".
  
  <p>This function returns the collation element that the
  iterator is currently pointing to, and then updates the
  internal pointer to point to the next element.
  
  @return the next collation element or NULLORDER if the end of the
  iteration has been reached.