/** * Create a new aggregating set expression using a backing LinkedHashSet * * @param expression values for this expression will be accumulated into a set * @return wrapper expression */ public static <E> AbstractGroupExpression<E, Set<E>> set(Expression<E> expression) { return GSet.createLinked(expression); }
@Override public GroupCollector<T, S> createGroupCollector() { return new GroupCollector<T, S>() { private final S set = createSet(); @Override public void add(T o) { if (o != null) { set.add(o); } } @Override public S get() { return set; } }; } }
/** * Create a new aggregating set expression using a backing TreeSet using the given comparator * * @param expression values for this expression will be accumulated into a set * @param comparator comparator of the created TreeSet instance * @return wrapper expression */ public static <E> AbstractGroupExpression<E, SortedSet<E>> sortedSet(Expression<E> expression, Comparator<? super E> comparator) { return GSet.createSorted(expression, comparator); }
/** * Create a new aggregating set expression using a backing TreeSet * * @param expression values for this expression will be accumulated into a set * @return wrapper expression */ public static <E extends Comparable<? super E>> AbstractGroupExpression<E, SortedSet<E>> sortedSet(Expression<E> expression) { return GSet.createSorted(expression); }
/** * Create a new aggregating set expression using a backing LinkedHashSet * * @param groupExpression values for this expression will be accumulated into a set * @param <E> * @param <F> * @return wrapper expression */ public static <E, F> GroupExpression<E, Set<F>> set(GroupExpression<E, F> groupExpression) { return new MixinGroupExpression<E, F, Set<F>>(groupExpression, GSet.createLinked(groupExpression)); }
@Override public GroupCollector<T, S> createGroupCollector() { return new GroupCollector<T, S>() { private final S set = createSet(); @Override public void add(T o) { if (o != null) { set.add(o); } } @Override public S get() { return set; } }; } }
/** * Create a new aggregating set expression using a backing TreeSet using the given comparator * * @param groupExpression values for this expression will be accumulated into a set * @param comparator comparator of the created TreeSet instance * @return wrapper expression */ public static <E, F> GroupExpression<E, SortedSet<F>> sortedSet(GroupExpression<E, F> groupExpression, Comparator<? super F> comparator) { return new MixinGroupExpression<E, F, SortedSet<F>>(groupExpression, GSet.createSorted(groupExpression, comparator)); }
/** * Create a new aggregating set expression using a backing LinkedHashSet * * @param expression values for this expression will be accumulated into a set * @return wrapper expression */ public static <E> AbstractGroupExpression<E, Set<E>> set(Expression<E> expression) { return GSet.createLinked(expression); }
/** * Create a new aggregating set expression using a backing TreeSet * * @param groupExpression values for this expression will be accumulated into a set * @return wrapper expression */ public static <E, F extends Comparable<? super F>> GroupExpression<E, SortedSet<F>> sortedSet(GroupExpression<E, F> groupExpression) { return new MixinGroupExpression<E, F, SortedSet<F>>(groupExpression, GSet.createSorted(groupExpression)); }
/** * Create a new aggregating set expression using a backing LinkedHashSet * * @param groupExpression values for this expression will be accumulated into a set * @param <E> * @param <F> * @return wrapper expression */ public static <E, F> GroupExpression<E, Set<F>> set(GroupExpression<E, F> groupExpression) { return new MixinGroupExpression<E, F, Set<F>>(groupExpression, GSet.createLinked(groupExpression)); }
/** * Create a new aggregating set expression using a backing TreeSet using the given comparator * * @param expression values for this expression will be accumulated into a set * @param comparator comparator of the created TreeSet instance * @return wrapper expression */ public static <E> AbstractGroupExpression<E, SortedSet<E>> sortedSet(Expression<E> expression, Comparator<? super E> comparator) { return GSet.createSorted(expression, comparator); }
/** * Create a new aggregating set expression using a backing TreeSet * * @param expression values for this expression will be accumulated into a set * @return wrapper expression */ public static <E extends Comparable<? super E>> AbstractGroupExpression<E, SortedSet<E>> sortedSet(Expression<E> expression) { return GSet.createSorted(expression); }
/** * Create a new aggregating set expression using a backing TreeSet * * @param groupExpression values for this expression will be accumulated into a set * @return wrapper expression */ public static <E, F extends Comparable<? super F>> GroupExpression<E, SortedSet<F>> sortedSet(GroupExpression<E, F> groupExpression) { return new MixinGroupExpression<E, F, SortedSet<F>>(groupExpression, GSet.createSorted(groupExpression)); }
/** * Create a new aggregating set expression using a backing TreeSet using the given comparator * * @param groupExpression values for this expression will be accumulated into a set * @param comparator comparator of the created TreeSet instance * @return wrapper expression */ public static <E, F> GroupExpression<E, SortedSet<F>> sortedSet(GroupExpression<E, F> groupExpression, Comparator<? super F> comparator) { return new MixinGroupExpression<E, F, SortedSet<F>>(groupExpression, GSet.createSorted(groupExpression, comparator)); }