Dissecting the Program
  • Line 2-4 imports the collection framework classes and interfaces reside in the java.util package.
  • The class hierarchy of the ArrayList is shown above. We observe that ArrayList implements ListCollection and Iterable interfaces. The Collection and Iterableinterfaces define the common behaviors of all the collection implementations. Interface Collection defines how to add and remove an element into the collection. Interface Iterable defines a mechanism to iterate or transverse through all the elements of a collection. Instead of using the interface Collection directly, it is more common to use one of its sub-interfaces, List (an ordered list supporting indexed access), Set (no duplicate elements) or Queue (FIFO, priority queues).
  • In line 8, we construct an ArrayList instance, and upcast it to the List interface. This is possible as the ArrayList implements List interface. Remember that a good program operates on the interfaces instead of an actual implementation. The Collection Framework provides a set of interfaces so that you can program on these interfaces instead of the actual implementation.

https://www.ntu.edu.sg/home/ehchua/programming/java/J5c_Collection.html

java 集合类 列表的更多相关文章

  1. Java集合类--温习笔记

    最近面试发现自己的知识框架有好多问题.明明脑子里知道这个知识点,流程原理也都明白,可就是说不好,不知道是自己表达技能没点,还是确实是自己基础有问题.不管了,再巩固下基础知识总是没错的,反正最近空闲时间 ...

  2. 摘抄转载前辈们的Java集合类总结

    本文摘自 Blue Sky:http://www.cnblogs.com/hubcarl JAVA 集合类介绍和使用 类关系示意图Iterable(接口) │ └--Collection (接口) ├ ...

  3. Java集合类中的哈希总结

    JAVA集合类中的哈希总结 目 录 1.哈希表 2.Hashtable.HashMap.ConcurrentHashMap.LinkedHashMap.TreeMap区别 3.Hashtable.Ha ...

  4. java集合类(五)About Map

    接上篇“java集合类(四)About Set” 这次学完Map之后,就剩队列的知识,之后有关java集合类的学习就将告一段落,之后可能会有java连接数据库,I/O,多线程,网络编程或Android ...

  5. java集合类(三)About Iterator & Vector(Stack)

    接上篇:java集合类学习(二) Talk about “Iterator”: 任何容器类,在插入元素后,还需要取回元素,因为这是容器的最基本工作.对于一般的容器,插入有add()相关方法(List, ...

  6. java 集合类基础问题汇总

     1.Java集合类框架的基本接口有哪些? 参考答案 集合类接口指定了一组叫做元素的对象.集合类接口的每一种具体的实现类都可以选择以它自己的方式对元素进行保存和排序.有的集合类允许重复的键,有些不允许 ...

  7. java 集合类Array、List、Map区别和优缺点

    Java集合类主要分为以下三类: 第一类:Array.Arrays 第二类:Collection :List.Set第三类:Map :HashMap.HashTable 一.Array , Array ...

  8. Java集合详解8:Java集合类细节精讲

    今天我们来探索一下Java集合类中的一些技术细节.主要是对一些比较容易被遗漏和误解的知识点做一些讲解和补充.可能不全面,还请谅解. 本文参考:http://cmsblogs.com/?cat=5 具体 ...

  9. Java集合类常见的问题

    本篇文章将尝试回答一些Java集合类常见的问题,以作知识梳理之用. ArrayList和LinkList以及Vector的区别 就实现方式而言: ArrayList是以数组的方式实现的列表. Link ...

随机推荐

  1. 一文让你彻底理解准确率,精准率,召回率,真正率,假正率,ROC/AUC

    参考资料:https://zhuanlan.zhihu.com/p/46714763 ROC/AUC作为机器学习的评估指标非常重要,也是面试中经常出现的问题(80%都会问到).其实,理解它并不是非常难 ...

  2. [转帖]Druid介绍及入门

    Druid介绍及入门 2018-09-19 19:38:36 拿着核武器的程序员 阅读数 22552更多 分类专栏: Druid   版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议 ...

  3. 67 GC 垃圾回收机制

    GC是JVM中自带的一个线程 他会不定时来堆中回收那些不再使用的对象,以释放内存 可以通过System.gc()来主动建议jvm尽快调度gc来回收垃圾 不同的平台的jvm对GC的策略是有所不同的 我们 ...

  4. Win 10卡顿怎么办?解决win10卡顿的方法大汇总

    最近微软开始向Windows 10用户推送创造者更新(Creators Update),相信也有很多小伙伴已经尝鲜了这一最新的版本.而对于win10的使用体验,很多小伙伴第一个抱怨的问题便是win10 ...

  5. 【LeetCode】680. Valid Palindrome II

    Difficulty:easy  More:[目录]LeetCode Java实现 Description https://leetcode.com/problems/valid-palindrome ...

  6. WPF设置全局控件样式

    原文:WPF设置全局控件样式 方法: 在资源文件APP.XAML中添加如下资源 <Application x:Class="_360UI.App" xmlns="h ...

  7. spring接口文档注解:@ApiOperation

    @ApiOperation不是spring自带的注解是swagger里的 com.wordnik.swagger.annotations.ApiOperation; @ApiOperation和@Ap ...

  8. c#高效准确的条形码、线性条码、QR二维码读写类库-SharpBarcode介绍

    SharpBarcode是一款支持.NET(C#,VB)的高效易用的条形码.QR二维码的读取和生成类库. 主要功能: 1.支持几乎所有常见类型的线性条形码和QR二维码的读取,高效读取,准确率高. 2. ...

  9. 【转载】C#通过InsertAt方法在DataTable特定位置插入一条数据

    在C#中的Datatable数据变量的操作过程中,可以通过DataTable变量的Rows属性的InsertAt方法往DataTable的指定位置行数位置插入一个新行数据,即往DataTable表格指 ...

  10. $parsers & $formatters

    一.理解 $parsers 和 $formatters Angular 是MVVM框架,model层数据变化了会通知view层更新,同样的view层更新了也会通知到model $parsers 和 $ ...