zoukankan      html  css  js  c++  java
  • The Clollections Hierarchy 集合层次结构

    Inheritance is a defining feature of the Collections API.The interfaces that are used to manipulate the collections specify the operations that must be defined for any container class that implements that interface.

    The diagram below shows that the ArrayList class implements the List interface .

    Collections and Generics 集合和泛型

     The collections classes are generic, with type parameters.

    Thus ,List<E> and ArrayList<E> contain elements of type E.
    When a generic classs is declared ,the type parameter is replaced by an actual object type.For example,
          private ArrayLIst<Clown> clowns ;

    NOTE
    1. The clowns list must contain only Clown objects . An attempt to add an Acrobat to the list ,for example , will caruse a compile-time error .
    2. Since the type of objects in a generic class rs restricted, the elements can be accessed without casting .
    3. All of the type information in a program with generic classs is examined at compile time.After compilation the type infomation is erased . This feature of generic classes is known as erasure. During execution of the program ,any attempt at incorrect casting or comparisons will lead to run-time errors.

  • 相关阅读:
    poj 1273 Drainage Ditches
    网络流之--混合图的欧拉回路 出自yzmduncan.iteye.com/blog/1149049
    hdu 2203 亲和串 kmp
    hdu 1711 kmp
    KMP算法详解 出自matrix67.com
    zoj 2016 Play on Words 欧拉回路
    修改document.domain的注意事项(转)
    ActiveXObject函数详解(转)
    angularjs
    sbt
  • 原文地址:https://www.cnblogs.com/hzhuxin/p/15706630.html
Copyright © 2011-2022 走看看