Modifies the Data class

This commit is contained in:
Nam Thai Nguyen 2018-02-03 20:21:46 +07:00
parent 710c25fb01
commit 53bb927610
1 changed files with 6 additions and 18 deletions

View File

@ -1,28 +1,16 @@
package com.baeldung.javac;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class Data implements Serializable {
static List<String> textList = new ArrayList();
public class Data {
List<String> textList = new ArrayList();
private static void addText() {
textList.add("baeldung");
textList.add(".");
textList.add("com");
public void addText(String text) {
textList.add(text);
}
public List getTextList() {
this.addText();
List<String> result = new ArrayList<String>();
String firstElement = (String) textList.get(0);
switch (firstElement) {
case "baeldung":
result.add("baeldung");
case "com":
result.add("com");
}
return result;
return this.textList;
}
}
}