public static Optional < OffsetRange < CharOffset > > charOffsetsOfWholeString ( String s ) { if ( s . isEmpty ( ) ) { return Optional . absent ( ) ; } return Optional . of ( charOffsetRange ( 0 , s . length ( ) - 1 ) ) ; }
This returns optional because it is not possible to represent an empty offset span