You are currently viewing What is there behind List?

What is there behind List?

I’m following an Android course on Udacity and I encountered this code:

var listResult: List<MarsProperty> = MarsApi.retrofitService.getProperties()
value = "Success: ${listResult.size} Mars properties retrieved"

We are getting a List object but I don’t understand where is the logic of the methods in the interface. I know that List is an interface (interface List<out E> : Collection<E>) and it defines some methods like size or public fun isEmpty(): Boolean that don’t have a logic. I can understand this work if I would call a class like ArrayList<> in Java that implements the interface and implements its methods, but how does it work here?

submitted by /u/____Mattia____
[link] [comments]