@@ -0,0 +1,1054 @@
+package org.psjava.example.ds;%0D%0A%0D%0Aimport org.junit.Assert;%0D%0Aimport org.junit.Test;%0D%0Aimport org.psjava.ds.set.InsertAllToSet;%0D%0Aimport org.psjava.ds.set.MutableSet;%0D%0Aimport org.psjava.ds.set.Set;%0D%0Aimport org.psjava.ds.set.SetFromVarargs;%0D%0Aimport org.psjava.goods.GoodMutableSetFactory;%0D%0Aimport org.psjava.util.VarargsIterable;%0D%0A%0D%0Apublic class SetExample %7B%0D%0A%0D%0A%09@Test%0D%0A%09public void example() %7B%0D%0A%09%09// Set is an read-only interface which is different from java.util.Set%0D%0A%09%09// MutableSet interface is modifiable.%0D%0A%0D%0A%09%09MutableSet%3CString%3E set1 = GoodMutableSetFactory.getInstance().create();%0D%0A%09%09set1.insert(%22A%22);%0D%0A%09%09set1.insert(%22A%22);%0D%0A%09%09set1.insert(%22B%22);%0D%0A%09%09set1.insert(%22C%22);%0D%0A%0D%0A%09%09int size = set1.size(); // must be 3%0D%0A%09%09Assert.assertEquals(3, size);%0D%0A%0D%0A%09%09// You can insert many items at once.%0D%0A%09%09InsertAllToSet.insertAll(set1, VarargsIterable.create(%22X%22, %22Y%22, %22Z%22));%0D%0A%09%09Assert.assertEquals(6, set1.size());%0D%0A%0D%0A%09%09// You can simply create a set from values.%0D%0A%09%09Set%3CInteger%3E set2 = SetFromVarargs.create(1, 2, 3, 4);%0D%0A%09%09Assert.assertEquals(4, set2.size());%0D%0A%09%7D%0D%0A%7D%0D%0A

add SetExample