public static < T extends Annotation > T trimEnd ( T annotation , char ... ws ) { char [ ] s = annotation . getCoveredText ( ) . toCharArray ( ) ; if ( s . length == 0 ) return annotation ; int e = 0 ; while ( ArrayUtils . contains ( ws , s [ ( s . length - 1 ) - e ] ) ) { e ++ ; } annotation . setEnd ( annotation . getEnd ( ) - e ) ; return annotation ; }
Moves the end - index as long a character that is contained in the array is at the end .