Check if a value exists in ArrayList

How can I check if a value that is written in scanner exists in an ArrayList? List<CurrentAccount> lista = new ArrayList<CurrentAccount>(); CurrentAccount conta1 = new CurrentAccount(“Alberto Carlos”, 1052); CurrentAccount conta2 = new CurrentAccount(“Pedro Fonseca”, 30); CurrentAccount conta3 = new CurrentAccount(“Ricardo Vitor”, 1534); CurrentAccount conta4 = new CurrentAccount(“João Lopes”, 3135); lista.add(conta1); lista.add(conta2); lista.add(conta3); lista.add(conta4); Collections.sort(lista); System.out.printf(“Bank … Read more

How do I check if string contains substring? [duplicate]

This question already has answers here: How to check whether a string contains a substring in JavaScript? (3 answers) Closed 4 years ago. I have a shopping cart that displays product options in a dropdown menu and if they select “yes”, I want to make some other fields on the page visible. The problem is … Read more