[Java in NetBeans] Lesson 14. ArrayList and Collections
这个课程的参考视频和图片来自youtube。
主要学到的知识点有:
1. Collection: container that contians objects.
2. Difference between Collection and Array
collection | array | example |
Dynamic siized | fixed sized | int[] grades = new int[20] |
cannot | Primitive types | ArrayList<integer> grades = new ArrayList<>(); |
note: int => Integer
double => Double
3. ArrayList: an implemnetation of a collection.
- Create a ArrayList. (assume that we have a Card class has number and suit)
ArrayList<Card> cards = new ArrayList<>():
- Add element in the ArrayList
cards.add(new Card(8, Diamond));
cards.add(new Card(6, Diamond));
- Remove element in the ArrayList
Card temp = cards.remove(); // will move the first elemnt in the ArrayList
- Set element in the ArrayList
cards.set(, new Card(, Diamond)); // will set the first elemnt in the ArrayList
- Get element in the ArrayList
cards.get(); // will get the first elemnt in the ArrayList
- Insert element in the ArrayList
cards.add(, new Card(, Diamond)); // will add Diamond 1 at the first elemnt in the ArrayList
[Java in NetBeans] Lesson 14. ArrayList and Collections的更多相关文章
- [Java in NetBeans] Lesson 15. Sorting and Searching.
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Build in functions in java.util.Collections Need to implement a co ...
- [Java in NetBeans] Lesson 07. JavaDoc and Unit Tests
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. organize code into packages Create a package if want to make th ...
- [Java in NetBeans] Lesson 04. Class / Objects
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Class: Blueprint for an object. (e.g. dog is a class) Object: cust ...
- [Java in NetBeans] Lesson 00. Getting Set-up for Learning Java
这个课程的参考视频在youtube. 主要学到的知识点有: set up needs Java SE JDK, NetBeans IDE class name should be the same l ...
- [Java in NetBeans] Lesson 17. File Input/Output.
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...
- [Java in NetBeans] Lesson 16. Exceptions.
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...
- [Java in NetBeans] Lesson 10. For Loops
这个课程的参考视频和图片来自youtube. 主要学到的知识点有:(the same use in C/C++) 1. x++, x += 1; similar x--, x -= 1; x *= 2 ...
- [Java in NetBeans] Lesson 09. Switch / If-Else Ladder
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. Nested If-else statement (if-else ladder) /** * 90 and above == ...
- [Java in NetBeans] Lesson 06. Custom classes
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Constructors: A special method called when an object of the class ...
随机推荐
- easyui---editgrid
on 点击新增用户,不是弹出一个一个dialog,而是直接在表格下面增加一行可编辑的,然后点击保存就可以新增 第一步:加一个toolbar,在handler中当点击新增用户,会调用datagrid的a ...
- poj1734 Sightseeing trip【最小环】
Sightseeing trip Time Limit: 1000MS Memory Limit: 65536K Total Submissions:8588 Accepted:3224 ...
- ubuntu16.04使用Qt开发ROS
本文介绍一种Qt下进行ROS开发的完美方案,使用的是ros-industrial的Levi-Armstrong在2015年12月开发的一个Qt插件ros_qtc_plugin,这个插件使得Qt“新建项 ...
- JS之JSON.parse和JSON.stringify
这两个函数有兼容性问题, 会报错JSON"未定义 解决方案, 引入json2.js,可以解决浏览器的兼容性 https://link.jianshu.com/?t=https://githu ...
- oplog
参考资料:https://www.cnblogs.com/ruizhang3/p/6539730.html http://www.jb51.net/article/113432.htm :insert ...
- LeetCode 868 Binary Gap 解题报告
题目要求 Given a positive integer N, find and return the longest distance between two consecutive 1's in ...
- 使用反向代理的http的请求流程
此文章主要为刚接触反向代理的小伙伴梳理请求流程,以便更好的理解反向代理是何时工作的 流程 由于浏览器是有缓存的,所以本地的hosts文件的信息也会在浏览器端缓存 当客户端发起一个新的请求(例如:输入的 ...
- es中的停用词
停用词主要是为了提升性能与精度.从早期的信息检索到如今,我们已习惯于磁盘空间和内存被限制为很小一部分,所以 必须使你的索引尽可能小. 每个字节都意味着巨大的性能提升. 词干提取的重要性不仅是因为它让搜 ...
- SpringBoot-@async异步执行方法
启动加上@EnableAsync ,需要执行异步方法上加入 @Async 在方法上加上@Async之后 底层使用多线程技术 演示代码: @RestController @Slf4j public c ...
- (1.13)mysql优化数据库对象
(1.13)mysql优化数据库对象 1.mysql优化数据库对象 [1.1]数据库对象类型优化 select * from test1 procedure analyse(); ,); --不要为那 ...