SublistMerger¶
class SublistMerger<A : Any>(initialElements: List<A>, val destination: MutableList<A>)
With each call to merge, SublistMerger can merge all elements of a specific (reified) type into a single element using a supplied constructor and then add it to destination. Unmerged elements are added to destination using finish.
The purpose of SublistMerger is to merge multiple different types of elements from a single origin list without the need for intermediate list management and partitionIsInstance boilerplate.
Constructors¶
SublistMerger¶
constructor(initialElements: List<A>, destination: MutableList<A>)
Properties¶
destination¶
val destination: MutableList<A>
remainingElements¶
var remainingElements: List<A>
Functions¶
finish¶
fun finish()