@SuppressWarnings("unchecked") public static <C extends Result>ArrayList<C> filterResults(ResultHierarchy hier,Class<? super C> restrictionClass){
  ArrayList<C> res=new ArrayList<>();
  for (Hierarchy.Iter<Result> iter=hier.iterAll(); iter.valid(); iter.advance()) {
    Result result=iter.get();
    if (restrictionClass.isInstance(result)) {
      res.add((C)restrictionClass.cast(result));
    }
  }
  return res;
}

@ SuppressWarnings ( "unchecked" ) public static < C extends Result > ArrayList < C > filterResults ( ResultHierarchy hier , Class < ? super C > restrictionClass ) { ArrayList < C > res = new ArrayList < > ( ) ; for ( Hierarchy . Iter < Result > iter = hier . iterAll ( ) ; iter . valid ( ) ; iter . advance ( ) ) { Result result = iter . get ( ) ; if ( restrictionClass . isInstance ( result ) ) { res . add ( ( C ) restrictionClass . cast ( result ) ) ; } } return res ; }
return only results of the given restriction class
