I have this code:
var kitchenList: MutableList<Dish> = ArrayList()
var intervalObser = interval(1, TimeUnit.SECONDS)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
intervalObser.subscribe({
fromIterable(orderList)
.filter { it.status.equals("to create")
}
.subscribe({
kitchenList.add(it)
Log.d("add", "success")
},{Log.d("add", "error")})
},{})
where he finds meals to be done and adds them to the list in the kitchen every second but how to check if the data about a specific id is already on the kitchenList using rxJava? And how to stop adding 10 dishes and restart adding after removing one or more.
Is there any other method responsible for the repetition than the interval used above?
You could do something like this (although it is a bit convoluted for producing the required behavior):