self._current = self._current._next return item # Unit tests the <tt>Bag</tt> data type. def run(item_list): import sys bag = Bag() for item in item_list: bag.add(item) sys.stdout.write("size of bag = {}\n".format(bag.size())) for s in bag: sys.stdout.write(" BAG CONTAINS: {}\n".format(s)) def default_examples(): import InputArgs as IA bag = run( IA.get_seq__int_or_str("1 2 3 4 5 6 7 8 9") ) if __name__ == '__main__': import InputArgs as IA import sys if len(sys.argv) == 1: default_examples() else: run( IA.get_list_from_args() ) # Copyright (C) 2002-2010, Robert Sedgewick and Kevin Wayne. # Java last updated: Tue Mar 25 04:52:35 EDT 2014.