public static Optional<String> at(final String value,int index){
  if (value == null || value.isEmpty()) {
    return Optional.empty();
  }
  int length=value.length();
  if (index < 0) {
    index=length + index;
  }
  return (index < length && index >= 0) ? Optional.of(String.valueOf(value.charAt(index))) : Optional.empty();
}

public static Optional < String > at ( final String value , int index ) { if ( value == null || value . isEmpty ( ) ) { return Optional . empty ( ) ; } int length = value . length ( ) ; if ( index < 0 ) { index = length + index ; } return ( index < length && index >= 0 ) ? Optional . of ( String . valueOf ( value . charAt ( index ) ) ) : Optional . empty ( ) ; }
get the character at index . this method will take care of negative indexes . the valid value of index is between - ( length - 1 ) to ( length - 1 ) . for values which don ' t fall under this range optional . empty will be returned .
