Parcelable: Support SortedSet, NavigableSet, SortedMap, NavigableMap
This commit is contained in:
+8
-2
@@ -19,7 +19,9 @@ data class Test(
|
||||
val f: MutableSet<String>,
|
||||
val g: TreeSet<String>,
|
||||
val h: HashSet<String>,
|
||||
val i: LinkedHashSet<String>
|
||||
val i: LinkedHashSet<String>,
|
||||
val j: NavigableSet<String>,
|
||||
val k: SortedSet<String>
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
@@ -32,7 +34,9 @@ fun box() = parcelTest { parcel ->
|
||||
f = mutableSetOf("F"),
|
||||
g = TreeSet<String>().apply { this += "G" },
|
||||
h = HashSet<String>().apply { this += "H" },
|
||||
i = LinkedHashSet<String>().apply { this += "I" }
|
||||
i = LinkedHashSet<String>().apply { this += "I" },
|
||||
j = TreeSet<String>().apply { this += "J" },
|
||||
k = TreeSet<String>().apply { this += "K" }
|
||||
)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
@@ -45,4 +49,6 @@ fun box() = parcelTest { parcel ->
|
||||
assert(first == first2)
|
||||
assert((first.d as LinkedList<*>).size == 1)
|
||||
assert((first2.h as HashSet<*>).size == 1)
|
||||
assert(first2.j is NavigableSet<*>)
|
||||
assert(first2.k is SortedSet<*>)
|
||||
}
|
||||
+8
-2
@@ -15,7 +15,9 @@ data class Test(
|
||||
val b: MutableMap<String, String>,
|
||||
val c: HashMap<String, String>,
|
||||
val d: LinkedHashMap<String, String>,
|
||||
val e: TreeMap<String, String>
|
||||
val e: TreeMap<String, String>,
|
||||
val f: SortedMap<String, String>,
|
||||
val g: NavigableMap<String, String>
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
@@ -24,7 +26,9 @@ fun box() = parcelTest { parcel ->
|
||||
b = mutableMapOf("A" to "B"),
|
||||
c = HashMap<String, String>().apply { put("A", "B") },
|
||||
d = LinkedHashMap<String, String>().apply { put("A", "B") },
|
||||
e = TreeMap<String, String>().apply { put("A", "B") }
|
||||
e = TreeMap<String, String>().apply { put("A", "B") },
|
||||
f = TreeMap<String, String>().apply { put("A", "B") },
|
||||
g = TreeMap<String, String>().apply { put("A", "B") }
|
||||
)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
@@ -37,4 +41,6 @@ fun box() = parcelTest { parcel ->
|
||||
assert(first == first2)
|
||||
assert((first.c as HashMap<*, *>).size == 1)
|
||||
assert((first2.e as TreeMap<*, *>).size == 1)
|
||||
assert(first2.f is SortedMap<*, *>)
|
||||
assert(first2.g is NavigableMap<*, *>)
|
||||
}
|
||||
Reference in New Issue
Block a user