Modifies the Data class
This commit is contained in:
parent
710c25fb01
commit
53bb927610
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue