Make `Call.Factory` a function interface in Kotlin 1.4
See original GitHub issueFeature request that I wanted to file for the future.
fun interface Factory {
fun newCall(request: Request): Call
}
Then it could be used as a lambda with 1.4’s SAM support
Retrofit.Builder()
.callFactory { ... }
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
[Solved]-Function interface in Kotlin 1.4-kotlin - appsloveworld
This is about functional interfaces — interfaces with a Single Abstract Method (also called SAM interfaces). To understand the point, I'll need to...
Read more >Functional (SAM) interfaces - Kotlin
An interface with only one abstract method is called a functional interface, or a Single Abstract Method (SAM) interface.
Read more >How to implement a functional interface as lambda in Kotlin?
In Kotlin an functional / SAM interface is considered as an anti-pattern, a function type should be declared instead: (String)->String .
Read more >The Interconnection of Functional Interfaces in Java and Kotlin
To declare a Functional interface in Java is easy. You just create a normal interface with one method for example. ... And in...
Read more >Kotlin Factory Method - DevLog | Adam Świderski
Instead of calling object constructor, we can call a method of the Factory which will generate interface implementation - the concrete object.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And cleanup https://github.com/square/okhttp/pull/5947/commits/d58b5b255e557fa51dcc6bf4d149e7d60a400126
e.g.
Good call, I’ll add to https://github.com/square/okhttp/pull/5947