Java Utililty Methods Collection Subset

List of utility methods to do Collection Subset

  1. HOME
  2. Java
  3. C
  4. Collection Subset

Description

The list of methods to do Collection Subset are organized into topic(s).

Method

boolean isSubset(Collection subset, Collection of)
is Subset
for (Object obj : subset) {
 if (!of.contains(obj)) {
 return false;
return true;
boolean isSubset(Collection subSet, Collection superSet)
Verify if a set is subset of other set
int occurrenceCount = 0;
if (subSet != null && superSet != null) {
 for (E subSetElement : subSet) {
 if (superSet.contains(subSetElement)) {
 occurrenceCount++;
 if (occurrenceCount == subSet.size()) {
...
boolean isSubset(Collection s1, Collection s2)
is Subset
for (T t : s2) {
 if (!s1.contains(t))
 return false;
return true;
boolean isSubset(Collection subset, Collection superset)
is Subset
if ((superset == null) || (superset.size() == 0)) {
 return ((subset == null) || (subset.size() == 0));
HashSet<T> hash = new HashSet<T>(superset);
for (T t : subset) {
 if (!hash.contains(t)) {
 return false;
return true;
boolean isSubset(final Collection l1, final Collection l2)
Checks whether the first collection provided is a subset of the second collection provided.
return l2.containsAll(l1);
List sub(Collection list, int start, int end)
sub
if (list == null || list.isEmpty()) {
 return null;
return sub(new ArrayList<T>(list), start, end);


AltStyle によって変換されたページ (->オリジナル) /