浏览代码

first commit

Leon 6 年前
当前提交
ae6467c625

+ 115
- 0
.gitignore 查看文件

@@ -0,0 +1,115 @@
1
+# Created by .ignore support plugin (hsz.mobi)
2
+### Java template
3
+# Compiled class file
4
+*.class
5
+
6
+# Log file
7
+*.log
8
+
9
+# BlueJ files
10
+*.ctxt
11
+
12
+# Mobile Tools for Java (J2ME)
13
+.mtj.tmp/
14
+
15
+# Package Files #
16
+*.jar
17
+*.war
18
+*.ear
19
+*.zip
20
+*.tar.gz
21
+*.rar
22
+
23
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
24
+hs_err_pid*
25
+### Eclipse template
26
+
27
+.metadata
28
+bin/
29
+tmp/
30
+*.tmp
31
+*.bak
32
+*.swp
33
+*~.nib
34
+local.properties
35
+.settings/
36
+.loadpath
37
+.recommenders
38
+
39
+# Eclipse Core
40
+.project
41
+
42
+# External tool builders
43
+.externalToolBuilders/
44
+
45
+# Locally stored "Eclipse launch configurations"
46
+*.launch
47
+
48
+# PyDev specific (Python IDE for Eclipse)
49
+*.pydevproject
50
+
51
+# CDT-specific (C/C++ Development Tooling)
52
+.cproject
53
+
54
+# JDT-specific (Eclipse Java Development Tools)
55
+.classpath
56
+
57
+# Java annotation processor (APT)
58
+.factorypath
59
+
60
+# PDT-specific (PHP Development Tools)
61
+.buildpath
62
+
63
+# sbteclipse plugin
64
+.target
65
+
66
+# Tern plugin
67
+.tern-project
68
+
69
+# TeXlipse plugin
70
+.texlipse
71
+
72
+# STS (Spring Tool Suite)
73
+.springBeans
74
+
75
+# Code Recommenders
76
+.recommenders/
77
+
78
+# Scala IDE specific (Scala & Java development for Eclipse)
79
+.cache-main
80
+.scala_dependencies
81
+.worksheet
82
+### macOS template
83
+*.DS_Store
84
+.AppleDouble
85
+.LSOverride
86
+
87
+# Icon must end with two \r
88
+Icon
89
+
90
+
91
+# Thumbnails
92
+._*
93
+
94
+# Files that might appear in the root of a volume
95
+.DocumentRevisions-V100
96
+.fseventsd
97
+.Spotlight-V100
98
+.TemporaryItems
99
+.Trashes
100
+.VolumeIcon.icns
101
+.com.apple.timemachine.donotpresent
102
+
103
+# Directories potentially created on remote AFP share
104
+.AppleDB
105
+.AppleDesktop
106
+Network Trash Folder
107
+Temporary Items
108
+.apdisk
109
+
110
+#Intellij files
111
+.idea
112
+*.iml
113
+
114
+#maven build target
115
+target/

+ 16
- 0
pom.xml 查看文件

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <modelVersion>4.0.0</modelVersion>
6
+
7
+    <groupId>com.zipcodewilmington</groupId>
8
+    <artifactId>loop_labs</artifactId>
9
+    <version>1.0-SNAPSHOT</version>
10
+    <properties>
11
+        <maven.compiler.source>1.8</maven.compiler.source>
12
+        <maven.compiler.target>1.8</maven.compiler.target>
13
+    </properties>
14
+
15
+
16
+</project>

+ 30
- 0
src/main/java/com/zipcodewilmington/Person.java 查看文件

@@ -0,0 +1,30 @@
1
+package com.zipcodewilmington;
2
+
3
+/**
4
+ * Created by leon on 1/24/18.
5
+ */
6
+public class Person {
7
+    private final String firstName;
8
+    private final String lastName;
9
+
10
+    public Person(String firstName, String lastName) {
11
+        this.firstName = firstName;
12
+        this.lastName = lastName;
13
+    }
14
+
15
+    public String getFirstName() {
16
+        return firstName;
17
+    }
18
+
19
+    public String getLastName() {
20
+        return lastName;
21
+    }
22
+
23
+    @Override
24
+    public String toString() {
25
+        return new StringBuilder()
26
+                .append("My first name is " + firstName)
27
+                .append("My last name is " + lastName)
28
+                .toString();
29
+    }
30
+}

+ 60
- 0
src/main/java/com/zipcodewilmington/PersonHandler.java 查看文件

@@ -0,0 +1,60 @@
1
+package com.zipcodewilmington;
2
+
3
+/**
4
+ * Created by leon on 1/24/18.
5
+ */
6
+public class PersonHandler {
7
+    private final Person[] personArray;
8
+
9
+    public PersonHandler(Person... personArray) {
10
+        this.personArray = personArray;
11
+    }
12
+
13
+    public String whileLoop() {
14
+        String result = "";
15
+        // assume there is a `counter`
16
+        // while `counter` is less than length of array
17
+            // begin loop
18
+
19
+                // use `counter` to identify the `current Person` in the array
20
+                // get `string Representation` of `currentPerson`
21
+                // append `stringRepresentation` to `result` variable
22
+
23
+            // end loop
24
+        return result;
25
+    }
26
+
27
+
28
+
29
+    public String forLoop() {
30
+        String result = "";
31
+        // identify initial value
32
+        // identify terminal condition
33
+        // identify increment
34
+
35
+        // use the above clauses to declare for-loop signature
36
+            // begin loop
37
+                // use `counter` to identify the `current Person` in the array
38
+                // get `string Representation` of `currentPerson`
39
+                // append `stringRepresentation` to `result` variable
40
+            // end loop
41
+
42
+        return result;
43
+    }
44
+
45
+
46
+
47
+    public String forEachLoop() {
48
+        String result = "";
49
+        // identify array's type
50
+        // identify array's variable-name
51
+
52
+        // use the above discoveries to declare for-each-loop signature
53
+            // begin loop
54
+                // get `string Representation` of `currentPerson`
55
+                // append `stringRepresentation` to `result` variable
56
+            // end loop
57
+
58
+        return result;
59
+    }
60
+}

+ 7
- 0
src/test/java/com/zipcodewilmington/PersonHandlerTest.java 查看文件

@@ -0,0 +1,7 @@
1
+package com.zipcodewilmington;
2
+
3
+/**
4
+ * Created by leon on 1/24/18.
5
+ */
6
+public class PersonHandlerTest {
7
+}