zoukankan      html  css  js  c++  java
  • 关于集合常见的问题

    1、ArrayList和LinkedList有何区别?

    ArrayList是基于动态数组的数据结构,LinkedList是基于链表的数据结构;对于随机访问get和set,ArrayList较优,因为LinkedList要移动指针;对于新增和删除操作add和remove,LinkedList较优,因为ArrayList要移动数据。

    2.HashMap和HashTable区别?

    2.1HashMap允许空键值,Hashtable不允许;

    2.2HashMap继承AbstractMap,HashTable继承Dictionary类,两者都实现了Map接口;

    2.3HashMap的方法不是同步的,Hashtable的方法使同步的

    3.Iterater和Listlterator之间有什么区别?

    3.1Iterater用来遍历Set集合和List集合,而Listlterator只能遍历List;

    3.2Iterater只可以向前遍历,而Listlterator可以双向遍历;

    3.3Listlterator从Iterator接口继承,然后添加一些额外的功能,比如添加一个元素,替换一个元素,获取前面或后面元素的索引位置;

  • 相关阅读:
    matplotlib种类
    matplotlib安装
    Python input保证输入为int类型
    centos7 安装 smplayer
    matplotlib与numpy
    Windows系统pip安装whl包
    python3打开winodows文件问题
    centos7 python3 pip
    Python实战171203统计
    Python实战171202元组访问
  • 原文地址:https://www.cnblogs.com/lichangyun/p/9583860.html
Copyright © 2011-2022 走看看