Created
December 29, 2012 03:15
-
-
Save piyush0101/4404325 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AbstractTweetService { | |
protected List<Tweet> tweets; | |
public AbstractTweetService() { | |
tweets = TweetDownloader.downloadTweets(); | |
} | |
public void persistTweets(String user, int numberOfTweets) { | |
TweetPersister.persistTweets(); | |
} | |
} | |
public class TweetCountService extends AbstractTweetService { | |
public TweetCountService() { | |
super(); | |
} | |
public int countTweetsFrom(String user) { | |
int numberOfTweets = 0; | |
for (Tweet tweet : tweets) { | |
if (tweet.getUser().equals(user)) { | |
numberOfTweets++; | |
} | |
} | |
return numberOfTweets; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment