TreeSet Test Program #1
test add():
after adding 42, set = [42], size = 1
after adding 29, set = [29, 42], size = 2
after adding 42, set = [29, 42], size = 2
after adding 17, set = [17, 29, 42], size = 3
after adding 112, set = [17, 29, 42, 112], size = 4
after adding -9, set = [-9, 17, 29, 42, 112], size = 5
after adding 17, set = [-9, 17, 29, 42, 112], size = 5
after adding 82, set = [-9, 17, 29, 42, 82, 112], size = 6
after adding 53, set = [-9, 17, 29, 42, 53, 82, 112], size = 7
test contains():
[-9, 17, 29, 42, 53, 82, 112] contains( 42)? true
[-9, 17, 29, 42, 53, 82, 112] contains( 29)? true
[-9, 17, 29, 42, 53, 82, 112] contains( 42)? true
[-9, 17, 29, 42, 53, 82, 112] contains( 17)? true
[-9, 17, 29, 42, 53, 82, 112] contains(112)? true
[-9, 17, 29, 42, 53, 82, 112] contains( -9)? true
[-9, 17, 29, 42, 53, 82, 112] contains( 17)? true
[-9, 17, 29, 42, 53, 82, 112] contains( 82)? true
[-9, 17, 29, 42, 53, 82, 112] contains( 53)? true
[-9, 17, 29, 42, 53, 82, 112] contains( 55)? false
[-9, 17, 29, 42, 53, 82, 112] contains(182)? false
[-9, 17, 29, 42, 53, 82, 112] contains(-91)? false
[-9, 17, 29, 42, 53, 82, 112] contains(888)? false
[-9, 17, 29, 42, 53, 82, 112] contains( 72)? false
[-9, 17, 29, 42, 53, 82, 112] contains( 33)? false
[-9, 17, 29, 42, 53, 82, 112] contains(999)? false
[-9, 17, 29, 42, 53, 82, 112] contains(-17)? false
iterator:
iterator next() = ago
iterator next() = and
iterator next() = four
iterator next() = score
iterator next() = seven
iterator next() = years
Iterable:
foreach loop value = ago
foreach loop value = and
foreach loop value = four
foreach loop value = score
foreach loop value = seven
foreach loop value = years
test remove():
after removing 55, set = [-9, 17, 29, 42, 53, 82, 112], size = 7, contains(55)? false
after removing 42, set = [-9, 17, 29, 53, 82, 112], size = 6, contains(42)? false
after removing 182, set = [-9, 17, 29, 53, 82, 112], size = 6, contains(182)? false
after removing 17, set = [-9, 29, 53, 82, 112], size = 5, contains(17)? false
after removing -91, set = [-9, 29, 53, 82, 112], size = 5, contains(-91)? false
after removing 82, set = [-9, 29, 53, 112], size = 4, contains(82)? false
after adding 22, set = [-9, 22, 29, 53, 112], size = 5, contains(22)? true
test clear():
after clear #1, set = [], size = 0, isEmpty = true
after clear #2, set = [], size = 0, isEmpty = true
All tests complete.