title: Check for multiple instances of same object in array
body: <p>i am looking for a way to check if an array contains more than 1 instances of the same object. I've been looking around but can't seem to find anything in the javadoc nor stackoverflow.</p>
  
  <p>I am creating a monopoly board game (or in danish, matador) where the fee from landing on one of the fields differs depending on how many of that type of field the player owns.</p>
  
  <p>I have a list in my player class in which i put all the fields that the player buys:</p>
  
  <pre><code>   public List&lt;OwnableField&gt; ownsList = new ArrayList&lt;&gt;();
  
      public void buy(OwnableField ownable) {
         pay(ownable.getPrice());
         ownsList.add(ownable);
      }
  </code></pre>
  
  <p>And then i have this method in the specific field class, in which i am working on an if statement to set the fee:</p>
  
  <pre><code>public int fee;
  
  public int feeCalc(int diceScore) {
  
      if(this.getOwner().ownsList.(whatever checks for duplicate object in array)){
  
          fee = 200 * diceScore;
  
      } else {
  
          fee = 100 * diceScore;
  
      }
  
      return fee;
  }
  </code></pre>