@Override public void processLine(String value) { Matcher matcher = pattern.matcher(value); totalTweets++; while (matcher.find()) { String matchedUrl = matcher.group(); System.out.println("Found url: " + matchedUrl); urlCounterTable.add(new UrlKey(matchedUrl)); totalCount1++; } }
public void printResults(PrintStream stream) { final String outputFormat = "%1$s\t%2$s"; Collection<CountHolder<UrlKey>> results = urlCounterTable.getReverseSorted(); int totalCount = 0; for (CountHolder<UrlKey> result : results) { totalCount += result.getCount(); stream.println(String.format(outputFormat, result.getComponent(), result.getCount())); } System.out.println("Tweets: " + totalTweets); System.out.println("(1) Total URLs found: " + totalCount1); System.out.println("Total URLs found: " + totalCount); }