Can we deprecate Path.endsWith(String)?

Brian Burkhalter brian.burkhalter at oracle.com
Thu Jan 8 00:25:30 UTC 2026


Thanks for helping to continue to the discussion.

On Jan 7, 2026, at 4:13 PM, Olexandr Rotan <rotanolexandr842 at gmail.com> wrote:

I am not sure if thoughts similar to mine were already present in the thread, but I am not sure there is any particular value in adding any replacement methods for deprecated ones.

Nor am I.

To me it seems like path.toString.{starts,ends}With provides endlessly more clarity on what is going on, besides maybe  pathString{ends,starts}With, but this name seems clumsy, in some way resembling some denormalized column name in db in a way that it traverses multiple mental indirections to explain clearly enough what it does

Indeed the name is clumsy.

So, as I think, unless there is a substantial optimization to offer from merging this two operations, i would prefer just suggesting to use toString().{starts,ends}With directly

Maybe that is the way to go: just deprecating Path.{ends,starts}With(String) and nothing else.

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20260108/af5a9f7f/attachment.htm>


More information about the core-libs-dev mailing list