How to change the field name of Pair
?
The code like this :
val distributorNotes = ArrayList<PairDistributorNotes<String, String>>()
distributorNotes.add(PairDistributorNotes("350631771", "test"))
data class PairDistributorNotes<out x, out y>(val distributor_id: x, val note: y) {
override fun toString(): String = "($distributor_id, $note)"
}
and i create asReverse(
) with distinctBy
val dataJson = Gson().toJson(distributorNotes.asReversed().distinctBy { it.distributor_id })
Output from dataJson :
[{"a":"350631771","b":"test"}]
Can field a and b change to distributor_id and note ?
Expected
[{"distributor_id":"350631771","note":"test"}]