Fix ArrayIndexOutOfBoundException on getting iterator of empty list