Last active
August 29, 2015 14:27
-
-
Save patrykpoborca/1e47a5363bc4e0aabe06 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 LocalDataCache { | |
//pretend this is some read/write to disk :) | |
protected static ArrayList<String> sPastTweets; | |
private Context context; | |
public LocalDataCache(Context context) { | |
this.context = context; | |
sPastTweets = new ArrayList<>(); | |
} | |
public void saveTweet(String tweet) { | |
sPastTweets.add(tweet); | |
} | |
public Observable<List<String>> fetchRecentTweets() { | |
return Observable.just(sPastTweets) | |
.map(arrayList -> { | |
List<String> list = arrayList; | |
return list; | |
}) | |
.delay(2, TimeUnit.SECONDS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment