private void filterFullMatches(final List<Item> newFindings, final List<Item> oldFindings) { // Filter 100% matches: final Iterator<Item> newIterator = newFindings.iterator(); while (newIterator.hasNext()) { final Item newItem = newIterator.next(); final Iterator<Item> oldIterator = oldFindings.iterator(); while (oldIterator.hasNext()) { final Item oldItem = oldIterator.next(); if (isSameFinding(newItem, oldItem)) { newItem.setSince(oldItem.getSince()); newIterator.remove(); oldIterator.remove(); break; } } } }
private void filterPartialMatches(final List<Item> newFindings, final List<Item> oldFindings) { // Filter matches that 'moved' within the file. // There is for sure a better algorithm possible.. final Iterator<Item> newIterator = newFindings.iterator(); while (newIterator.hasNext()) { final Item newItem = newIterator.next(); final Iterator<Item> oldIterator = oldFindings.iterator(); while (oldIterator.hasNext()) { final Item oldItem = oldIterator.next(); if (isPartialSameFinding(newItem, oldItem)) { newItem.setSince(oldItem.getSince()); newIterator.remove(); oldIterator.remove(); break; } } } }
private void flagAsNew(Item item) { item.unsetOld(); item.setNew(true); item.setSince(mReportDate); }