rear is an int and in your metho you declare it to throw T

On Thu, Nov 26, 2009 at 1:27 AM, Euvin <juan.eu...@gmail.com> wrote:
> I am getting an error message in T last method. It has something to do
> with generic types and incompatability.
> Could someone explain what I am doing wrong?
>
>
> import java.util.Iterator;
> public class ArrayList<T> implements ListADT<T>, Iterable<T>
> {
>
>
>   protected final int DEFAULT_CAPACITY = 100;
>   private final int NOT_FOUND = -1;
>   protected int rear;
>   protected int front;
>   protected T[] list;
>
> public ArrayList()
>   {
>      rear = 0;
>      list = (T[])(new Object[DEFAULT_CAPACITY]);
>   }
>
>   public ArrayList (int initialCapacity)
>   {
>      rear = 0;
>      list = (T[])(new Object[initialCapacity]);
>   }
>
> public T last()
>   {
>    return rear;
>   }
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "The Java Posse" group.
> To post to this group, send email to javapo...@googlegroups.com.
> To unsubscribe from this group, send email to 
> javaposse+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/javaposse?hl=en.
>
>
>



-- 
http://mapsdev.blogspot.com/
Marcelo Takeshi Fukushima

--

You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javapo...@googlegroups.com.
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.


Reply via email to