使用add()从ArrayList到push_back.
因为pop_back你必须使用索引来玩更多remove().
我们来看看这个例子:
// push_back equivalent
ArrayList<int> a = new ArrayList<int>();
a.add(2); // Add element to the ArrayList.
a.add(4);
// pop_back equivalent.
a.remove(a.size()-1); // Remove the last element from the ArrayList.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9687 次 |
| 最近记录: |