public static ArrayList<Object> mergeAllItemSets(ArrayList<Object> itemSets,int size,int totalTrans){
  ArrayList<Object> newVector=new ArrayList<Object>();
  AprioriItemSet result;
  int numFound, k;
  for (int i=0; i < itemSets.size(); i++) {
    ItemSet first=(ItemSet)itemSets.get(i);
    out:     for (int j=i + 1; j < itemSets.size(); j++) {
      ItemSet second=(ItemSet)itemSets.get(j);
      result=new AprioriItemSet(totalTrans);
      result.m_items=new int[first.m_items.length];
      numFound=0;
      k=0;
      while (numFound < size) {
        if (first.m_items[k] == second.m_items[k]) {
          if (first.m_items[k] != -1) {
            numFound++;
          }
          result.m_items[k]=first.m_items[k];
        }
 else {
          break out;
        }
        k++;
      }
      while (k < first.m_items.length) {
        if ((first.m_items[k] != -1) && (second.m_items[k] != -1)) {
          break;
        }
 else {
          if (first.m_items[k] != -1) {
            result.m_items[k]=first.m_items[k];
          }
 else {
            result.m_items[k]=second.m_items[k];
          }
        }
        k++;
      }
      if (k == first.m_items.length) {
        result.m_counter=0;
        newVector.add(result);
      }
    }
  }
  return newVector;
}

public static ArrayList < Object > mergeAllItemSets ( ArrayList < Object > itemSets , int size , int totalTrans ) { ArrayList < Object > newVector = new ArrayList < Object > ( ) ; AprioriItemSet result ; int numFound , k ; for ( int i = 0 ; i < itemSets . size ( ) ; i ++ ) { ItemSet first = ( ItemSet ) itemSets . get ( i ) ; out : for ( int j = i + 1 ; j < itemSets . size ( ) ; j ++ ) { ItemSet second = ( ItemSet ) itemSets . get ( j ) ; result = new AprioriItemSet ( totalTrans ) ; result . m_items = new int [ first . m_items . length ] ; numFound = 0 ; k = 0 ; while ( numFound < size ) { if ( first . m_items [ k ] == second . m_items [ k ] ) { if ( first . m_items [ k ] != - 1 ) { numFound ++ ; } result . m_items [ k ] = first . m_items [ k ] ; } else { break out ; } k ++ ; } while ( k < first . m_items . length ) { if ( ( first . m_items [ k ] != - 1 ) && ( second . m_items [ k ] != - 1 ) ) { break ; } else { if ( first . m_items [ k ] != - 1 ) { result . m_items [ k ] = first . m_items [ k ] ; } else { result . m_items [ k ] = second . m_items [ k ] ; } } k ++ ; } if ( k == first . m_items . length ) { result . m_counter = 0 ; newVector . add ( result ) ; } } } return newVector ; }
merges all item sets in the set of ( k - 1 ) - item sets to create the ( k ) - item sets and updates the counters .
