How can I check if a value that is written in scanner exists in an ArrayList?
List lista = new ArrayList
Better to use a HashSet than an ArrayList when you are checking for existence of a value.
Java docs for HashSet says: "This class offers constant time performance for the basic operations (add, remove, contains and size)"
ArrayList.contains() might have to iterate the whole list to find the instance you are looking for.