8203444: String::formatted (Preview)

Reviewed-by: smarks, rriggs, sherman
This commit is contained in:
Jim Laskey 2019-06-06 12:24:44 -03:00
parent fead01f2c9
commit 9c6c6eae1d
2 changed files with 79 additions and 0 deletions

View file

@ -3313,6 +3313,30 @@ public final class String
return new Formatter(l).format(format, args).toString();
}
/**
* Formats using this string as the format string, and the supplied
* arguments.
*
* @implSpec This method is equivalent to {@code String.format(this, args)}.
*
* @param args
* Arguments referenced by the format specifiers in this string.
*
* @return A formatted string
*
* @see java.lang.String#format(String,Object...)
* @see java.util.Formatter
*
* @since 13
*
* @deprecated This method is associated with text blocks, a preview language feature.
* Text blocks and/or this method may be changed or removed in a future release.
*/
@Deprecated(forRemoval=true, since="13")
public String formatted(Object... args) {
return new Formatter().format(this, args).toString();
}
/**
* Returns the string representation of the {@code Object} argument.
*