public void sortByInstanceList ( final List < Instance > _targetList , final Map < Instance , Integer > _currentList ) { final List < Long > idListNew = new ArrayList <> ( ) ; final List < Object > objectListNew = new ArrayList <> ( ) ; for ( final Instance instance : _targetList ) { if ( _currentList . containsKey ( instance ) ) { final Integer i = _currentList . get ( instance ) ; idListNew . add ( this . idList . get ( i ) ) ; objectListNew . add ( this . objectList . get ( i ) ) ; } } this . idList . clear ( ) ; this . idList . addAll ( idListNew ) ; this . objectList . clear ( ) ; this . objectList . addAll ( objectListNew ) ; }
Method sorts the object and idList .