'How to update options in Firebase Paging Adapter?

I am using Firestore Paging Adapter to display posts from Firestore. Initially it shows all the posts. I want to add button that will filter posts, for example for particular date.

query = firebaseFirestore.collectionGroup("posts")
                .orderBy("start", Query.Direction.ASCENDING)
                .whereGreaterThan("start", Timestamp.now());


        PagedList.Config config = new PagedList.Config.Builder()
                .setInitialLoadSizeHint(10)
                .setPageSize(5)
                .build();

        FirestorePagingOptions<MyPost> options = new FirestorePagingOptions.Builder<MyPost>()
                .setQuery(query, config, MyPost.class)
                .build();

        adapter = new FirestorePagingAdapter<MyPost, PostViewHolder>(options){
        ....
        }

How can I update options object or the query inside it? I found article that told we can use updateOptions() method in Kotlin, but it is not available in Java. https://medium.com/firebase-developers/update-queries-without-changing-recyclerview-adapter-using-firebaseui-android-32098b3082b2



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source