Replace custom iterator interface by using Java Iterator interface