code: protected void getFrontierNodes(final List<Parse> rf, final Parse[] nodes) {
      int leftIndex = 0;
      int prevHeadIndex = -1;
  
      for (int fi = 0; fi < rf.size(); fi++) {
        final Parse fn = rf.get(fi);
        final int headIndex = fn.getHeadIndex();
        if (headIndex != prevHeadIndex) {
          nodes[leftIndex] = fn;
          leftIndex++;
          prevHeadIndex = headIndex;
          if (leftIndex == nodes.length) {
            break;
          }
        }
      }
      for (int ni = leftIndex; ni < nodes.length; ni++) {
        nodes[ni] = null;
      }
    }
docs: Populates specified nodes array with left-most right frontier node with a
  unique head. If the right frontier doesn't contain enough nodes, then nulls
  are placed in the array elements.
  
  @param rf
  The current right frontier.
  @param nodes
  The array to be populated.