title: Comparing an inputted string to multiple strings efficiently
body: <p>I'm new to Java, and I can't seem to find exactly what I'm looking for on this website. Apologies if it has already been answered in the past!
  Essentially, I'm trying to compare a user inputted string to multiple strings pre-established in the program as a &quot;database&quot;.</p>
  <p>As an example</p>
  <pre class="lang-java prettyprint-override"><code>System.out.println(&quot;Enter a name to check the database&quot;);
  Scanner names= new Scanner(System.in);
  String nameinput= names.next();
  if(!nameinput.equals( *[ database]?* )
  System.out.println(&quot;There is no such name, you cannot continue&quot;);
  </code></pre>
  <p>How do I check if the inputted string is not equal to the entire database individually?</p>
  <p>I have the database set up simply as</p>
  <pre class="lang-java prettyprint-override"><code>class database
  
  {String name, name, name, name... etc.}
  </code></pre>
  <p>I'm trying to stick to keeping things simple and using the database, if at all possible.</p>