Maximum Length for scala queue
问题 I'm curious if Scala has some gem hidden in its collection classes that I can use. Basically I'm looking for something like a FIFO queue, but that has an upper-limit on its size such that when the limit is hit, the oldest (first) element is removed from the queue. I've implemented this myself in Java in the past, but I'd rather use something standard if possible. 回答1: An often preferable alternative to subclassing is the (unfortunately named) "pimp my library" pattern. You can use it to add