add one by one to set or construct set time cost code example Example: how to initialize a set in java Set<E> h = new HashSet<E>();