Here you can find the source of addAll(Set s, Iterator i)
private static void addAll(Set s, Iterator i)
//package com.java2s; import java.util.Iterator; import java.util.Set; public class Main { private static void addAll(Set s, Iterator i) { while (i != null && i.hasNext()) { s.add(i.next());//from w ww . ja v a2 s. c o m } } }