Scala: Array / ArrayBuffer (Introduction / common method of example)

Group not variables : the length of the immutable, the content of the variable Array

Variable Array : length array are variable ArrayBuffer

Array definition Methods:

The value

Assignment

Note that the array of different values ​​and assignment of java, java use [], is used Scala ()

Array variable

We first need to import the package

Add elements + =

Removing elements - =

Between the array splice ++ =

To delete an array - =

Add the element at the specified position insert

Delete the specified location element remove

Delete element at index 1

Delete the index from the beginning two elements

To delete an element from the beginning of the last element trimEnd

Deduplication  distinct

An array of inverted  reverse

Array taken: Slice (from, an until)   (left and right open and closed)

Guess you like

Origin blog.csdn.net/drl_blogs/article/details/91553473