private int findLastGroupIndex(int groupId){
  int i=0, size=mItems.size();
  boolean traversingGroup=false;
  while (true) {
    if (i < size) {
      final SublimeBaseMenuItem item=mItems.get(i);
      if (item.getGroupId() == groupId) {
        traversingGroup=true;
      }
 else       if (traversingGroup) {
        return i - 1;
      }
      i++;
    }
 else {
      return traversingGroup ? size - 1 : size;
    }
  }
}

private int findLastGroupIndex ( int groupId ) { int i = 0 , size = mItems . size ( ) ; boolean traversingGroup = false ; while ( true ) { if ( i < size ) { final SublimeBaseMenuItem item = mItems . get ( i ) ; if ( item . getGroupId ( ) == groupId ) { traversingGroup = true ; } else if ( traversingGroup ) { return i - 1 ; } i ++ ; } else { return traversingGroup ? size - 1 : size ; } } }
returns the last index at which a member of the indicated group exists . if the group currently does not have any members , size of the menuitem - list is returned .
