I tend to use a Deque
when I need a FIFO queue. There are plenty of cases where this would be used in multi-platform code, including message queues. The reasons for using Deque
rather than ArrayDeque
are the general reasons why one may want to use interfaces instead of classes in interface definitions (analogous to List
vs MutableList
vs ArrayList
). The problem with a virtual type ArrayDeque
that decays to the java version on the jvm is that if this type doesn’t provide the interfaces and I want/need interfaces I cannot actually use the kotlin.ArrayDeque
provided because its common definition does not declare it to implement the Deque
interface.