[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 ...
随机推荐
- I - 取石子游戏
有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两堆中同时取走相同数量的石子.最后把石子全部取完者为胜者. ...
- PHP数组总结,,PHP面向对象思维思路。
<?php //定义数组 $attr = array(); $attr[] = ; //索引数组 $attr = array(,,,); //关联数组 $attr = array("c ...
- PHP 代 码 操 作 文 件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- asp.net 访问页面访问统计实现 for iis7
上一篇博文中< asp.net 访问页面访问统计实现 > 中在win10 (iis8+)上运行没有问题, 但客户机子是windows server 2008 的 iis7弄死不对,最好 ...
- ESP8266 nodemcu
主要资料来源于一下几个网站 1.nodemcu官网:此处有几个示例和github(用处不大) 2.用户说明:http://nodemcu.readthedocs.io/en/master/ (非常重 ...
- GIS软件相关安装(持续更新)
软件安装是GIS专业的必修课,总会忘记步骤,在此汇总 1.oracle ①无法登录 管理员登录 sqlplus sys/密码 as sysdba https://www.linuxidc.com/li ...
- display style edit
https://html.spec.whatwg.org/multipage/interaction.html#attr-contenteditable <!doctype html> & ...
- Anaconda 虚拟环境安装及应用
首先要安装Anaconda 下载网址:https://www.anaconda.com/distribution/#download-section Miniconda下载网址:https: ...
- 洛谷P5234 越狱老虎桥 [JSOI2012] tarjan
正解:tarjan+贪心(?并不会总结是什么方法QAQ,,, 解题报告: 传送门! 这题是真的题意杀,,,我我我要不是之前知道题目大意了我怕是怎么看都看不懂这是个什么意思昂QAQ 所以先说下题目大意好 ...
- Git 常用命令和统计代码量
摘要 分享Git日常操作中常用的命令,分享如何统计在项目中贡献的代码量. 下面列出Git bash常用命令. 1. git clone **(项目地址) 克隆一个git项目到本地,将git项目拉取到本 ...