Merge pull request #3575 from nguyennamthai/BAEL-1500

Modifies the Data class
This commit is contained in:
Tom Hombergs 2018-02-03 21:21:01 +01:00 committed by GitHub
commit 8b7630335a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}
}
}