Example #1
0
        public void TestIterator()
        {
            Iterator<Object> i = hs.Iterator();
            int x = 0;
            while (i.HasNext)
            {
                Assert.IsTrue(hs.Contains(i.Next()), "Failed to iterate over all elements");
                ++x;
            }

            Assert.IsTrue(hs.Size() == x, "Returned iteration of incorrect size");
            HashSet<Object> s = new HashSet<Object>();
            s.Add(null);
            Assert.IsNull(s.Iterator().Next(), "Cannot handle null");
        }
Example #2
0
 private ICollection<string> MarkupLabelsOnly(ICollection<string> set1)
 {
     ICollection<string> set = new HashSet<string>(set1);
     for (Iterator<string> it = set.Iterator(); it.HasNext(); )
     {
         if (!it.Next().StartsWith(DefaultLabels.MARKUP_PREFIX))
         {
             it.Remove();
         }
     }
     return set;
 }