code: public static Pattern isChar(final CharPredicate predicate) {
      return new Pattern() {
        @Override public int match(CharSequence src, int begin, int end) {
          if (begin >= end)
            return MISMATCH;
          else if (predicate.isChar(src.charAt(begin)))
            return 1;
          else
            return MISMATCH;
        }
  
        @Override public String toString() {
          return predicate.toString();
        }
      };
    }
docs: Returns a {@link Pattern} object that matches if the current character in the input satisfies {@code predicate}, in
  which case {@code 1} is returned as match length.