import java.util.ArrayList;
public class OrderableList
{
	private String title;
	private ArrayList<Comparable> store;
	
	public OrderableList(String title)
	{
		this.title = title;
		this.store = new ArrayList<Comparable>();
	}
	
	public OrderableList()
	{
		this("");
	}
	
	public String getTitle()
	{
		return title;
	}
	
	public int getCount()
	{
		return this.store.size();
	}
	
	public ArrayList<Comparable> getData()
	{
		ArrayList<Comparable> data = new ArrayList<Comparable>();
		for (Comparable item : this.store)
			data.add(item);
		return data;
	}
	
	public void append(Comparable item)
	{
		if (!this.store.contains(item))
			this.store.add(item);
	}
	
	public void insert(Comparable item)
	{
		int index = this.store.size()-1;
		while (index >= 0 && this.store.get(index).compareTo(item) > 0)
			index--;
			
		if (index >= 0 && this.store.get(index).equals(item))
			return;
			
		this.store.add(index+1, item);
	}
	
	public void erase(Comparable item)
	{
		this.store.remove(item);
	}
	
	public String toString()
	{
		String image = this.title + "\n" + this.store.size() + " Items";
		for (int i = 1; i <= this.store.size(); i++)
			image += "\n" + (i < 10 ? " " : "") + i + ": "
			              + this.store.get(i-1);
		return image;
	}
}