package net.sf.kerner.utils.collections;

import java.util.Collection;
import java.util.Comparator;

public class CollectionUtils {
	
	private CollectionUtils(){}
	
	public static <T> T getHighest(Collection<? extends T> elements, Comparator<T> c){
		T result = null;
		
		for(T e : elements){
			if(result == null){
				result = e;
			} else {
				int i = c.compare(e, result);
				if(i > 0)
					result = e;
			}
		}
		
		return result;
	}
	
	public static <T> T getLowest(Collection<? extends T> elements, Comparator<T> c){
		T result = null;
		
		for(T e : elements){
			if(result == null){
				result = e;
			} else {
				int i = c.compare(e, result);
				if(i < 0)
					result = e;
			}
		}
		
		return result;
	}

}

@@ -97,69 +97,463 @@
 or;%0A
-%0Apublic class CollectionUtils %7B%0A%09%0A%09private CollectionUtils()%7B
+import java.util.Iterator;%0A%0Aimport net.sf.kerner.utils.StringUtils;%0A%0Apublic class CollectionUtils %7B%0A%09%0A%09private CollectionUtils()%7B%7D%0A%09%0A%09public static String toString(Iterable%3C?%3E elements)%7B%0A%09%09final StringBuilder b = new StringBuilder();%0A%09%09b.append(StringUtils.NEW_LINE_STRING);%0A%09%09final Iterator%3C?%3E i = elements.iterator();%0A%09%09while(i.hasNext())%7B%0A%09%09%09b.append(i.next());%0A%09%09%09if(i.hasNext())%0A%09%09%09%09b.append(StringUtils.NEW_LINE_STRING);%0A%09%09%7D%0A%09%09return b.toString();%0A%09
 %7D%0A%09%0A

Introduce CollectionUtils#toString().