Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix: array with specified capacity

  • Loading branch information...
commit e996e02a5fa21b1535f75b6558a40a118a723ae7 1 parent 586a529
@vladlichonos authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/com/vlad/android/kotlin/KotlinParcelable.kt
View
4 src/com/vlad/android/kotlin/KotlinParcelable.kt
@@ -2,10 +2,12 @@ package com.vlad.android.kotlin
import android.os.Parcelable
import android.os.Parcel
+import jet.runtime.Intrinsic
+import java.util.ArrayList
public inline fun CreateParcelable<T: Parcelable>(create: (Parcel) -> T?): Parcelable.Creator<T> {
return object : Parcelable.Creator<T> {
public override fun createFromParcel(p0: Parcel?): T? = if (p0 != null) create(p0) else null
- public override fun newArray(p0: Int): Array<T?>? = array<T?>()
+ public override fun newArray(p0: Int): Array<T?>? = ArrayList<T?>(p0).toArray<T?>()
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.