import java.util.*;
import java.io.PrintStream;

/**
 * This app creates a list of random rectangles, prints it, sorts it and prints it again.
 * 
 * @author cbc
 */
public class RectangleSort
{
    /**
     * Creates a list of random rectangles, prints it, sorts it and prints it again.
     * 
     * @param args
     */
    public static void main(String[] args)
    {
	PrintStream output = System.out;
	
	final int MAX_WIDTH = 10;
	final int MAX_HEIGHT = 10;
	final int MAX_SIZE = 10;
		
	List<Rectangle> list = new LinkedList<Rectangle>();
	Random random = new Random();
	int size = random.nextInt(MAX_SIZE + 1);
	for (int i = 0; i < size; i++)
	{
	    list.add(new Rectangle(random.nextInt(MAX_WIDTH + 1), random.nextInt(MAX_HEIGHT + 1)));
	}
	output.println(list);
	Collections.sort(list);
	output.println(list);
    }
}
