File tree Expand file tree Collapse file tree 3 files changed +54
-48
lines changed
group20/592146505/data _structure/src/cn/wsc/util Expand file tree Collapse file tree 3 files changed +54
-48
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .util .Arrays ;
4
4
import java .util .ConcurrentModificationException ;
5
- import java .util .Iterator ;
6
5
import java .util .NoSuchElementException ;
7
6
8
7
/**
@@ -45,11 +44,11 @@ public boolean isEmpty() {
45
44
return size == 0 ;
46
45
}
47
46
48
- // @Override
49
- // public boolean contains(Object o) {
50
- // // TODO Auto-generated method stub
51
- // return false;
52
- // }
47
+ // @Override
48
+ // public boolean contains(Object o) {
49
+ // // TODO Auto-generated method stub
50
+ // return false;
51
+ // }
53
52
54
53
@ Override
55
54
public Iterator <E > iterator () {
@@ -78,6 +77,7 @@ public E next() {
78
77
return (E ) elementData [lastRet = cursor ++];
79
78
}
80
79
80
+ @ Override
81
81
public void remove () {
82
82
if (lastRet < 0 )
83
83
throw new IllegalStateException ();
Original file line number Diff line number Diff line change 1
1
package cn .wsc .util ;
2
2
3
3
import java .util .ConcurrentModificationException ;
4
- import java .util .Iterator ;
5
4
import java .util .NoSuchElementException ;
6
5
7
6
/**
@@ -63,6 +62,7 @@ public E next() {
63
62
return get (lastRet = cursor ++);
64
63
}
65
64
65
+ @ Override
66
66
public void remove () {
67
67
if (lastRet < 0 )
68
68
throw new IllegalStateException ();
@@ -211,7 +211,7 @@ public E getLast() {
211
211
@ Override
212
212
public E set (int index , E e ) {
213
213
checkElementIndex (index );// 索引范围检查
214
- //获取索引处节点,填入新值,返回原值
214
+ // 获取索引处节点,填入新值,返回原值
215
215
Node <E > x = node (index );
216
216
E oldVal = x .item ;
217
217
x .item = e ;
Original file line number Diff line number Diff line change 1
1
package cn .wsc .util ;
2
2
3
- import java .util .Iterator ;
4
-
5
3
/**
6
4
* List接口
7
5
*
12
10
* @param <T>
13
11
*/
14
12
public interface List <E > {
15
-
13
+
16
14
/**
17
15
* 获取集合元素个数
16
+ *
18
17
* @return
19
18
*/
20
19
int size ();
21
-
20
+
22
21
/**
23
22
* 集合是否为空
23
+ *
24
24
* @return
25
25
*/
26
26
boolean isEmpty ();
27
-
28
- // /**
29
- // * 是否包含指定元素
30
- // * @param o
31
- // * @return
32
- // */
33
- // boolean contains(Object o);
34
-
27
+
28
+ // /**
29
+ // * 是否包含指定元素
30
+ // * @param o
31
+ // * @return
32
+ // */
33
+ // boolean contains(Object o);
34
+
35
35
/**
36
36
* 获取当前集合迭代器对象
37
+ *
37
38
* @return
38
39
*/
39
40
Iterator <E > iterator ();
40
- //
41
- // /**
42
- // * 返回集合数组对象
43
- // *
44
- // * @return
45
- // */
46
- // Object[] toArray();
47
- //
48
- // /**
49
- // * 将集合元素复制到新数组中
50
- // * @param a
51
- // * @return
52
- // */
53
- // <T> T[] toArray(T[] a);
54
-
41
+ //
42
+ // /**
43
+ // * 返回集合数组对象
44
+ // *
45
+ // * @return
46
+ // */
47
+ // Object[] toArray();
48
+ //
49
+ // /**
50
+ // * 将集合元素复制到新数组中
51
+ // * @param a
52
+ // * @return
53
+ // */
54
+ // <T> T[] toArray(T[] a);
55
+
55
56
/**
56
57
* 在集合末尾追加元素
58
+ *
57
59
* @param e
58
60
* @return
59
61
*/
60
62
boolean add (E e );
61
-
63
+
62
64
/**
63
65
* 将元素添加至指定指定索引处
66
+ *
64
67
* @param index
65
68
* @param e
66
69
* @return
67
70
*/
68
- boolean add (int index ,E e );
69
-
71
+ boolean add (int index , E e );
72
+
70
73
/**
71
74
* 获取指定索引处元素
75
+ *
72
76
* @param index
73
77
* @return
74
78
*/
75
79
E get (int index );
76
-
80
+
77
81
/**
78
82
* 替换指定索引处元素为新元素,并返回被替换元素,
83
+ *
79
84
* @param index
80
85
* @param e
81
86
* @return
82
87
*/
83
88
E set (int index , E e );
84
-
89
+
85
90
/**
86
91
* 删除并返回指定指定索引处元素
92
+ *
87
93
* @param index
88
94
* @return
89
95
*/
90
96
E remove (int index );
91
-
92
- // /**
93
- // * 返回该对象在集合中的下标,不存在返回-1
94
- // * @param o
95
- // * @return
96
- // */
97
- // int indexOf(Object o);
98
-
97
+
98
+ // /**
99
+ // * 返回该对象在集合中的下标,不存在返回-1
100
+ // * @param o
101
+ // * @return
102
+ // */
103
+ // int indexOf(Object o);
104
+
99
105
}
You can’t perform that action at this time.
0 commit comments