|
@@ -1,7 +1,7 @@
|
1
|
1
|
|
2
|
2
|
# Delete Duplicates
|
3
|
3
|
* **Objective**
|
4
|
|
- * To write methods which removes duplicate elements from an array.
|
|
4
|
+ * To write methods which remove duplicate elements from an array.
|
5
|
5
|
* **Purpose**
|
6
|
6
|
* To demonstrate practical understanding of `while`, `for`, and `for each` loops.
|
7
|
7
|
* **Instructions**
|
|
@@ -39,7 +39,7 @@
|
39
|
39
|
```
|
40
|
40
|
// : Given
|
41
|
41
|
Integer[] array = new Integer[]{1,1,1,23,23,56,57,58};
|
42
|
|
- DuplicateDeleter deleter = new DuplicateDeleter(array);
|
|
42
|
+ DuplicateDeleter<Integer> deleter = new IntegerDuplicateDeleter(array);
|
43
|
43
|
|
44
|
44
|
// : When
|
45
|
45
|
Integer[] actual = deleter.removeDuplicateExactly(3);
|
|
@@ -63,7 +63,7 @@
|
63
|
63
|
```
|
64
|
64
|
// : Given
|
65
|
65
|
Integer[] array = new Integer[]{1,1,1,23,23,56,57,58};
|
66
|
|
- DuplicateDeleter deleter = new DuplicateDeleter(array);
|
|
66
|
+ DuplicateDeleter<Integer> deleter = new IntegerDuplicateDeleter(array);
|
67
|
67
|
|
68
|
68
|
// : When
|
69
|
69
|
Integer[] actual = deleter.removeDuplicateExactly(1);
|
|
@@ -87,7 +87,7 @@
|
87
|
87
|
```
|
88
|
88
|
// : Given
|
89
|
89
|
Integer[] array = new Integer[]{0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5};
|
90
|
|
- DuplicateDeleter deleter = new DuplicateDeleter(array);
|
|
90
|
+ DuplicateDeleter<Integer> deleter = new IntegerDuplicateDeleter(array);
|
91
|
91
|
|
92
|
92
|
// : When
|
93
|
93
|
Integer[] actual = deleter.removeDuplicateExactly(3);
|
|
@@ -129,7 +129,7 @@
|
129
|
129
|
```
|
130
|
130
|
// : Given
|
131
|
131
|
Integer[] array = new Integer[]{1,1,1,23,23,56,57,58};
|
132
|
|
- DuplicateDeleter deleter = new DuplicateDeleter(array);
|
|
132
|
+ DuplicateDeleter<Integer> deleter = new IntegerDuplicateDeleter(array);
|
133
|
133
|
|
134
|
134
|
// : When
|
135
|
135
|
Integer[] actual = deleter.removeDuplicateExactly(1);
|
|
@@ -155,7 +155,7 @@
|
155
|
155
|
```
|
156
|
156
|
// : Given
|
157
|
157
|
Integer[] array = new Integer[]{0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5};
|
158
|
|
- DuplicateDeleter deleter = new DuplicateDeleter(array);
|
|
158
|
+ DuplicateDeleter<Integer> deleter = new IntegerDuplicateDeleter(array);
|
159
|
159
|
|
160
|
160
|
// : When
|
161
|
161
|
Integer[] actual = deleter.removeDuplicates(2);
|
|
@@ -180,7 +180,7 @@
|
180
|
180
|
```
|
181
|
181
|
// : Given
|
182
|
182
|
Integer[] array = new Integer[]{0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5};
|
183
|
|
- DuplicateDeleter deleter = new DuplicateDeleter(array);
|
|
183
|
+ DuplicateDeleter<Integer> deleter = new IntegerDuplicateDeleter(array);
|
184
|
184
|
|
185
|
185
|
// : When
|
186
|
186
|
Integer[] actual = deleter.removeDuplicates(3);
|
|
@@ -215,7 +215,7 @@
|
215
|
215
|
```
|
216
|
216
|
// : Given
|
217
|
217
|
Integer[] array = new Integer[]{0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5};
|
218
|
|
- DuplicateDeleter deleter = new DuplicateDeleter(array);
|
|
218
|
+ DuplicateDeleter<Integer> deleter = new IntegerDuplicateDeleter(array);
|
219
|
219
|
deleter.removeDuplicates(0);
|
220
|
220
|
deleter.removeDuplicates(1);
|
221
|
221
|
deleter.removeDuplicates(2);
|
|
@@ -242,7 +242,7 @@
|
242
|
242
|
```
|
243
|
243
|
// : Given
|
244
|
244
|
Integer[] array = new Integer[]{1,1,1,23,23,56,57,58};
|
245
|
|
- DuplicateDeleter deleter = new DuplicateDeleter(array);
|
|
245
|
+ DuplicateDeleter<Integer> deleter = new IntegerDuplicateDeleter(array);
|
246
|
246
|
deleter.removeDuplicates(0);
|
247
|
247
|
deleter.removeDuplicates(1);
|
248
|
248
|
deleter.removeDuplicates(2);
|