public class SourceComparator extends java.lang.Object implements java.util.Comparator<NewsStory>
The SourceComparator compares the sources of two news stories.
Note that the constructor has nothing to do, so it is omitted.
Modifier and Type | Field and Description |
---|---|
static SourceComparator |
SOURCE_COMPARATOR |
Constructor and Description |
---|
SourceComparator() |
Modifier and Type | Method and Description |
---|---|
int |
compare(NewsStory newsStory1,
NewsStory newsStory2)
Overridden compare method that looks at the sources of the news stories.
|
public static final SourceComparator SOURCE_COMPARATOR
public int compare(NewsStory newsStory1, NewsStory newsStory2)
compare
in interface java.util.Comparator<NewsStory>
newsStory1
- The first news story to compare by source.newsStory2
- The second news story to compare by source.