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
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) } | |
} | |
} | |
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
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) |
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 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); |
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 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); |