static wurde der methode readdata ergänzt
This commit is contained in:
parent
27f72a7766
commit
72f3ed5ba6
Binary file not shown.
@ -41,13 +41,13 @@ public class GeneralMethods {
|
||||
* @param pathRead determines the filename of the file that will be read
|
||||
* @return menueList, userList, orderList depending on Data read
|
||||
*/
|
||||
public ArrayList<String> readData(String pathRead) {
|
||||
public static ArrayList<String> readData(String pathRead) {
|
||||
Path path = Paths.get(pathRead);
|
||||
|
||||
try {
|
||||
List<String> rows = Files.readAllLines(path);
|
||||
|
||||
if (pathRead == "menue.txt") {
|
||||
if (pathRead.equals("menue.txt")) {
|
||||
ArrayList<String> menueList = new ArrayList<>();
|
||||
|
||||
for (String row : rows) {
|
||||
@ -64,7 +64,7 @@ public class GeneralMethods {
|
||||
}
|
||||
return menueList;
|
||||
|
||||
} else if (pathRead == "users.txt") {
|
||||
} else if (pathRead.equals("users.txt")){
|
||||
ArrayList<String> userList = new ArrayList<>();
|
||||
|
||||
for (String row : rows) {
|
||||
@ -79,7 +79,7 @@ public class GeneralMethods {
|
||||
}
|
||||
return userList;
|
||||
|
||||
} else if (pathRead == "orders.txt") {
|
||||
} else if (pathRead.equals("orders.txt")) {
|
||||
ArrayList<String> orderList = new ArrayList<>();
|
||||
|
||||
for (String row : rows) {
|
||||
@ -113,9 +113,9 @@ public class GeneralMethods {
|
||||
* @param listToWrite determines which ArrayList is to be used for writing the file
|
||||
*/
|
||||
public void writeData2 (String pathWrite, ArrayList<String> listToWrite){
|
||||
if (pathWrite == "users.txt") {
|
||||
if (pathWrite.equals("users.txt")) {
|
||||
|
||||
} else if (pathWrite == "orders.txt") {
|
||||
} else if (pathWrite.equals("orders.txt")) {
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user