How to use this inside a collection class : <p>How can I use THIS keyword to refer to the collection in a class which inherits from an ArrayList like this. I got an error at design time and IDE doesn't allow me to compile my code. </p>

<pre><code>public class Company{

   private EmployeeCollection employees;

   public Company(){
      this.employees = new EmployeeCollection();
      this.employees.add(new Employee());
      this.employees.add(new Employee());
      this.employees.add(new Employee());
      this.employees.add(new Employee());
      this.employees.add(new Employee());
   }

   public void MyMethod(){
      Employee fourthEmployee = employees.getFourth();
   }
}


public class EmployeeCollection extends ArrayList&lt;Employee&gt;{

   public Employee getFourth(){
      return this[3];  //&lt;-- Error
   }

   public Employe getEmployee(int id){
      for(int i = 0; i&lt; this.size(); i++){ //&lt;-- Error
          if(id == this[i].id){  //&lt;-- Error
             return this[i]; //&lt;-- Error
          }
      }
   }

}
</code></pre>

<p>Normally in C# I can do something like this</p>

<pre><code>    public object test(int id)
    {
        for (int i = 0; i &lt; this.Count; i++)
        {
            if (this[i].ID == id)
            {
                return this[i];
            }
        }
        return null;
    }
</code></pre>
