arekolek
08/18/2017, 3:45 PMextras
.getParcelableArray(LocationPicker.INPUT_POLYGON)
.filterIsInstance<LatLng>()
.forEach(inputPolygon1::add)
nickk
08/18/2017, 3:55 PMarekolek
08/18/2017, 3:57 PMinline fun <reified T> Bundle.getTypedArray(key: String) = getParcelableArray(key).filterIsInstance<T>()
addAll
in your polygon, you could then do: inputPolygon1.addAll(extras.getTypedArray<LatLng>(LocationPicker.INPUT_POLYGON))
nickk
08/18/2017, 4:04 PMarekolek
08/18/2017, 4:12 PMinline fun <reified R> Iterable<*>.mapAsInstance() = map { it.apply { check(this is R) } as R }
instead of dropping those items silently. (see also https://stackoverflow.com/a/36570969 )