All pastes #2081658 Raw Edit

Mine

public java v1 · immutable
#2081658 ·published 2011-09-20 21:39 UTC
rendered paste body
import java.util.ArrayList;import java.util.Collections;import java.util.Comparator;import java.util.List;public class ShopProducts {	public static void main(String[] args){			List<Product> pa = new ArrayList<Product>();				Collections.sort(pa, new ProductComparator());		}		class ProductComparator implements Comparator{		public int compare(Object one, Object two){			return ((Product)one).getCategory().compareTo(((Product)two).getCategory());		}	}	}// Possible categories listed in the desirable order:// DVD, CD, GAME, BOOK, ACCESSORIESclass Product{	private String name;	private String category;	private int id;		public void setName(String name){		this.name = name;	}		public String getName(){		return name;	}	public void setCategory(String cat){		this.category = cat;	}		public String getCategory(){		return this.category;	}		public void setId(int id){		this.id = id;	}}