public Collection<Collection<RegexOccurrence>> findDuplicates() {
		Collection<Collection<RegexOccurrence>> setToReturn = Lists.newArrayList();
		if(! this.occurrences.isEmpty()) {
			List<RegexOccurrence> sortedOcc = Lists.newArrayList(this.occurrences);
			Collections.sort(sortedOcc, new Comparator<RegexOccurrence>() {
				@Override
				public int compare(RegexOccurrence o1, RegexOccurrence o2) {
					return ComparisonChain.start()
							.compare(o1.getBegin(), o2.getBegin())
							.compare(o1.getEnd(), o2.getEnd())
							.result();
				}
			});
			ListIterator<RegexOccurrence> it = sortedOcc.listIterator();
			
			RegexOccurrence current;
			List<RegexOccurrence> doublons = Lists.newArrayListWithCapacity(3);
			doublons.add(it.next());
			while(it.hasNext()) {
				current = it.next();
				if(current.getBegin() == doublons.get(0).getBegin() && current.getEnd() == doublons.get(0).getEnd()) {
					doublons.add(current);
				} else {
					if(doublons.size()>1)
						setToReturn.add(doublons);
					doublons = Lists.newArrayListWithCapacity(3);
					doublons.add(current);
				}
			}
			if(doublons.size()>1)
				setToReturn.add(doublons);
		}
		return setToReturn;
	}
public Collection < Collection < RegexOccurrence > > findDuplicates ( ) { Collection < Collection < RegexOccurrence > > setToReturn = Lists . newArrayList ( ) ; if ( ! this . occurrences . isEmpty ( ) ) { List < RegexOccurrence > sortedOcc = Lists . newArrayList ( this . occurrences ) ; Collections . sort ( sortedOcc , new Comparator < RegexOccurrence > ( ) { @ Override public int compare ( RegexOccurrence o1 , RegexOccurrence o2 ) { return ComparisonChain . start ( ) . compare ( o1 . getBegin ( ) , o2 . getBegin ( ) ) . compare ( o1 . getEnd ( ) , o2 . getEnd ( ) ) . result ( ) ; } } ) ; ListIterator < RegexOccurrence > it = sortedOcc . listIterator ( ) ; RegexOccurrence current ; List < RegexOccurrence > doublons = Lists . newArrayListWithCapacity ( 3 ) ; doublons . add ( it . next ( ) ) ; while ( it . hasNext ( ) ) { current = it . next ( ) ; if ( current . getBegin ( ) == doublons . get ( 0 ) . getBegin ( ) && current . getEnd ( ) == doublons . get ( 0 ) . getEnd ( ) ) { doublons . add ( current ) ; } else { if ( doublons . size ( ) > 1 ) setToReturn . add ( doublons ) ; doublons = Lists . newArrayListWithCapacity ( 3 ) ; doublons . add ( current ) ; } } if ( doublons . size ( ) > 1 ) setToReturn . add ( doublons ) ; } return setToReturn ; }
Finds duplicated occurrences in this buffer and returns them
as a collection of dups lists.
@return