We have been asked to replace ArrayList and use interface List instead in two classes. I've been trying but to no avail. If someone could help with one of the classes to show how it is done, I would be very appreciative. Thanks in advance.
import java.util.ArrayList;
public abstract class Animal
{
// Whether the animal is alive or not.
private boolean alive;
// The animal's field.
private Field field;
// The animal's position in the field.
private Location location;
/**
* Create a new animal at location in field.
*
* @param field The field currently occupied.
* @param location The location within the field.
*/
public Animal(Field field, Location location)
{
alive = true;
this.field = field;
setLocation(location);
}
/**
* Make this animal act - that is: make it do
* whatever it wants/needs to do.
* @param newAnimals A list to add newly born animals to.
*/
abstract public void act(ArrayList<Animal> newAnimals);
/**