also use iterator class on java