private <T> List<T> distinct(List<T> list) {
        List<T> rv = new ArrayList<T>(list.size());
        if (!list.isEmpty() && list.get(0) != null && list.get(0).getClass().isArray()) {
            Set set = new HashSet(list.size());
            for (T o : list) {
                if (set.add(Collections.unmodifiableList(Arrays.asList((Object[]) o)))) {
                    rv.add(o);
                }
            }
            return rv;
        } else {
            for (T o : list) {
                if (!rv.contains(o)) {
                    rv.add(o);
                }
            }
        }
        return rv;
    }
Default implementation of the {@link QueryEngine} interface

@author tiwe
querydsl-collections/src/main/java/com/querydsl/collections/DefaultQueryEngine.java