Panczur
Panczur

Reputation: 651

Android, how to merge two custom ArrayList?

So, I have two different ArrayList with custom object. First one is ArrayList which cointain date like "Today", "Tomorrow" etc, second one is ArrayList which cointains information about events. I want to send them to RecyclerAdapter, and then with two holders make recycler view of items. Something like that:

I would like to merge this ArrayLists in one and then send them to adapter, but i have no clue, how can I achieve that

Upvotes: 1

Views: 371

Answers (1)

Marat
Marat

Reputation: 6703

It is basically data structure question. You can use Merge Sort algorithm. There are many tutorial on web. Link for one of them is given below. Run through it and you will have an idea of how to solve your problem.

http://howtodoinjava.com/algorithm/merge-sort-java-example/

It is basically theory. You will probably need to think on your own algorithm.

Upvotes: 1

Related Questions