Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

C HAPTER 24 · The Scala Collections API Table 24.4 · Operations in trait Buffer What it is Additions: buf += x What it does Appends element x to buffer buf , and returns buf itself as result Appends given elements to buffer Appends all elements in xs to buffer Prepends element x to buffer Prepends all elements in xs to buffer Inserts element x at index i in buffer Inserts all elements in xs at index i in buffer buf += (x, y, z) buf ++= xs x +=: buf xs ++=: buf buf insert (i, x) buf insertAll (i, xs) Removals: buf -= x buf remove i buf remove (i, n) Removes element x from buffer Removes element at index i from buffer Removes n elements starting at index i from buffer