Skip to content

Instantly share code, notes, and snippets.

View cloudbank's full-sized avatar
🎯
Focusing

S.G. Vogel cloudbank

🎯
Focusing
View GitHub Profile
@cloudbank
cloudbank / ViewModel.kt
Created January 9, 2018 09:03 — forked from pbochenski/ViewModel.kt
LiveData meets RxJava
class MainViewModel(app: Application) : AndroidViewModel(app) {
private val postRepo = getApplication<App>().postRepo
private val LOAD_ITEM_COUNT = 15
fun getPosts(): LiveData<List<Post>> {
return postRepo.posts.map {
it.map { Post(it.id, it.title, it.url) }
}
}
@cloudbank
cloudbank / ParallelStreamsPuzzler.java
Created April 3, 2017 23:53 — forked from raoulDoc/ParallelStreamsPuzzler.java
Solving a Parallel Streams Puzzler
import java.util.List;
import java.util.stream.LongStream;
import static java.util.stream.Collectors.toList;
public class ParallelStreamsPuzzler {
public static void main(String[] args) {
List<Transaction> transactions
= LongStream.rangeClosed(0, 1_000)
public class MistakesActivity extends ActionBarActivity
{
public static final String TABLE_NAME = "names";
ExecutorService executorService = Executors.newFixedThreadPool(4);
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mistakes);
public class MistakesActivity extends ActionBarActivity
{
public static final String TABLE_NAME = "names";
ExecutorService executorService = Executors.newFixedThreadPool(4);
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mistakes);