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

View File

@ -1,28 +1,16 @@
package com.baeldung.javac; package com.baeldung.javac;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class Data implements Serializable { public class Data {
static List<String> textList = new ArrayList(); List<String> textList = new ArrayList();
private static void addText() { public void addText(String text) {
textList.add("baeldung"); textList.add(text);
textList.add(".");
textList.add("com");
} }
public List getTextList() { public List getTextList() {
this.addText(); return this.textList;
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;
} }
} }