Navitem class issue in liferay 6.1 vs Liferay 7

thumbnail
Shiva Lingam K, modified 6 Years ago. New Member Posts: 18 Join Date: 5/9/18 Recent Posts
Hi all,In Liferay 6.1 I am using the below code for navigation purpose based on ancestors from Layout the navigation works
Layout currentLayout = ancestors.get(levelMax);
NavItem navItem = NavItem.fromLayout(vars, currentLayout);

But in Liferay 7 the above method has been changed as shown belowList<NavItem> navItem= NavItem.fromLayouts(httpServletRequest, themeDisplay, (Map<String,Object>)contextObjects);
The above method is list type so I am unable to send the corresponding Navitem and the currentLayout object in that method. I want to use currentLayout in fromLayouts() method. So can anyone send me the solution for this?