diff --git a/src/main/java/SignUpGUI.java b/src/main/java/SignUpGUI.java index 70aa72f..faa360d 100644 --- a/src/main/java/SignUpGUI.java +++ b/src/main/java/SignUpGUI.java @@ -149,14 +149,7 @@ public class SignUpGUI extends JFrame implements ActionListener { // Function to check if the input username doesn't already exist in the JSON file private boolean isUsernameAvailable(String filename, String username) { List userList = CreateUser.readUserListFromJsonFile(filename); - if (userList != null) { - for (CreateUser user : userList) { - if (user.getUserName().equals(username)) { - return false; - } - } - } - return true; + return userList == null || userList.stream().noneMatch(user -> user.getUserName().equals(username)); } public static void main(String[] args) {