Skip to content

Commit 53bb927

Browse files
Nam Thai NguyenNam Thai Nguyen
authored andcommitted
Modifies the Data class
1 parent 710c25f commit 53bb927

1 file changed

Lines changed: 6 additions & 18 deletions

File tree

  • core-java/src/main/java/com/baeldung/javac
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,16 @@
11
package com.baeldung.javac;
22

3-
import java.io.Serializable;
43
import java.util.ArrayList;
54
import java.util.List;
65

7-
public class Data implements Serializable {
8-
static List<String> textList = new ArrayList();
6+
public class Data {
7+
List<String> textList = new ArrayList();
98

10-
private static void addText() {
11-
textList.add("baeldung");
12-
textList.add(".");
13-
textList.add("com");
9+
public void addText(String text) {
10+
textList.add(text);
1411
}
1512

1613
public List getTextList() {
17-
this.addText();
18-
List<String> result = new ArrayList<String>();
19-
String firstElement = (String) textList.get(0);
20-
switch (firstElement) {
21-
case "baeldung":
22-
result.add("baeldung");
23-
case "com":
24-
result.add("com");
25-
}
26-
return result;
14+
return this.textList;
2715
}
28-
}
16+
}

0 commit comments

Comments
 (0)