@Override public int compareTo(FrequentItemSet o){
  Collection<Item> hisItems=o.getItems();
  if (items.size() < hisItems.size()) {
    return -1;
  }
 else   if (items.size() > hisItems.size()) {
    return 1;
  }
 else {
    Iterator<Item> iterator=hisItems.iterator();
    for (    Item myCurrentItem : this.items) {
      int relation=myCurrentItem.compareTo(iterator.next());
      if (relation != 0) {
        return relation;
      }
    }
    return 0;
  }
}

@ Override public int compareTo ( FrequentItemSet o ) { Collection < Item > hisItems = o . getItems ( ) ; if ( items . size ( ) < hisItems . size ( ) ) { return - 1 ; } else if ( items . size ( ) > hisItems . size ( ) ) { return 1 ; } else { Iterator < Item > iterator = hisItems . iterator ( ) ; for ( Item myCurrentItem : this . items ) { int relation = myCurrentItem . compareTo ( iterator . next ( ) ) ; if ( relation != 0 ) { return relation ; } } return 0 ; } }
this method compares frequentitemsets . it first compares the length of items sets , then the items itself . if they are the same , the sets are equal .
