is there an interface for "something that can be c...
# getting-started
y
is there an interface for "something that can be converted to a path"? so my API can take "path-like" things without forcing the user to convert at the use site. maybe there's a generic bound for this?
s
Maybe you just want a
() -> Path
?
k
Do you mean an object that is either a
File
or a
String
or a
URI
or an actual
Path
? There's no interface that defines them, but you could use function overloading. However, it's more type-safe (and self-documenting) to force the user to convert to
Path
at the call site, and many stdlib (or Java API) methods already do this.