hasNext method