some improvements in java backend strategy rule iterators

While trying to debug something, I realized that rewrite engine is trying to iterate through rewrite rules, but strategy is just returning empty list of rules. I made some simplifications in the iterator methods to prevent this. This should come with a minor performance improvement. (no more iterating through empty lists)

Note that I'm just learning Java backend, so I may have done something wrong. @yilongli @dwightguth please review.