public boolean isFull()
{
return total==list.length;
}
// this is very 'off-by-one'-error prone, you should go for
// zero-based indexing.
public String getItem (int i)
{
return list [i-1];
}
public int getTotal()
{
return total;
}
public boolean remove (int numberIn)
{
// to be completed
}
}
03-14-2005, 09:52 AM
Inzaghi
Thanks for your improvements i will do that.
What would i have to change in the code to create a StringQueue class?
Thanks
03-14-2005, 12:03 PM
sjalle
A queue would need code for shifting all its elements to the next 'slot'. The best
would then be a linked list consisting of elements like:
Code:
public class ListElement {
public ListElement previous;
public Object value;
public ListElement next;
}