Code example for TreeSet

0
	} 
 
	private final Set<LiveBeansModel> collection; 
 
	private LiveBeansModelCollection() { 
		collection = new TreeSet<LiveBeansModel>(); 
	} 
 
	public void addModel(LiveBeansModel model) { 
		if (collection.contains(model)) { 
			collection.remove(model); 
		} 
		collection.add(model); 
	} 
 
	public Set<LiveBeansModel> getCollection() { 
		return collection; 
	} 
 
}