How to convert "apply" in this kotlin code to java?

vaishak bg :

I need to convert this kotlin code to java to set the itemAnimator for a recylcer view

cardStackView.itemAnimator.apply {
        if (this is DefaultItemAnimator) {
            supportsChangeAnimations = false
        }
    }

So far i have come up with something like this:

cardStackView.setItemAnimator(new DefaultItemAnimator(){

             @Override
             public void setSupportsChangeAnimations(boolean supportsChangeAnimations) {
                                         super.setSupportsChangeAnimations(supportsChangeAnimations);

                   }
             }
    );
Erlang P :
RecyclerView.ItemAnimator itemAnimator = cardStackView.getItemAnimator();
        if (itemAnimator instanceof DefaultItemAnimator) {
            DefaultItemAnimator di = (DefaultItemAnimator) itemAnimator;
            di.setSupportsChangeAnimations(false);
        }

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=477863&siteId=1