lets assume I have some method like that:
void getMagicUrl(Sting urlBase, String addedPath) {
urlBase = urlBase.endsWith("/") ? urlBase : urlBase + "/"; // *1*
urlBase = urlBase + "constantPath/"; // *2*
urlBase = urlBase + addedPath; // *3*
return new URL(urlBase); // *4*
}
Is there with Java (8) no better way to concatenate the URL together and not to check manual for the ending / as path separator to not forget it? (Like in line 1)
and have it in the path names always? (like in line 2)
or does the JDK have something in there?