Fixed regression in rendering repeated Java form fields

Fixes #2499

The actual bug was that the the Java Field.indexes implementation was
not returning distinct indexes when the form had no value associated
with it (eg, if it failed validation), so if a field that was repeated
had multiple sub fields, the repeat hepler would render it once for
every sub field.

Additionally, in that case, the ordering of the indexes was made
random by virtue of being calculated fdrom the keys of a HashMap, where
but the indexes should be returned in order.

This only just exposed itself because the old repeat helper simply
rendered as many fields as the maximum index.  The new one however
renders fields equivalent to what indexes exist in the form.

New tests test both that only one of each index appears, and that
indexes are always returned in order.