iterate types in java