瀏覽代碼

finished lab

Christian Sheridan 6 年之前
父節點
當前提交
992c46f4fd

+ 1
- 0
.idea/.name 查看文件

@@ -0,0 +1 @@
1
+generics

+ 16
- 0
.idea/compiler.xml 查看文件

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="CompilerConfiguration">
4
+    <annotationProcessing>
5
+      <profile name="Maven default annotation processors profile" enabled="true">
6
+        <sourceOutputDir name="target/generated-sources/annotations" />
7
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8
+        <outputRelativeToContentRoot value="true" />
9
+        <module name="generics" />
10
+      </profile>
11
+    </annotationProcessing>
12
+    <bytecodeTargetLevel>
13
+      <module name="generics" target="1.7" />
14
+    </bytecodeTargetLevel>
15
+  </component>
16
+</project>

+ 13
- 0
.idea/libraries/Maven__junit_junit_4_12.xml 查看文件

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: junit:junit:4.12">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml 查看文件

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: org.hamcrest:hamcrest-core:1.3">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/misc.xml 查看文件

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="MavenProjectsManager">
4
+    <option name="originalFiles">
5
+      <list>
6
+        <option value="$PROJECT_DIR$/pom.xml" />
7
+      </list>
8
+    </option>
9
+  </component>
10
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
11
+    <output url="file://$PROJECT_DIR$/classes" />
12
+  </component>
13
+</project>

+ 8
- 0
.idea/modules.xml 查看文件

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/generics.iml" filepath="$PROJECT_DIR$/generics.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6
- 0
.idea/vcs.xml 查看文件

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 612
- 0
.idea/workspace.xml 查看文件

@@ -0,0 +1,612 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="e3d492b7-23a7-48a6-b144-1f23e61be8cd" name="Default Changelist" comment="">
5
+      <change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
6
+      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__junit_junit_4_12.xml" afterDir="false" />
7
+      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml" afterDir="false" />
8
+      <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
9
+      <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
10
+      <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
11
+      <change afterPath="$PROJECT_DIR$/generics.iml" afterDir="false" />
12
+      <change afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
13
+      <change afterPath="$PROJECT_DIR$/src/main/java/MySet.java" afterDir="false" />
14
+      <change afterPath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" afterDir="false" />
15
+      <change afterPath="$PROJECT_DIR$/src/test/java/MySetTest.java" afterDir="false" />
16
+      <change beforePath="$PROJECT_DIR$/src/main/java/.deleteme" beforeDir="false" />
17
+      <change beforePath="$PROJECT_DIR$/src/test/java/.deleteme" beforeDir="false" />
18
+    </list>
19
+    <ignored path="$PROJECT_DIR$/target/" />
20
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
21
+    <option name="SHOW_DIALOG" value="false" />
22
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
23
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
24
+    <option name="LAST_RESOLUTION" value="IGNORE" />
25
+  </component>
26
+  <component name="CoverageDataManager">
27
+    <SUITE FILE_PATH="coverage/generics$MyArrayListTest.ic" NAME="MyArrayListTest Coverage Results" MODIFIED="1542662587931" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
28
+  </component>
29
+  <component name="CoverageViewManager">
30
+    <option name="myElementSize" value="271" />
31
+  </component>
32
+  <component name="FUSProjectUsageTrigger">
33
+    <session id="1964761005">
34
+      <usages-collector id="statistics.lifecycle.project">
35
+        <counts>
36
+          <entry key="project.open.time.0" value="1" />
37
+          <entry key="project.opened" value="1" />
38
+        </counts>
39
+      </usages-collector>
40
+      <usages-collector id="statistics.file.extensions.open">
41
+        <counts>
42
+          <entry key="JAVA/" value="1" />
43
+          <entry key="class" value="1" />
44
+          <entry key="java" value="6" />
45
+          <entry key="xml" value="1" />
46
+        </counts>
47
+      </usages-collector>
48
+      <usages-collector id="statistics.file.types.open">
49
+        <counts>
50
+          <entry key="CLASS" value="1" />
51
+          <entry key="JAVA" value="6" />
52
+          <entry key="UML" value="1" />
53
+          <entry key="XML" value="1" />
54
+        </counts>
55
+      </usages-collector>
56
+      <usages-collector id="statistics.file.extensions.edit">
57
+        <counts>
58
+          <entry key="java" value="5365" />
59
+        </counts>
60
+      </usages-collector>
61
+      <usages-collector id="statistics.file.types.edit">
62
+        <counts>
63
+          <entry key="JAVA" value="5365" />
64
+        </counts>
65
+      </usages-collector>
66
+      <usages-collector id="statistics.js.language.service.starts" />
67
+      <usages-collector id="statistics.spring.boot.mvc.usages" />
68
+      <usages-collector id="statistics.spring.boot.run.usages" />
69
+      <usages-collector id="statistics.vcs.git.usages" />
70
+    </session>
71
+  </component>
72
+  <component name="FileEditorManager">
73
+    <splitter split-orientation="horizontal" split-proportion="0.5">
74
+      <split-first>
75
+        <leaf>
76
+          <file pinned="false" current-in-tab="false">
77
+            <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
78
+              <provider selected="true" editor-type-id="text-editor">
79
+                <state relative-caret-position="330">
80
+                  <caret line="64" selection-start-line="64" selection-end-line="64" />
81
+                  <folding>
82
+                    <element signature="e#94#95#0" expanded="true" />
83
+                    <element signature="e#124#125#0" expanded="true" />
84
+                    <element signature="e#167#168#0" expanded="true" />
85
+                    <element signature="e#205#206#0" expanded="true" />
86
+                    <element signature="e#89#90#0" expanded="true" />
87
+                    <element signature="e#132#133#0" expanded="true" />
88
+                    <element signature="e#167#168#0" expanded="true" />
89
+                    <element signature="e#210#211#0" expanded="true" />
90
+                    <element signature="e#1147#1148#0" expanded="true" />
91
+                    <element signature="e#1567#1568#0" expanded="true" />
92
+                    <element signature="e#1589#1590#0" expanded="true" />
93
+                  </folding>
94
+                </state>
95
+              </provider>
96
+            </entry>
97
+          </file>
98
+          <file pinned="false" current-in-tab="true">
99
+            <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
100
+              <provider selected="true" editor-type-id="text-editor">
101
+                <state relative-caret-position="526">
102
+                  <caret line="129" column="46" selection-start-line="129" selection-start-column="46" selection-end-line="129" selection-end-column="46" />
103
+                  <folding>
104
+                    <element signature="imports" expanded="true" />
105
+                  </folding>
106
+                </state>
107
+              </provider>
108
+            </entry>
109
+          </file>
110
+        </leaf>
111
+      </split-first>
112
+      <split-second>
113
+        <leaf>
114
+          <file pinned="false" current-in-tab="true">
115
+            <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
116
+              <provider selected="true" editor-type-id="text-editor">
117
+                <state relative-caret-position="436">
118
+                  <caret line="64" column="9" lean-forward="true" selection-start-line="64" selection-start-column="9" selection-end-line="64" selection-end-column="9" />
119
+                  <folding>
120
+                    <element signature="imports" expanded="true" />
121
+                    <element signature="e#329#330#0" expanded="true" />
122
+                    <element signature="e#356#357#0" expanded="true" />
123
+                    <element signature="e#502#503#0" expanded="true" />
124
+                    <element signature="e#531#532#0" expanded="true" />
125
+                    <element signature="e#566#567#0" expanded="true" />
126
+                    <element signature="e#605#606#0" expanded="true" />
127
+                    <element signature="e#1085#1086#0" expanded="true" />
128
+                    <element signature="e#1122#1123#0" expanded="true" />
129
+                  </folding>
130
+                </state>
131
+              </provider>
132
+            </entry>
133
+          </file>
134
+          <file pinned="false" current-in-tab="false">
135
+            <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
136
+              <provider selected="true" editor-type-id="text-editor">
137
+                <state relative-caret-position="1782">
138
+                  <caret line="119" selection-start-line="119" selection-end-line="119" />
139
+                  <folding>
140
+                    <element signature="imports" expanded="true" />
141
+                  </folding>
142
+                </state>
143
+              </provider>
144
+            </entry>
145
+          </file>
146
+        </leaf>
147
+      </split-second>
148
+    </splitter>
149
+  </component>
150
+  <component name="FileTemplateManagerImpl">
151
+    <option name="RECENT_TEMPLATES">
152
+      <list>
153
+        <option value="Class" />
154
+      </list>
155
+    </option>
156
+  </component>
157
+  <component name="Git.Settings">
158
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
159
+  </component>
160
+  <component name="IdeDocumentHistory">
161
+    <option name="CHANGED_PATHS">
162
+      <list>
163
+        <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
164
+        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
165
+        <option value="$PROJECT_DIR$/src/main/java/MySet.java" />
166
+        <option value="$PROJECT_DIR$/src/test/java/MySetTest.java" />
167
+      </list>
168
+    </option>
169
+  </component>
170
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
171
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
172
+  <component name="JsGulpfileManager">
173
+    <detection-done>true</detection-done>
174
+    <sorting>DEFINITION_ORDER</sorting>
175
+  </component>
176
+  <component name="ProjectFrameBounds">
177
+    <option name="x" value="30" />
178
+    <option name="y" value="-1043" />
179
+    <option name="width" value="1840" />
180
+    <option name="height" value="1043" />
181
+  </component>
182
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
183
+  <component name="ProjectView">
184
+    <navigator proportions="" version="1">
185
+      <foldersAlwaysOnTop value="true" />
186
+    </navigator>
187
+    <panes>
188
+      <pane id="PackagesPane" />
189
+      <pane id="ProjectPane">
190
+        <subPane>
191
+          <expand>
192
+            <path>
193
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
194
+              <item name="Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
195
+            </path>
196
+            <path>
197
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
198
+              <item name="Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
199
+              <item name=".idea" type="462c0819:PsiDirectoryNode" />
200
+            </path>
201
+            <path>
202
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
203
+              <item name="Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
204
+              <item name=".idea" type="462c0819:PsiDirectoryNode" />
205
+              <item name="libraries" type="462c0819:PsiDirectoryNode" />
206
+            </path>
207
+            <path>
208
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
209
+              <item name="Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
210
+              <item name="src" type="462c0819:PsiDirectoryNode" />
211
+            </path>
212
+            <path>
213
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
214
+              <item name="Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
215
+              <item name="src" type="462c0819:PsiDirectoryNode" />
216
+              <item name="main" type="462c0819:PsiDirectoryNode" />
217
+            </path>
218
+            <path>
219
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
220
+              <item name="Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
221
+              <item name="src" type="462c0819:PsiDirectoryNode" />
222
+              <item name="main" type="462c0819:PsiDirectoryNode" />
223
+              <item name="java" type="462c0819:PsiDirectoryNode" />
224
+            </path>
225
+            <path>
226
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
227
+              <item name="Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
228
+              <item name="src" type="462c0819:PsiDirectoryNode" />
229
+              <item name="test" type="462c0819:PsiDirectoryNode" />
230
+            </path>
231
+            <path>
232
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
233
+              <item name="Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
234
+              <item name="src" type="462c0819:PsiDirectoryNode" />
235
+              <item name="test" type="462c0819:PsiDirectoryNode" />
236
+              <item name="java" type="462c0819:PsiDirectoryNode" />
237
+            </path>
238
+            <path>
239
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
240
+              <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
241
+            </path>
242
+          </expand>
243
+          <select />
244
+        </subPane>
245
+      </pane>
246
+      <pane id="Scope" />
247
+    </panes>
248
+  </component>
249
+  <component name="PropertiesComponent">
250
+    <property name="WebServerToolWindowFactoryState" value="false" />
251
+    <property name="aspect.path.notification.shown" value="true" />
252
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542811758238" />
253
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
254
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
255
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
256
+    <property name="project.structure.last.edited" value="Libraries" />
257
+    <property name="project.structure.proportion" value="0.15" />
258
+    <property name="project.structure.side.proportion" value="0.2" />
259
+  </component>
260
+  <component name="RunDashboard">
261
+    <option name="ruleStates">
262
+      <list>
263
+        <RuleState>
264
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
265
+        </RuleState>
266
+        <RuleState>
267
+          <option name="name" value="StatusDashboardGroupingRule" />
268
+        </RuleState>
269
+      </list>
270
+    </option>
271
+  </component>
272
+  <component name="RunManager" selected="JUnit.All in generics">
273
+    <configuration name="All in generics" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
274
+      <module name="generics" />
275
+      <option name="PACKAGE_NAME" value="" />
276
+      <option name="TEST_OBJECT" value="package" />
277
+      <method v="2">
278
+        <option name="Make" enabled="true" />
279
+      </method>
280
+    </configuration>
281
+    <configuration name="MySetTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
282
+      <module name="generics" />
283
+      <option name="PACKAGE_NAME" value="" />
284
+      <option name="MAIN_CLASS_NAME" value="MySetTest" />
285
+      <method v="2">
286
+        <option name="Make" enabled="true" />
287
+      </method>
288
+    </configuration>
289
+    <configuration name="MySetTest.isEmptyTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
290
+      <module name="generics" />
291
+      <option name="PACKAGE_NAME" value="" />
292
+      <option name="MAIN_CLASS_NAME" value="MySetTest" />
293
+      <option name="METHOD_NAME" value="isEmptyTest" />
294
+      <option name="TEST_OBJECT" value="method" />
295
+      <method v="2">
296
+        <option name="Make" enabled="true" />
297
+      </method>
298
+    </configuration>
299
+    <configuration name="MySetTest.testHashCode" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
300
+      <module name="generics" />
301
+      <option name="PACKAGE_NAME" value="" />
302
+      <option name="MAIN_CLASS_NAME" value="MySetTest" />
303
+      <option name="METHOD_NAME" value="testHashCode" />
304
+      <option name="TEST_OBJECT" value="method" />
305
+      <method v="2">
306
+        <option name="Make" enabled="true" />
307
+      </method>
308
+    </configuration>
309
+    <configuration name="MySetTest.toArrayTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
310
+      <module name="generics" />
311
+      <option name="PACKAGE_NAME" value="" />
312
+      <option name="MAIN_CLASS_NAME" value="MySetTest" />
313
+      <option name="METHOD_NAME" value="toArrayTest" />
314
+      <option name="TEST_OBJECT" value="method" />
315
+      <method v="2">
316
+        <option name="Make" enabled="true" />
317
+      </method>
318
+    </configuration>
319
+    <list>
320
+      <item itemvalue="JUnit.MySetTest.isEmptyTest" />
321
+      <item itemvalue="JUnit.MySetTest.toArrayTest" />
322
+      <item itemvalue="JUnit.MySetTest.testHashCode" />
323
+      <item itemvalue="JUnit.MySetTest" />
324
+      <item itemvalue="JUnit.All in generics" />
325
+    </list>
326
+    <recent_temporary>
327
+      <list>
328
+        <item itemvalue="JUnit.All in generics" />
329
+        <item itemvalue="JUnit.MySetTest" />
330
+        <item itemvalue="JUnit.MySetTest.testHashCode" />
331
+        <item itemvalue="JUnit.MySetTest.toArrayTest" />
332
+        <item itemvalue="JUnit.MySetTest.isEmptyTest" />
333
+      </list>
334
+    </recent_temporary>
335
+  </component>
336
+  <component name="SvnConfiguration">
337
+    <configuration />
338
+  </component>
339
+  <component name="TaskManager">
340
+    <task active="true" id="Default" summary="Default task">
341
+      <changelist id="e3d492b7-23a7-48a6-b144-1f23e61be8cd" name="Default Changelist" comment="" />
342
+      <created>1542317939322</created>
343
+      <option name="number" value="Default" />
344
+      <option name="presentableId" value="Default" />
345
+      <updated>1542317939322</updated>
346
+      <workItem from="1542317940590" duration="25058000" />
347
+    </task>
348
+    <servers />
349
+  </component>
350
+  <component name="TestHistory">
351
+    <history-entry file="MySetTest_addAllTestFalse - 2018.11.20 at 17h 15m 55s.xml">
352
+      <configuration name="MySetTest.addAllTestFalse" configurationId="JUnit" />
353
+    </history-entry>
354
+    <history-entry file="MySetTest_addAllTestTrue - 2018.11.20 at 17h 16m 03s.xml">
355
+      <configuration name="MySetTest.addAllTestTrue" configurationId="JUnit" />
356
+    </history-entry>
357
+    <history-entry file="MySetTest_addAllTestFalse - 2018.11.20 at 17h 16m 11s.xml">
358
+      <configuration name="MySetTest.addAllTestFalse" configurationId="JUnit" />
359
+    </history-entry>
360
+    <history-entry file="MySetTest_isEmptyTest - 2018.11.20 at 17h 51m 20s.xml">
361
+      <configuration name="MySetTest.isEmptyTest" configurationId="JUnit" />
362
+    </history-entry>
363
+    <history-entry file="MySetTest_isEmptyTest - 2018.11.20 at 17h 51m 25s.xml">
364
+      <configuration name="MySetTest.isEmptyTest" configurationId="JUnit" />
365
+    </history-entry>
366
+    <history-entry file="MySetTest_isEmptyTest - 2018.11.20 at 17h 51m 54s.xml">
367
+      <configuration name="MySetTest.isEmptyTest" configurationId="JUnit" />
368
+    </history-entry>
369
+    <history-entry file="MySetTest_toArrayTest - 2018.11.21 at 09h 40m 37s.xml">
370
+      <configuration name="MySetTest.toArrayTest" configurationId="JUnit" />
371
+    </history-entry>
372
+    <history-entry file="MySetTest_toArrayTest - 2018.11.21 at 09h 41m 04s.xml">
373
+      <configuration name="MySetTest.toArrayTest" configurationId="JUnit" />
374
+    </history-entry>
375
+    <history-entry file="MySetTest_toArrayTest - 2018.11.21 at 09h 42m 02s.xml">
376
+      <configuration name="MySetTest.toArrayTest" configurationId="JUnit" />
377
+    </history-entry>
378
+    <history-entry file="MySetTest_toArrayTest - 2018.11.21 at 09h 42m 47s.xml">
379
+      <configuration name="MySetTest.toArrayTest" configurationId="JUnit" />
380
+    </history-entry>
381
+  </component>
382
+  <component name="TimeTrackingManager">
383
+    <option name="totallyTimeSpent" value="25058000" />
384
+  </component>
385
+  <component name="ToolWindowManager">
386
+    <frame x="30" y="-1043" width="1840" height="1043" extended-state="0" />
387
+    <editor active="true" />
388
+    <layout>
389
+      <window_info id="Image Layers" />
390
+      <window_info id="Designer" />
391
+      <window_info id="UI Designer" />
392
+      <window_info id="Capture Tool" />
393
+      <window_info id="Favorites" side_tool="true" />
394
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2608454" />
395
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
396
+      <window_info anchor="bottom" id="Messages" weight="0.32912722" />
397
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
398
+      <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
399
+      <window_info anchor="bottom" id="Terminal" />
400
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
401
+      <window_info anchor="bottom" id="Message" order="0" />
402
+      <window_info anchor="bottom" id="Find" order="1" weight="0.32912722" />
403
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.33438486" />
404
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.39957938" />
405
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
406
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
407
+      <window_info anchor="bottom" id="TODO" order="6" />
408
+      <window_info anchor="right" id="Palette" />
409
+      <window_info anchor="right" id="Coverage" side_tool="true" weight="0.32960597" />
410
+      <window_info anchor="right" id="Theme Preview" />
411
+      <window_info anchor="right" id="Capture Analysis" />
412
+      <window_info anchor="right" id="Palette&#9;" />
413
+      <window_info anchor="right" id="Database" />
414
+      <window_info anchor="right" id="Maven Projects" />
415
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
416
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
417
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
418
+    </layout>
419
+  </component>
420
+  <component name="TypeScriptGeneratedFilesManager">
421
+    <option name="version" value="1" />
422
+  </component>
423
+  <component name="VcsContentAnnotationSettings">
424
+    <option name="myLimit" value="2678400000" />
425
+  </component>
426
+  <component name="editorHistoryManager">
427
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/Assert.class">
428
+      <provider selected="true" editor-type-id="text-editor">
429
+        <state relative-caret-position="207">
430
+          <caret line="290" selection-start-line="290" selection-end-line="290" />
431
+        </state>
432
+      </provider>
433
+    </entry>
434
+    <entry file="uml://JAVA/">
435
+      <provider selected="true" editor-type-id="UmlEditorProvider">
436
+        <state>
437
+          <ID>JAVA</ID>
438
+          <OriginalElement />
439
+          <nodes>
440
+            <node x="" y="">com</node>
441
+            <node x="" y="">netscape</node>
442
+            <node x="" y="">junit</node>
443
+            <node x="" y="">MySet</node>
444
+            <node x="" y="">oracle</node>
445
+            <node x="" y="">org</node>
446
+            <node x="" y="">resources</node>
447
+            <node x="" y="">toolbarButtonGraphics</node>
448
+            <node x="" y="">MyArrayList</node>
449
+            <node x="" y="">sun</node>
450
+            <node x="" y="">META-INF</node>
451
+            <node x="" y="">jdk</node>
452
+            <node x="" y="">apple</node>
453
+            <node x="" y="">groovyjarjarasm</node>
454
+            <node x="" y="">java</node>
455
+            <node x="" y="">groovy</node>
456
+            <node x="" y="">javax</node>
457
+            <node x="" y="">groovyjarjarcommonscli</node>
458
+            <node x="" y="">javafx</node>
459
+            <node x="" y="">MyArrayListTest</node>
460
+            <node x="" y="">groovyjarjarantlr</node>
461
+          </nodes>
462
+          <notes />
463
+          <edges />
464
+          <settings layout="Hierarchic Group" zoom="1.0" x="62.0" y="294.0" />
465
+          <SelectedNodes />
466
+          <Categories>
467
+            <Category>Methods</Category>
468
+          </Categories>
469
+          <SCOPE>All</SCOPE>
470
+          <VISIBILITY>private</VISIBILITY>
471
+        </state>
472
+      </provider>
473
+    </entry>
474
+    <entry file="file://$PROJECT_DIR$/pom.xml">
475
+      <provider selected="true" editor-type-id="text-editor" />
476
+    </entry>
477
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
478
+      <provider selected="true" editor-type-id="text-editor">
479
+        <state relative-caret-position="330">
480
+          <caret line="64" selection-start-line="64" selection-end-line="64" />
481
+          <folding>
482
+            <element signature="e#94#95#0" expanded="true" />
483
+            <element signature="e#124#125#0" expanded="true" />
484
+            <element signature="e#167#168#0" expanded="true" />
485
+            <element signature="e#205#206#0" expanded="true" />
486
+            <element signature="e#89#90#0" expanded="true" />
487
+            <element signature="e#132#133#0" expanded="true" />
488
+            <element signature="e#167#168#0" expanded="true" />
489
+            <element signature="e#210#211#0" expanded="true" />
490
+            <element signature="e#1147#1148#0" expanded="true" />
491
+            <element signature="e#1567#1568#0" expanded="true" />
492
+            <element signature="e#1589#1590#0" expanded="true" />
493
+          </folding>
494
+        </state>
495
+      </provider>
496
+    </entry>
497
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
498
+      <provider selected="true" editor-type-id="text-editor">
499
+        <state relative-caret-position="1782">
500
+          <caret line="119" selection-start-line="119" selection-end-line="119" />
501
+          <folding>
502
+            <element signature="imports" expanded="true" />
503
+          </folding>
504
+        </state>
505
+      </provider>
506
+    </entry>
507
+    <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
508
+      <provider selected="true" editor-type-id="text-editor">
509
+        <state relative-caret-position="436">
510
+          <caret line="64" column="9" lean-forward="true" selection-start-line="64" selection-start-column="9" selection-end-line="64" selection-end-column="9" />
511
+          <folding>
512
+            <element signature="imports" expanded="true" />
513
+            <element signature="e#329#330#0" expanded="true" />
514
+            <element signature="e#356#357#0" expanded="true" />
515
+            <element signature="e#502#503#0" expanded="true" />
516
+            <element signature="e#531#532#0" expanded="true" />
517
+            <element signature="e#566#567#0" expanded="true" />
518
+            <element signature="e#605#606#0" expanded="true" />
519
+            <element signature="e#1085#1086#0" expanded="true" />
520
+            <element signature="e#1122#1123#0" expanded="true" />
521
+          </folding>
522
+        </state>
523
+      </provider>
524
+    </entry>
525
+    <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
526
+      <provider selected="true" editor-type-id="text-editor">
527
+        <state relative-caret-position="526">
528
+          <caret line="129" column="46" selection-start-line="129" selection-start-column="46" selection-end-line="129" selection-end-column="46" />
529
+          <folding>
530
+            <element signature="imports" expanded="true" />
531
+          </folding>
532
+        </state>
533
+      </provider>
534
+    </entry>
535
+  </component>
536
+  <component name="masterDetails">
537
+    <states>
538
+      <state key="ArtifactsStructureConfigurable.UI">
539
+        <settings>
540
+          <artifact-editor />
541
+          <splitter-proportions>
542
+            <option name="proportions">
543
+              <list>
544
+                <option value="0.2" />
545
+              </list>
546
+            </option>
547
+          </splitter-proportions>
548
+        </settings>
549
+      </state>
550
+      <state key="FacetStructureConfigurable.UI">
551
+        <settings>
552
+          <last-edited>No facets are configured</last-edited>
553
+          <splitter-proportions>
554
+            <option name="proportions">
555
+              <list>
556
+                <option value="0.2" />
557
+              </list>
558
+            </option>
559
+          </splitter-proportions>
560
+        </settings>
561
+      </state>
562
+      <state key="GlobalLibrariesConfigurable.UI">
563
+        <settings>
564
+          <splitter-proportions>
565
+            <option name="proportions">
566
+              <list>
567
+                <option value="0.2" />
568
+              </list>
569
+            </option>
570
+          </splitter-proportions>
571
+        </settings>
572
+      </state>
573
+      <state key="JdkListConfigurable.UI">
574
+        <settings>
575
+          <last-edited>1.8</last-edited>
576
+          <splitter-proportions>
577
+            <option name="proportions">
578
+              <list>
579
+                <option value="0.2" />
580
+              </list>
581
+            </option>
582
+          </splitter-proportions>
583
+        </settings>
584
+      </state>
585
+      <state key="ModuleStructureConfigurable.UI">
586
+        <settings>
587
+          <last-edited>generics</last-edited>
588
+          <splitter-proportions>
589
+            <option name="proportions">
590
+              <list>
591
+                <option value="0.2" />
592
+                <option value="0.6" />
593
+              </list>
594
+            </option>
595
+          </splitter-proportions>
596
+        </settings>
597
+      </state>
598
+      <state key="ProjectLibrariesConfigurable.UI">
599
+        <settings>
600
+          <last-edited>Maven: junit:junit:4.12</last-edited>
601
+          <splitter-proportions>
602
+            <option name="proportions">
603
+              <list>
604
+                <option value="0.2" />
605
+              </list>
606
+            </option>
607
+          </splitter-proportions>
608
+        </settings>
609
+      </state>
610
+    </states>
611
+  </component>
612
+</project>

+ 16
- 0
generics.iml 查看文件

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
4
+    <output url="file://$MODULE_DIR$/target/classes" />
5
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
+    <content url="file://$MODULE_DIR$">
7
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
9
+      <excludeFolder url="file://$MODULE_DIR$/target" />
10
+    </content>
11
+    <orderEntry type="inheritedJdk" />
12
+    <orderEntry type="sourceFolder" forTests="false" />
13
+    <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
14
+    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
15
+  </component>
16
+</module>

+ 0
- 0
src/main/java/.deleteme 查看文件


+ 98
- 0
src/main/java/MyArrayList.java 查看文件

@@ -0,0 +1,98 @@
1
+public class MyArrayList <T>{
2
+
3
+    private T[] asArray;
4
+
5
+    public T[] getAsArray() {
6
+        return asArray;
7
+    }
8
+
9
+    public void setAsArray(T[] asArray) {
10
+        this.asArray = asArray;
11
+    }
12
+
13
+    public MyArrayList(){
14
+        asArray = (T[]) new Object[0];
15
+    }
16
+
17
+    public MyArrayList(int length){
18
+        asArray = (T[]) new Object[length];
19
+    }
20
+
21
+    public void add(T t){
22
+
23
+        T[] temp = (T[]) new Object[asArray.length+1];
24
+
25
+        for (int i = 0; i <asArray.length; i++){
26
+            temp[i] = asArray[i];
27
+        }
28
+
29
+        temp[asArray.length] = t;
30
+        asArray = temp;
31
+    }
32
+
33
+    public void addWithIndex(T t, int index){
34
+        T[] temp = (T[]) new Object[asArray.length+1];
35
+        for (int i = 0; i <index; i++){
36
+            temp[i] = asArray[i];
37
+        }
38
+        temp[index] = t;
39
+        for (int j = index+1; j<asArray.length+1; j++){
40
+            temp[j] = asArray[j-1];
41
+        }
42
+        asArray = temp;
43
+    }
44
+
45
+    public void remove(int index)
46
+    {
47
+        if (index < 0 || index >= asArray.length) return;
48
+        T[] temp = (T[]) new Object[asArray.length - 1];
49
+
50
+        boolean found = false;
51
+        for (int i = 0; i < asArray.length; i++)
52
+        {
53
+            if (i == index)
54
+            {
55
+                found = true;
56
+                continue;
57
+            }
58
+            temp[i - (found ? 1 : 0)] = asArray[i];
59
+        }
60
+        asArray = temp;
61
+    }
62
+
63
+    public T get(int index)
64
+    {
65
+        return asArray[index];
66
+    }
67
+
68
+    public void set(int index, T input){
69
+        this.addWithIndex(input, index);
70
+        this.remove(index+1);
71
+    }
72
+
73
+    public void clear(){
74
+        while(asArray.length>0){
75
+            this.remove(0);
76
+        }
77
+    }
78
+
79
+    public int size(){
80
+        return asArray.length;
81
+    }
82
+
83
+    public boolean contains(T input){
84
+        for(int i=0; i <asArray.length; i++){
85
+            if(asArray[i].equals(input)){
86
+                return true;
87
+            }
88
+        } return false;
89
+    }
90
+
91
+    public boolean isEmpty(){
92
+        if (asArray.length == 0){
93
+            return true;
94
+        } else return false;
95
+    }
96
+
97
+}
98
+

+ 68
- 0
src/main/java/MySet.java 查看文件

@@ -0,0 +1,68 @@
1
+import java.util.Arrays;
2
+import java.util.Collection;
3
+import java.util.Set;
4
+
5
+public class MySet <T>{
6
+
7
+    MyArrayList<T> mySet = new MyArrayList<>();
8
+
9
+
10
+
11
+    public boolean add(T t){
12
+        if(!mySet.contains(t)){
13
+            mySet.add(t);
14
+            return true;
15
+        }
16
+        return false;
17
+    }
18
+
19
+    public int size(){
20
+        return mySet.size();
21
+    }
22
+
23
+    public boolean addAll(Collection<T> t){
24
+        boolean returnBool = true;
25
+        for(Object o: t){
26
+            returnBool = this.add((T) o) && returnBool;
27
+        }
28
+        return returnBool;
29
+    }
30
+
31
+
32
+    public void clear(){
33
+        mySet.clear();
34
+    }
35
+
36
+    public boolean contains(T t){
37
+       return mySet.contains(t);
38
+    }
39
+
40
+    public boolean containsAll(Collection<T> collection){
41
+        if(collection.size() == 0){
42
+            return false;
43
+        }
44
+        if(mySet.size()<collection.size()){
45
+            return false;
46
+        }
47
+        for(Object o: collection){
48
+           if(!mySet.contains((T) o)){
49
+               return false;
50
+           }
51
+
52
+        } return true;
53
+    }
54
+
55
+
56
+    public boolean isEmpty() {
57
+        return mySet.isEmpty();
58
+    }
59
+
60
+
61
+    public Object[] toArray() {
62
+        Object[] array = new Object[mySet.size()];
63
+        for(int i = 0; i<mySet.size(); i++){
64
+            array[i] = mySet.get(i);
65
+        }
66
+        return array;
67
+    }
68
+}

+ 0
- 0
src/test/java/.deleteme 查看文件


+ 125
- 0
src/test/java/MyArrayListTest.java 查看文件

@@ -0,0 +1,125 @@
1
+import org.junit.Assert;
2
+import org.junit.Before;
3
+import org.junit.Test;
4
+
5
+public class MyArrayListTest<T> {
6
+
7
+
8
+    @Test
9
+    public void testAdd(){
10
+        MyArrayList<T> testArrayList = new MyArrayList<T>();
11
+        T t = (T) "1";
12
+        testArrayList.add(t);
13
+        testArrayList.add((T) "2");
14
+        String expected = (String) testArrayList.get(1);
15
+        String actual = "2";
16
+
17
+        Assert.assertEquals(actual, expected);
18
+    }
19
+
20
+    @Test
21
+    public void testRemove(){
22
+        MyArrayList<T> testArrayList = new MyArrayList<T>();
23
+        testArrayList.add((T) "1");
24
+        testArrayList.add((T) "2");
25
+        testArrayList.add((T) "3");
26
+        testArrayList.remove(0);
27
+
28
+        String actual = (String) testArrayList.get(1);
29
+        String expected = "3";
30
+
31
+        Assert.assertEquals(expected, actual);
32
+    }
33
+
34
+//    @Test
35
+//    public void testSet(){
36
+//        MyArrayList<T> testArrayList = new MyArrayList<T>();
37
+//        testArrayList.add((T) "1");
38
+//        testArrayList.add((T) "2");
39
+//        testArrayList.add((T) "3");
40
+//
41
+//        String actual = (String) testArrayList.get(0);
42
+//        String expected = "1";
43
+//
44
+//        Assert.assertEquals(expected, actual);
45
+//    }
46
+
47
+    @Test
48
+    public void testConstructor(){
49
+        MyArrayList<T> testArrayList = new MyArrayList(3);
50
+       testArrayList.addWithIndex((T) "2", 2);
51
+
52
+       String expected = "2";
53
+       String actual = (String) testArrayList.get(2);
54
+
55
+       Assert.assertEquals(expected, actual);
56
+    }
57
+
58
+    @Test
59
+    public void testAddWithIndex(){
60
+        MyArrayList<T> testArrayList = new MyArrayList<T>();
61
+        testArrayList.add((T) "1");
62
+        testArrayList.add((T) "2");
63
+        testArrayList.add((T) "3");
64
+        testArrayList.addWithIndex((T) "4", 1);
65
+
66
+        String actual = (String) testArrayList.get(1);
67
+        String expected = "4";
68
+
69
+        Assert.assertEquals(expected, actual);
70
+    }
71
+
72
+    @Test
73
+    public void testSet(){
74
+        MyArrayList<T> testArrayList = new MyArrayList<T>();
75
+        testArrayList.add((T) "1");
76
+        testArrayList.add((T) "2");
77
+        testArrayList.add((T) "3");
78
+        testArrayList.set(1, (T) "4");
79
+
80
+        String actual = (String) testArrayList.get(1);
81
+        String expected = "4";
82
+
83
+        Assert.assertEquals(expected, actual);
84
+    }
85
+
86
+    @Test
87
+    public void testClear(){
88
+        MyArrayList<T> testArrayList = new MyArrayList<T>();
89
+        testArrayList.add((T) "1");
90
+        testArrayList.add((T) "2");
91
+        testArrayList.add((T) "3");
92
+        testArrayList.clear();
93
+
94
+        int actual = testArrayList.size();
95
+        int expected = 0;
96
+
97
+        Assert.assertEquals(expected, actual);
98
+    }
99
+
100
+    @Test
101
+    public void testContains(){
102
+        MyArrayList<T> testArrayList = new MyArrayList<T>();
103
+        testArrayList.add((T) "1");
104
+        testArrayList.add((T) "2");
105
+        testArrayList.add((T) "3");
106
+
107
+        Assert.assertTrue(testArrayList.contains((T) "3"));
108
+        Assert.assertFalse(testArrayList.contains((T) "4"));
109
+    }
110
+
111
+    @Test
112
+    public void isEmptyTest(){
113
+        MyArrayList<T> testArrayList = new MyArrayList<T>();
114
+        Assert.assertTrue(testArrayList.isEmpty());
115
+
116
+        testArrayList.add((T)"3");
117
+        Assert.assertFalse(testArrayList.isEmpty());
118
+    }
119
+
120
+
121
+
122
+
123
+
124
+
125
+}

+ 121
- 0
src/test/java/MySetTest.java 查看文件

@@ -0,0 +1,121 @@
1
+import org.junit.Assert;
2
+import org.junit.Test;
3
+import java.util.Collection;
4
+
5
+
6
+import java.util.HashSet;
7
+import java.util.Iterator;
8
+import java.util.Set;
9
+
10
+public class MySetTest<T> {
11
+
12
+    @Test
13
+    public void addTest(){
14
+        MySet<T> testSet = new MySet<>();
15
+        testSet.add((T) "2");
16
+
17
+        int actual = testSet.size();
18
+        int expected = 1;
19
+
20
+        Assert.assertEquals(expected, actual);
21
+    }
22
+
23
+    @Test
24
+    public void containsTest(){
25
+        MySet<T> testSet = new MySet<>();
26
+        testSet.add((T) "2");
27
+
28
+        Assert.assertTrue(testSet.contains((T) "2"));
29
+    }
30
+
31
+    @Test
32
+    public void containsAllTest(){
33
+        MySet<T> testSet = new MySet<>();
34
+        testSet.add((T) "2");
35
+        testSet.add((T) "3");
36
+        testSet.add((T) "4");
37
+
38
+        Set<T> testSet2 = new HashSet<>();
39
+        testSet2.add((T) "2");
40
+        testSet2.add((T) "3");
41
+
42
+        Assert.assertTrue(testSet.containsAll(testSet2));
43
+
44
+    }
45
+
46
+    @Test
47
+    public void containsAllFalse(){
48
+        MySet<T> testSet = new MySet<>();
49
+        testSet.add((T) "2");
50
+        testSet.add((T) "3");
51
+
52
+        Set<T> testSet2 = new HashSet<>();
53
+        testSet2.add((T) "2");
54
+        testSet2.add((T) "4");
55
+
56
+        Assert.assertFalse(testSet.containsAll(testSet2));
57
+    }
58
+
59
+    @Test
60
+    public void addAllTestTrue(){
61
+        MySet<T> testSet = new MySet<>();
62
+        testSet.add((T) "2");
63
+
64
+        Set<T> testSet2 = new HashSet<>();
65
+        testSet2.add((T)"3");
66
+        testSet2.add((T)"4");
67
+
68
+        Assert.assertTrue(testSet.addAll(testSet2));
69
+        Assert.assertTrue(testSet.containsAll(testSet2));
70
+    }
71
+
72
+    @Test
73
+    public void addAllTestFalse(){
74
+        MySet<T> testSet = new MySet<>();
75
+        testSet.add((T) "2");
76
+        testSet.add((T) "3");
77
+
78
+        Set<T> testSet2 = new HashSet<>();
79
+        testSet2.add((T)"3");
80
+        testSet2.add((T)"4");
81
+
82
+        Assert.assertFalse(testSet.addAll(testSet2));
83
+        Assert.assertTrue(testSet.contains((T) "4"));
84
+    }
85
+
86
+    @Test
87
+    public void clearTest(){
88
+        MySet<T> testSet = new MySet<>();
89
+        testSet.add((T) "2");
90
+        testSet.add((T) "3");
91
+
92
+        testSet.clear();
93
+        Assert.assertFalse(testSet.contains((T) "3"));
94
+    }
95
+
96
+
97
+    @Test
98
+    public void isEmptyTest(){
99
+        MySet<T> testSet = new MySet<>();
100
+
101
+        Assert.assertTrue(testSet.isEmpty());
102
+
103
+        testSet.add((T) "1");
104
+        Assert.assertFalse(testSet.isEmpty());
105
+    }
106
+
107
+
108
+    @Test
109
+    public void toArrayTest(){
110
+        MySet<T> testSet = new MySet<>();
111
+        testSet.add((T) "2");
112
+        testSet.add((T) "3");
113
+
114
+        Object[] testArray = {(T) "2", (T) "3"};
115
+
116
+        Object [] testSetArray = testSet.toArray();
117
+
118
+        Assert.assertEquals(testArray, testSetArray);
119
+    }
120
+
121
+}