Hello, is it possible in Kotlin to do returns based on the configuration?
For example,
Copy code
fun foo(useHttps: Boolean, conn: URLConnection): <Return type should either be HttpURLConnection/HttpURLsConnection> {
// Logic here
return URLConnection as HttpURLConnection/HttpURLsConnection // based on config?
}
j
Jaymin.Kim
12/12/2019, 6:10 AM
Copy code
sealed class HttpConnection {
class Url(val actual: HttpURLConnection): HttpConnection()
class Urls(val actual: HttpURLsConnect): HttpConnect()
}