Java tutorial
//package com.java2s; import java.util.Collection; import java.util.Comparator; import java.util.LinkedList; public class Main { public static <E> Collection<E> addGreater(Collection<E> collection, E element, Comparator<E> comp) { Collection<E> resultColl = new LinkedList<>(); for (E e : collection) { if (comp.compare(e, element) > 0) resultColl.add(e); } return resultColl; } }