Skip to content

Commit ba0882f

Browse files
committed
修改目录结构
1 parent 0104f61 commit ba0882f

7 files changed

+382
-0
lines changed

day17/Collection集合总结.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
1��Collection������ϵ�ṹ
2+
Collection
3+
|--List(Ԫ�����򣬿��ظ�)
4+
|--ArrayList
5+
�ײ����ݽṹ�����飬��ѯ��,��ɾ��
6+
�̲߳���ȫ,Ч�ʸ�
7+
|--Vector
8+
�ײ����ݽṹ�����飬��ѯ��,��ɾ��
9+
�̰߳�ȫ,Ч�ʵ�
10+
|--LinkedList
11+
�ײ����ݽṹ����������ѯ��,��ɾ��
12+
�̲߳���ȫ,Ч�ʸ�
13+
|--Set(Ԫ������Ψһ)
14+
|--HashSet
15+
�ײ����ݽṹ�ǹ�ϣ����
16+
��֤Ԫ�ص�Ψһ��?
17+
������������hashCode()��equals()��
18+
|--LinkedHashSet
19+
�ײ����ݽṹ�ǹ�ϣ��������
20+
�ɹ�ϣ����֤Ԫ��Ψһ
21+
��������֤Ԫ������
22+
|--TreeSet
23+
�ײ����ݽṹ�Ƕ�����(�����)
24+
��֤Ԫ�ص�Ψһ��?
25+
���ݱȽϵķ���ֵ�Ƿ���0
26+
��֤Ԫ�ص�����?
27+
��Ȼ����
28+
�Ƚ�������
29+
30+
2�����Collection����׼��ʹ��˭?
31+
Ԫ��Ψһ��?
32+
�ǣ�Set
33+
Ҫ������?
34+
�ǣ�TreeSet
35+
��HashSet
36+
37+
��֪��������HashSet
38+
��List
39+
Ҫ��ȫ��?
40+
Ҫ��Vector(��ʵҲ���ã��и��õķ�ʽ�����潲)
41+
��Ҫ��ArrayList����LinkedList
42+
��ѯ�ࣺArrayList
43+
��ɾ�ࣺLinkedList
44+
45+
��֪��������ArrayList
46+
47+
��֪��������ArrayList
48+
49+
3�������е����ݽṹ����
50+
ArrayXxx:�ײ����ݽṹ�����飬��ѯ�죬��ɾ��
51+
LinkedXxx:�ײ����ݽṹ����������ѯ������ɾ��
52+
HashXxx:�ײ����ݽṹ�ǹ�ϣ����������������hashCode()��equals()���������ѡ���Ƿ��Զ���д
53+
TreeXxx:�ײ����ݽṹ�Ƕ������������ַ�������Ȼ���򣬱Ƚ�������
2.24 MB
Binary file not shown.
2.24 MB
Binary file not shown.

day17/day17总结.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
1����ϰ
2+
(1)��ȡ1-20֮��������10����Ҫ�����ظ�
3+
(2)����¼�������ݣ���0����������ȡ¼�������е����ֵ
4+
(3)Collection���ϵ�toString()����Դ��
5+
(4)��¼ע�᰸�����ϰ�
6+
7+
2��Set����(����)
8+
(1)Set���ϵ��ص�
9+
����Ψһ
10+
(2)HashSet����(����)
11+
A:Ԫ��Ψһ
12+
B:��α�֤Ԫ��Ψһ��?
13+
HashSet���ϵĵײ����ݽṹ�ǹ�ϣ����
14+
��ϣ����֤Ԫ��Ψһ����������������hashCode()��equals()
15+
���裺
16+
a:�����ж϶���Ĺ�ϣֵ�Ƿ���ͬ
17+
b:�����ͬ����ֱ�����ӵ�����
18+
�����ͬ���ͼ���ִ��equals()���бȽ�
19+
c:�������false����ֱ�����ӵ�����
20+
�������true��˵��Ԫ���ظ��������ӡ�
21+
C:���õ���
22+
����HashXxx��ʽ�ļ��ϣ�Ҫ��ס��д�����������ɡ����ң������������ǿ����Զ����ɵ�
23+
(3)LinkedHashSet
24+
�ײ����ݽṹ�ǹ�ϣ����������
25+
�ɹ�ϣ����֤Ԫ�ص�Ψһ�ԡ�
26+
��������֤Ԫ�ص�����(�洢˳���ȡ��˳��һ��)
27+
(4)TreeSet����(����)
28+
�ײ����ݽṹ�Ǻ������ƽ�������
29+
A:Ԫ��Ψһ��������Ҫ������
30+
B:��α�֤Ԫ��Ψһ����?
31+
���ݱȽϵķ���ֵ�Ƿ���0���ж�
32+
C:��α�֤Ԫ���������?
33+
���ַ�ʽ
34+
a:��Ȼ����(Ԫ�ؾ߱��Ƚ���)
35+
��Ԫ����������ʵ��Comparable�ӿ�
36+
b:�Ƚ�������(���Ͼ߱��Ƚ���)
37+
�������϶����ʱ�򣬽���Comparator�ӿڵ�ʵ���������Ϊ�������
38+
(5)����
39+
A:HashSet����
40+
�洢�ַ���������
41+
�洢�Զ�����󲢱���(�������ij�Ա����ֵ��ͬ��Ϊͬһ��ֵ)
42+
B:TreeSet����
43+
�洢�ַ���������
44+
�洢�Զ�����󲢱���(�������ij�Ա����ֵ��ͬ��Ϊͬһ��ֵ,���������С��������)
45+
C:��ȡ1-20֮��������10����Ҫ�����ظ�
46+
D:����¼��5��ѧ�����󣬲����ֽܷ�������

day17/二叉树结构.bmp

2.24 MB
Binary file not shown.
2.24 MB
Binary file not shown.

day17/要练习的代码.txt

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
���ϵIJ������裺
2+
A:�������϶���
3+
B:����Ԫ�ض���
4+
C:��Ԫ�����ӵ�����
5+
D:��������
6+
7+
���ϵı�����ʽ��
8+
Collection:������,��ǿfor
9+
|--List:��ͨfor
10+
|--Set:
11+
12+
�ַ���(���� hello,world,java)
13+
�Զ������(ѧ����)
14+
class Student {
15+
private String name;
16+
private int age;
17+
18+
public Student() {}
19+
20+
public Student(String name,int age) {
21+
this.name = name;
22+
this.age = age;
23+
}
24+
25+
public void setName(String name) {
26+
this.name = name;
27+
}
28+
29+
public String getName() {
30+
return name;
31+
}
32+
33+
public void setAge(int age) {
34+
this.age = age;
35+
}
36+
37+
public int getAge() {
38+
return age;
39+
}
40+
}
41+
42+
1��Collection
43+
A:�ַ���
44+
Collection<String> c = new ArrayList<String>();
45+
46+
c.add("hello");
47+
c.add("world");
48+
c.add("java");
49+
50+
Iterator<String> it = c.iterator();
51+
while(it.hasNext()) {
52+
String s = it.next();
53+
System.out.println(s);
54+
}
55+
56+
for(String s : c) {
57+
System.out.println(s);
58+
}
59+
60+
B:�Զ������
61+
Collection<Student> c = new ArrayList<Student>();
62+
63+
Student s1 = new Student("������",50);
64+
Student s2 = new Student("����׿",40);
65+
Student s3 = new Student("�⾩",30);
66+
67+
c.add(s1);
68+
c.add(s2);
69+
c.add(s3);
70+
71+
Iterator<Student> it = c.iterator();
72+
while(it.hasNext()) {
73+
Student s = it.next();
74+
System.out.println(s.getName()+"---"+s.getAge());
75+
}
76+
77+
for(Student s : c) {
78+
System.out.println(s.getName()+"---"+s.getAge());
79+
}
80+
81+
2��List
82+
A:�ַ���
83+
List<String> list = new ArrayList<String>();
84+
85+
list.add("hello");
86+
list.add("world");
87+
list.add("java");
88+
89+
Iterator<String> it = list.iterator();
90+
while(it.hasNext()) {
91+
String s = it.next();
92+
System.out.println(s);
93+
}
94+
95+
for(String s : list) {
96+
System.out.println(s);
97+
}
98+
99+
for(int x=0; x<list.size(); x++) {
100+
String s = list.get(x);
101+
System.out.println(s);
102+
}
103+
104+
B:�Զ������
105+
List<Student> list = new ArrayList<Student>();
106+
107+
Student s1 = new Student("������",50);
108+
Student s2 = new Student("����׿",40);
109+
Student s3 = new Student("�⾩",30);
110+
111+
list.add(s1);
112+
list.add(s2);
113+
list.add(s3);
114+
115+
Iterator<Student> it = list.iterator();
116+
while(it.hasNext()) {
117+
Student s = it.next();
118+
System.out.println(s.getName()+"---"+s.getAge());
119+
}
120+
121+
for(Student s : list) {
122+
System.out.println(s.getName()+"---"+s.getAge());
123+
}
124+
125+
for(int x=0; x<list.size(); x++) {
126+
Student s = list.get(x);
127+
System.out.println(s.getName()+"---"+s.getAge());
128+
}
129+
130+
3��ArrayList(���� �Լ�����)
131+
A:�ַ���
132+
ArrayList<String> array = new ArrayList<String>();
133+
134+
array.add("java");
135+
array.add("hello");
136+
array.add("world");
137+
138+
//��ͨforѭ��
139+
for(int i =0; i<array.size(); i++) {
140+
String s = array.get(i);
141+
System.out.println(s);
142+
}
143+
144+
//��ǿfor
145+
for(String s : array) {
146+
System.out.println(s);
147+
}
148+
149+
//������
150+
Iterator<String> it = array.iterator();
151+
while(it.hasNext()) {
152+
String s = it.next();
153+
System.out.println(s);
154+
}
155+
B:�Զ������
156+
ArrayList<Student> array = new ArrayList<Student>();
157+
158+
Student s1 = new Student("laozi",1000);
159+
Student s2 = new Student("kongzi",100);
160+
Student s3 = new Student("zhuangzi",10);
161+
162+
array.add(s1);
163+
array.add(s2);
164+
array.add(s3);
165+
166+
//��ͨforѭ��
167+
for (int i = 0; i<array.size(); i++) {
168+
Student s = array.get(i);
169+
System.out.println(s.getName()+"---"+s.getAge());
170+
}
171+
172+
//��ǿforѭ��
173+
for (Student s : array) {
174+
System.out.println(s.getName()+"---"+s.getAge());
175+
}
176+
177+
//������ѭ��
178+
for(Iterator<Student> it = array.iterator(); it.hasNext();) {
179+
Student s = it.next();
180+
System.out.println(s.getName()+"---"+s.getAge());
181+
}
182+
183+
184+
4��Vector(�Լ�����)
185+
A:�ַ���
186+
Vector<String> vector = new Voctor<String>();
187+
188+
vector.add("java");
189+
vector.add("hello");
190+
vector.add("world");
191+
192+
//��ͨforѭ��
193+
for(int i =0; i<vector.size(); i++) {
194+
String s = vector.get(i);
195+
System.out.println(s);
196+
}
197+
198+
//��ǿfor
199+
for(String s : vector) {
200+
System.out.println(s);
201+
}
202+
203+
//������
204+
Iterator<String> it = vector.iterator();
205+
while(it.hasNext()) {
206+
String s = it.next();
207+
System.out.println(s);
208+
}
209+
B:�Զ������
210+
vectorList<Student> array = new vectorList<Student>();
211+
212+
Student s1 = new Student("laozi",1000);
213+
Student s2 = new Student("kongzi",100);
214+
Student s3 = new Student("zhuangzi",10);
215+
216+
vector.add(s1);
217+
vector.add(s2);
218+
vector.add(s3);
219+
220+
//��ͨforѭ��
221+
for (int i = 0; i<vector.size(); i++) {
222+
Student s = vector.get(i);
223+
System.out.println(s.getName()+"---"+s.getAge());
224+
}
225+
226+
//��ǿforѭ��
227+
for (Student s : vector) {
228+
System.out.println(s.getName()+"---"+s.getAge());
229+
}
230+
231+
//������ѭ��
232+
for(Iterator<Student> it = vector.iterator(); it.hasNext();) {
233+
Student s = it.next();
234+
System.out.println(s.getName()+"---"+s.getAge());
235+
}
236+
237+
5��LinkedList(���� �Լ�����)
238+
239+
6��Set
240+
A:�ַ���
241+
Set<String> set = new HashSet<String>();
242+
243+
set.add("hello");
244+
set.add("world");
245+
set.add("java");
246+
247+
Iterator<String> it = set.iterator();
248+
while(it.hasNext()) {
249+
String s = it.next();
250+
System.out.println(s);
251+
}
252+
253+
for(String s : set) {
254+
System.out.println(s);
255+
}
256+
257+
B:�Զ������
258+
Set<Student> set = new HashSet<Student>();
259+
260+
Student s1 = new Student("������",50);
261+
Student s2 = new Student("����׿",40);
262+
Student s3 = new Student("�⾩",30);
263+
264+
set.add(s1);
265+
set.add(s2);
266+
set.add(s3);
267+
268+
Iterator<Student> it = set.iterator();
269+
while(it.hasNext()) {
270+
Student s = it.next();
271+
System.out.println(s.getName()+"---"+s.getAge());
272+
}
273+
274+
for(Student s : set) {
275+
System.out.println(s.getName()+"---"+s.getAge());
276+
}
277+
278+
7��HashSet(���� �Լ�����)
279+
�洢�Զ�������ʱ�������Ա����ֵ��ͬ�����Ǿ���Ϊ��ͬһ��Ԫ�ء�
280+
281+
8��TreeSet(���� �Լ�����)
282+
�洢�Զ�������ʱ�������Ա����ֵ��ͬ�����Ǿ���Ϊ��ͬһ��Ԫ�ء�
283+
���ȸ��������С������������ڸ��������ij�������

0 commit comments

Comments
 (0)