title: More than once in an arrayList with user input
body: <p>In the code below I need to check if a number appears more than once in an <code>ArrayList</code>. The user inputs a number to consult, and if it exist in the <code>array</code> and there are more than one the messages, "appears more than once is displayed". I have been trying to do this but I don't know how.</p>
  
  <p>This is the <code>main</code> class: </p>
  
  <pre><code>    ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;();
      list.add(3);
      list.add(2);
      list.add(7);
      list.add(2);
  
      System.out.println("Type a number: ");
      int number = Integer.parseInt(sc.nextLine());
      if (Metodos.moreThanOne(list, number)) {
          System.out.println(number + " appears more than once.");
      } else {
          System.out.println(number + " does not appear more than once.");
      }
  </code></pre>
  
  <p>This is the method:</p>
  
  <pre><code>public static boolean moreThanOne(ArrayList&lt;Integer&gt; list, int number) {
      for (Integer in : list) {
          if (list.contains(number) &amp;&amp; in==in) {
              return true;
          }
      }
      return false;
  }
  </code></pre>