code: public static Iterator<String> difference(Iterator<String> iterA, Iterator<String> iterB)
          throws IOException {
          String cacheName = "compare-" + System.currentTimeMillis();
          cacheManager.addCache(cacheName);
          Cache cache = cacheManager.getCache(cacheName);
  
          while (iterB.hasNext()) {
              String item = iterB.next();
              cache.put(new Element(item, null));
          }
  
          int diffCnt = 0;
          File diffFile = new File(System.getProperty("java.io.tmpdir") +
                                   File.separator + "diff-" +
                                   System.currentTimeMillis() + ".txt");
          FileWriter fileWriter = new FileWriter(diffFile);
          while (iterA.hasNext()) {
              String item = iterA.next();
              if (!cache.isKeyInCache(item)) {
                  // write item to file
                  fileWriter.write(item + "\n");
                  diffCnt++;
                  if (diffCnt % 100 == 0) {
                      fileWriter.flush();
                  }
              }
          }
          fileWriter.close();
  
          // All done with the cache, clean it up
          cache.removeAll();
          cacheManager.removeCache(cache.getName());
  
          if (diffCnt > 0) {
              return new FileLineIterator(diffFile);
          } else {
              // nothing written to the file so not needed, delete it
              diffFile.delete();
              return new ArrayList<String>(0).iterator();
          }
      }
docs: Returns an Iterator contain the difference of elements contained in the
  provided Iterators. The returned Iterator contains all elements that are
  contained by iterA and not contained by iterB. iterB may also contain
  elements not present in iterA; these are simply ignored.
  
  @param iterA
  @param iterB
  @return an Iterator containing elements in iterA but not in iterB