Skip to content

Instantly share code, notes, and snippets.

@kenilt
kenilt / MutableListTypeAdapter.kt
Last active August 2, 2018 05:57
Gson: Treat null as empty string or empty array
import com.google.gson.TypeAdapter
import com.google.gson.stream.JsonReader
import com.google.gson.stream.JsonToken
import com.google.gson.stream.JsonWriter
import java.io.IOException
class MutableListTypeAdapter<T>(private val delegate: TypeAdapter<MutableList<T>>?) : TypeAdapter<MutableList<T>>() {
@Throws(IOException::class)
override fun write(out: JsonWriter?, value: MutableList<T>?) {
import java.math.BigDecimal
import java.text.SimpleDateFormat
import java.util.*
abstract class Benchmark(internal val name: String) {
@Throws(Throwable::class)
internal abstract fun run(iterations: Int)
private fun time(): BigDecimal {
package com.facebook
object AccessTokenCreator {
fun createToken(grantedPermissions: Collection<String?>?): AccessToken? {
return AccessToken("token", "appId", "userId", grantedPermissions,
ArrayList<String>(), null, AccessTokenSource.WEB_VIEW, null, null, null)
}
}