Sha256: 05c5f089abd05d2fd85c70772c0a00025091d96ad1a8c27b54606b3401495e7c
Contents?: true
Size: 344 Bytes
Versions: 396
Compression:
Stored size: 344 Bytes
Contents
object Flattener { fun flatten(unflattened: Collection<Any?>): List<Any> { return unflattened.filterNotNull().fold(mutableListOf(), { accum, element -> accum.addFlattened(element); accum }) } fun MutableCollection<Any>.addFlattened(item: Any) = if (item is Collection<*>) this.addAll(flatten(item)) else this.add(item) }
Version data entries
396 entries across 396 versions & 1 rubygems