[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 ...
随机推荐
- E - 487--3279
Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is ...
- Jwt 中 token应该存储到哪里?
关于 token 的存储问题 JWT: csrf 攻击无法获取第三方的 cookie,而是直接使用 cookie进行查询的时候会自动携带 cookie. xss攻击通过代码注入可以获取 cookie. ...
- Quartz任务调度实践
最近在写一个任务调度程序,需要每隔几秒查询数据库,并取出数据做一些处理操作.使用到了Quartz任务调度框架. 基本概念 Quartz包含几个重要的对象,分别为任务(Job),触发器(Trigger) ...
- linux下安装svn出现configure: error: We require OpenSSL; try --with-openssl
linux下安装svn出现configure: error: We require OpenSSL; try --with-openssl http://blog.csdn.net/woshixion ...
- MySQL介绍,下载,安装,配置
MySQL用了很多年了,今天写个总结. 一.介绍 MySQL是开源软件,后来归Oracle所有.开源便于软件的完善改进.但开源不等于滥用,也不等于完全免费.MySQL有商业版,商业用途是付费的.也有免 ...
- 试水Spring Cloud Hystrix
Spring Cloud Hystrix是一个容错库,它实现了断路器模式,使得当服务发生异常时,会自动切断连接,并将请求引导至预设的回调方法. 服务端 在Spring Tool Suite的文件菜单中 ...
- 删除一个cjson导致系统死机
一个未使用,未分配的cjson指针应该被删除,如果尝试删除一个 未分配,未启用的cjson将导致内存出错,死机.
- [No0000175]maven常用命令集合(收藏大全)
抽了点时间,整理了一些maven常用命令参数,以便参考:参考了maven官网和网上其他一些maven追随者的文件,不在此一一列举,但表示感谢! mvn命令参数 mvn -v, --version 显示 ...
- [No0000DD]C# StringEx 扩展字符串类 类封装
using System; using System.Text.RegularExpressions; namespace Helpers { /// <summary> /// 包含常用 ...
- C 缓冲区过读 if (index >= 0 && index < len)
C 缓冲区过读 if (index >= 0 && index < len) CWE - CWE-126: Buffer Over-read (3.2) http://cw ...