/** * Returns <tt>true</tt> iff <i>a</i> is a <i>proper</i> sub-collection of * <i>b</i>, that is, iff the cardinality of <i>e</i> in <i>a</i> is less * than or equal to the cardinality of <i>e</i> in <i>b</i>, for each * element <i>e</i> in <i>a</i>, and there is at least one element <i>f</i> * such that the cardinality of <i>f</i> in <i>b</i> is strictly greater * than the cardinality of <i>f</i> in <i>a</i>. * <p/> * The implementation assumes * <ul> * <li><code>a.size()</code> and <code>b.size()</code> represent the total * cardinality of <i>a</i> and <i>b</i>, resp.</li> * <li><code>a.size() < Integer.MAXVALUE</code></li> * </ul> * * @param a * the first (sub?) collection, must not be null * @param b * the second (super?) collection, must not be null * @return <code>true</code> iff <i>a</i> is a <i>proper</i> sub-collection * of <i>b</i> * @see #isSubCollection * @see Collection#containsAll */ public static <E> boolean isProperSubCollection( final Collection<? extends E> a, final Collection<? extends E> b) { return (a.size() < b.size()) && CollectionUtils.isSubCollection(a, b); }