Scala之ArraryButter使用

  • 构造器
 var sm= new ArrayBuffer[Int]();

如果括号里没有填写数值,默认值为16

  • clear()
    将数组所有的元素赋值为null

  • +=
    向数组中添加一个元素,返回值为this.type

  • +=:
    向数组的头部插入一个元素,返回值为this.type

  • remove(n,c=1)
    将数组从n处向后删除c个元素,c的默认值为1

猜你喜欢

转载自blog.csdn.net/xiaoqie159/article/details/84520676