Professional Documents
Culture Documents
JPE C.L.U06 List Collection Checklist Full v1.0
JPE C.L.U06 List Collection Checklist Full v1.0
Lecture Checklist
Code 25e-BM/HR/HDCV/FSOFT
Version 1.0
Effective Date 1-Jul-2019
678174952.xlsx v1.7
Lecture Checklist
Project Code: "YES"
Reviewer(s): "NO"
Version of the work product: "N/A"
Review date:
Work product' size:
Effort spent on audit (person-hour):
#REF!
No Checked Items Assessment
List Collection
* Comments
* Suggestion
[ ] - Pass
[ ] - Review again
0
0
0
Notes Priority
- List là một interface trong bộ Collection, cho phép lưu trữ các giá trị trùng lặp.
- List có 3 lớp con thực hiện implements trực tiếp là : ArrayList, Vector, LinkedList. Mandatory
- Array:
+ Là một mảng tĩnh (không thể thay đổi size một khi đã thực hiện khởi tạo).
+ Có thể lưu trữ được cả dữ liệu nguyên thủy (primitive) và dữ liệu dạng đối tượng (object).
+ Cho phép tạo mảng đa chiều.
- ArrayList: Mandatory
+ Là một mảng động (size có thể thay đổi theo số lượng phần tử).
+ Chỉ lưu trữ được các dữ liệu kiểu đối tượng (object).
+ Chỉ có thể 1 khởi tạo chiều.
- Sử dụng Interator: //Có thể vừa duyệt vừa xóa element trong list. Mandatory
VD: List<Integer> list = new ArrayList<Integer>();
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
System.out.print(iterator.next());
}
- Iterator là một interface thuộc gói java.util dùng đề duyệt các phần tử theo một chiều và cho phép có thể vừa duyệt
vừa xóa.
- Iterator có thể được sử dụng trong List, Set và Queue.
- Iterator cung cấp 3 methods:
+ hasNext() : boolean - trả về true nếu còn phần tử và ngược lại.
+ next() : E - lấy phần tử tiếp theo
+ remove() : void - xóa đi phần tử đang được next() tới.
VD:
List<String> animals = new ArrayList<String>();
animals.add("fox");
animals.add("cat");
animals.add("dog");
animals.add("rabbit");
RECORD OF CHANGE
No Effective Date Version Change Description Reason Reviewer
1 N/A 1.0 Newly issue Apply for Lab/Assignment DienNT1
2 1-Jul-19 1.0 Update Update for Release DuongTQ
3
4
5
6
7
8
Approver
VinhNV
VinhNV