I have this code in kotlin. I am not very familiar with kotlin and hence facing difficulty converting this to java.
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        val recyclerView = view.findViewById<RecyclerView>(R.id.recycler_view)
        val adapter = StackCardAdapter(activity!!.applicationContext)
        adapter.onItemClickListener = { cardView, cardViewModel ->
            val fromPosition = thelist.indexOf(cardViewModel)
            val toPos = 0 
      }
The StackCardAdapter is as follows:
class StackCardAdapter(context: Context) : ListAdapter<CardViewModel, CardViewHolder>(diffUtil) {
    companion object {
           // irrelevant code here 
    }
    var onItemClickListener: ((cardView: CardView, cardViewModel: CardViewModel) -> Unit)? = null
EDIT: Not a listener to the recyclerView. Need to implement lambda functions to create onItemClickListener for ListAdapter
I need to implement the onItemClickListener in OnViewCreated of my fragment. Thank you
 
     
    