Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ArrayList<Account> findAccountByLastName(String lastName) {
- ArrayList<Account> result = new ArrayList<>();
- for (Account account : accounts) {
- if (lastName.equals(account.getUser().getLastName())) {
- result.add(account);
- }
- }
- return result;
- }
- private void findAccountByLastNameAction() {
- String lastName;
- boolean guard = false;
- System.out.println("To jest akcja wyszukania konta poprzez nazwisko ");
- do {
- System.out.println("Podaj nazwisko");
- lastName = getUserInput();
- guard = Validator.checkLastName(lastName);
- } while (guard == false);
- ArrayList<Account> a = accountManager.findAccountByLastName(lastName);
- for(Account account : a) {
- accountManager.printAccount(account);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement