Fudge
06/29/2019, 6:30 AMenum class Test{
foo
}
Then kotlin comes built in with values(), valueOf()
, but how can I add a new helper method like getValueNames()
?gildor
06/29/2019, 7:05 AMFudge
06/29/2019, 9:10 AMkotlin
interface SecondName{
val str : String
}
enum Test(override val str : String) : SecondName{
One(“1”),Two(“2”)
}
//and then do something like
fun <T>class<T>.allSecondNames() where T: SecondName, T: Enum<T>{
return values().map{it.str}
}
//and then do
val names = Test.allSecondNames()
gildor
06/29/2019, 10:28 AM