Skip to content

GsonExtensions

Birju Vachhani edited this page Sep 25, 2019 · 4 revisions

Examples

Clone Any object right away

Gson uses serialization and deserialization to clone objects. So Any property that can't be serialized or outside of gson's scope won't be cloned.

    val car = Car()
    val car2 = car.createClone()

Clone ArrayList

    val list = ArrayList<Car>()
    val newList = list.createClone()

For more information, look at the GsonExtensions.kt file.