question: @ Override public int parse ( DateTimeParseContext context , CharSequence text , int position ) { int length = text . length ( ) ; if ( position > length ) { throw new IndexOutOfBoundsException ( ) ; } if ( position == length ) { return ~ position ; } char nextChar = text . charAt ( position ) ; if ( nextChar == '+' || nextChar == '-' ) { return parseOffsetBased ( context , text , position , position , OffsetIdPrinterParser . INSTANCE_ID_Z ) ; } else if ( length >= position + 2 ) { char nextNextChar = text . charAt ( position + 1 ) ; if ( context . charEquals ( nextChar , 'U' ) && context . charEquals ( nextNextChar , 'T' ) ) { if ( length >= position + 3 && context . charEquals ( text . charAt ( position + 2 ) , 'C' ) ) { return parseOffsetBased ( context , text , position , position + 3 , OffsetIdPrinterParser . INSTANCE_ID_ZERO ) ; } return parseOffsetBased ( context , text , position , position + 2 , OffsetIdPrinterParser . INSTANCE_ID_ZERO ) ; } else if ( context . charEquals ( nextChar , 'G' ) && length >= position + 3 && context . charEquals ( nextNextChar , 'M' ) && context . charEquals ( text . charAt ( position + 2 ) , 'T' ) ) { return parseOffsetBased ( context , text , position , position + 3 , OffsetIdPrinterParser . INSTANCE_ID_ZERO ) ; } } PrefixTree tree = getTree ( context ) ; ParsePosition ppos = new ParsePosition ( position ) ; String parsedZoneId = tree . match ( text , ppos ) ; if ( parsedZoneId == null ) { if ( context . charEquals ( nextChar , 'Z' ) ) { context . setParsed ( ZoneOffset . UTC ) ; return position + 1 ; } return ~ position ; } context . setParsed ( ZoneId . of ( parsedZoneId ) ) ; return ppos . getIndex ( ) ; }
target:  This implementation looks for the longest matching string. For example, parsing Etc/GMT-2 will return Etc/GMC-2 rather than just Etc/GMC although both are valid.