scala collections - A (strictly) `Growable` mutable `Seq` -


i need (mutable) seq only growable. not need update index or shrink collection or transform (or other form of mutation), grow (+=) , want actively protect collection other mutations.

  • the problem buffers not growable shrinkable , can transformed.
  • (mutable.)seq not shrinkable can transform , not growable

to (cursory) understanding of scala collection, there no concrete implementation has exact traits i'm looking believe have implement own?

edit:

i tried val hands : collection.seq[team] growable[team] = mutable.seq[team]() in attempt make nominal type conform requirements, actively preventing client call undesired mutating methods on hands says types not conform.

i think looking

  val hands : collection.seq[team] growable[team] = mutable.buffer[team]() 

Comments