'Compare in Lists in Kotlin?

im trying to compare the value "hashtags" in Lists.

The class Person:

data class Person(var name: String, var age: Int){
    val hashtags = mutableListOf<String>()
    fun useHashtag(hashtag: String){
        hashtags.add(hashtag) }
}


 fun nextUser(){

       for(item in alleBenutzerListe){

         println(item)

           print("\n")


       }
    }

The values:

   val vlademir = Person("Vlademir",14)
    val feton = Person("Feton",14)
    val allUserList= listOf(Person(feton.name,14),listOf(Person(vlademir.name,14)))

Now in the main function I can use for to see all Persons in "allUserList"

if I add an hashtag for feton it works

feton.useHashtag("cooking")
    feton.useHashtag("Football")
vlademir.useHashtag("Football")
vlademir.useHashtag("fortnite")

How could I compare the hashtags of these both?



Solution 1:[1]

val compareResult = vlademir.hashtags == feton.hashtags

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ????? ?????