Ir al contenido

Expensive Object In Loop (ARCH8072)

Esta página aún no está disponible en tu idioma.

Key kotlin.performance.expensive-object-in-loop · Severity warning · Category performance

Flags SimpleDateFormat, ObjectMapper, Gson, DecimalFormat or MessageDigest constructed inside a loop body.

for (r in rows) { val f = SimpleDateFormat("yyyy"); f.format(r.at) }
val f = SimpleDateFormat("yyyy")
for (r in rows) f.format(r.at)

Create the object once outside the loop (or as a property) and reuse it.