01/11/2018, 5:46 PM
I have a straightforward delegation question if someone cares to entertain me: This code isn't right, but that's where you can help
Copy code
interface Populace {

    fun getPeople() : Set<People>
    fun getPopulation() : Int


data class People(val age:Int, val givenName:String, val surname:String)

class CompositePopulace(private val populi:Set<Populace>) : Populace {

    val people by lazy {
        populi.flatMap { it.getPeople() }.toSet()

    override fun getPopulation() = this.people.size

    override fun getPeople(): Set<People> = people
It's pretty simple: I want this composite to simply represent the union of the underlying populations. My error is:
Copy code
Error:(15, 5) Kotlin: Platform declaration clash: The following declarations have the same JVM signature (getPeople()Ljava/util/Set;):
    fun <get-people>(): Set<People> defined in com.sterling.s1.CompositePopulace
    fun getPeople(): Set<People> defined in com.sterling.s1.CompositePopulace
Which is strange because I didn't say it was a
- I assumed it would be the inbuilt kotlin Set. I am really trying to get better at this because I love the features the language offers