Stdlib
Composite Recipes
Recipes that include further recipes, often including the individual recipes below.
- Apply Kotlin collection shorthands
- Apply Kotlin standard-library idioms
- Apply Kotlin string shorthands
- Prefer
emptyList()/emptySet()/emptyMap()over zero-arg builders
Recipes
- Use
distinct()instead oftoHashSet().toList() - Use
distinct()instead oftoSet().toList() - Use
distinct().toMutableList()instead oftoSet().toMutableList() - Use
drop(n)instead ofsubstring(n)on aString - Use
emptyList<T>()instead oflistOf<T>() - Use
emptyMap<K, V>()instead ofmapOf<K, V>() - Use
emptySet<T>()instead ofsetOf<T>() - Use
isBlank()instead oftrim().isEmpty()on aString - Use
isNotBlank()instead oftrim().isNotEmpty()on aString - Use
take(n)instead ofsubList(0, n) - Use
take(n)instead ofsubstring(0, n)on aString - Use
toList()instead ofasSequence().toList() - Use
toList()instead oftoMutableList().toList() - Use
toSet()instead oftoList().toSet() - Use
toSet()instead oftoMutableSet().toSet()