If you need a multiplatform stack or ring buffer, CircularArray from androidx.collections is the way to go. I benchmarked it against ArrayDeque and it has identical performance on jvm and anywhere between 20-50% better performance on native platforms