集合对象可能包括任何数据类型的元素。
Collection objects might contain elements of any data types.
在尝试向泛型集合(本例中为List)添加错误类型的元素时,清单2中的程序会生成编译时错误消息。
Listing 2 contains a program that generates the compilation-time error message that happens when you try to add the wrong type of element to a generic collection - a List in this case.
与任何容器类型一样,可以使用内置的len方法查明集合中元素的数量。
As is the case with any container type, you can use the built-in len method to find out how many items are in the collection.
应用推荐