question: 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 ; } } }
target:  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.