public boolean popBackToWithResult(@LayoutRes int layout,@Nullable Object result){
  final Iterator<ViewStackEntry> viewStackEntryIterator=viewStack.iterator();
  int popCount=0;
  while (viewStackEntryIterator.hasNext()) {
    final ViewStackEntry next=viewStackEntryIterator.next();
    if (next.mLayout == layout) {
      return popWithResult(popCount,result);
    }
    popCount++;
  }
  return false;
}

public boolean popBackToWithResult ( @ LayoutRes int layout , @ Nullable Object result ) { final Iterator < ViewStackEntry > viewStackEntryIterator = viewStack . iterator ( ) ; int popCount = 0 ; while ( viewStackEntryIterator . hasNext ( ) ) { final ViewStackEntry next = viewStackEntryIterator . next ( ) ; if ( next . mLayout == layout ) { return popWithResult ( popCount , result ) ; } popCount ++ ; } return false ; }
pop back to the given layout is on top .
