public static void deleteTabs(User user,DashBoard dash,int lastTabIndex){
  List<Widget> zeroTabWidgets=new ArrayList<>();
  int removedWidgetPrice=0;
  for (  Widget widget : dash.widgets) {
    if (widget.tabId > lastTabIndex) {
      removedWidgetPrice+=widget.getPrice();
    }
 else {
      zeroTabWidgets.add(widget);
    }
  }
  user.recycleEnergy(removedWidgetPrice);
  dash.widgets=zeroTabWidgets.toArray(new Widget[zeroTabWidgets.size()]);
  dash.updatedAt=System.currentTimeMillis();
}

public static void deleteTabs ( User user , DashBoard dash , int lastTabIndex ) { List < Widget > zeroTabWidgets = new ArrayList < > ( ) ; int removedWidgetPrice = 0 ; for ( Widget widget : dash . widgets ) { if ( widget . tabId > lastTabIndex ) { removedWidgetPrice += widget . getPrice ( ) ; } else { zeroTabWidgets . add ( widget ) ; } } user . recycleEnergy ( removedWidgetPrice ) ; dash . widgets = zeroTabWidgets . toArray ( new Widget [ zeroTabWidgets . size ( ) ] ) ; dash . updatedAt = System . currentTimeMillis ( ) ; }
removes all widgets with tabid greater than lasttabindex
