java 创建整数列表
什么是清单? (What is list?)
List in an interface, which is implemented by the ArrayList, LinkedList, Vector and Stack. It is an ordered collection of the object, where duplicate objects can also be stored.
接口中的列表,由ArrayList,LinkedList,Vector和Stack实现。 它是对象的有序集合,也可以在其中存储重复的对象。
In this example, we are performing following operations:
在此示例中,我们将执行以下操作:
Creating a list of integers - implemented by ArrayList
创建整数列表-由ArrayList实现
Printing the empty List
打印空列表
Adding elements to the List and printing
将元素添加到列表并打印
Adding elements to the List at given indexes and printing
在给定索引处将元素添加到列表并打印
Removing elements from the List by index and printing
通过索引从列表中删除元素并打印