Output from Adapters1.class ---------------------- Unsorted native int array = int[]( 3, -1, 2, -3, 4 ) Sorted = int[]( -3, -1, 2, 3, 4 ) Randomized = int[]( -1, -3, 2, 4, 3 ) -1 -3 2 4 3 Output from Adapters2.class ---------------------- Unsorted JDK Vector = [3, -1, 2, -3, 4] Sorted = [-3, -1, 2, 3, 4] Randomized = [-3, -1, 2, 3, 4] JDK vector = [-3, -1, 2, 3, 4] Output from Algorithms1.class ---------------------- PRINT cat PRINT monkey PRINT goat list = SList( 3, 7, 4 ), total = 14 Output from Algorithms2.class ---------------------- vector before copying = [1, 4] vector after copying = [1, 4, 2, 6, 3, 7] Output from Algorithms3.class ---------------------- list = SList( -1, 1, -2, 1, -3 ) Occurences of 1 = 2 Occurences of a negative = 3 Output from Algorithms4.class ---------------------- array = int[]( 3, 7, 8, 2, -5, 8, 9, -2 ) first negative = -5 some items are negative = true Output from Algorithms5.class ---------------------- array1 = Array( cat, monkey, goat, elephant ) strings with length > 4 = Array( monkey, elephant ) strings with length <= 4 = Array( cat, goat ) Output from Algorithms6.class ---------------------- list = DList( -1, 1, -2, 1, -3 ) after 1 -> 4, list = DList( -1, 4, -2, 4, -3 ) list = DList( -1, 4, -2, 4, -3 ) array = Array( 0, 4, 0, 4, 0 ) Output from Algorithms7.class ---------------------- before reverse = Deque( Batman, Superman, Phantom, Spiderman ) after reverse = Deque( Spiderman, Phantom, Superman, Batman ) Output from Algorithms8.class ---------------------- unsorted array = Array( 3, -2, 4, -5 ) sorted array = Array( -5, -2, 3, 4 ) unsorted deque = Deque( triangle, square, pentagon, hexagon ) sorted deque = Deque( hexagon, pentagon, square, triangle ) Output from Algorithms9.class ---------------------- ints1 = int[]( 1, 3, 5, 2 ) array = Array( -1, -3, -5, -2 ) ints2 = int[]( 2, 4, 2, 3 ) ints3 = int[]( 3, 6, 2, 1 ) list = SList( 6, 24, 4, 3 ) array1 = Array( cat, monkey, goat ) array2 = Array( 3, 6, 4 ) Output from Applying1.class ---------------------- array = Array( cat, dog, emu ) Print each element to standard output cat dog emu Print each element to standard output cat dog emu Output from Applying2.class ---------------------- array = Array( 100, 2, 71 ) injecting TimesInteger(initial value==1) = 14200 injecting PlusInteger(initial value==0) = 173 injecting MinusInteger(initial value==0) = -173 injecting DividesInteger(initial value==1000) = 7 Output from Array1.class ---------------------- Array( ape, bat, cat ) Enumerate the Array ape bat cat Iterate through the Array ape bat cat Demonstrate access array.at( 0 ) = ape array.front() = ape array.at( 2 ) = cat array.back() = cat Demonstrate modification Array( ape, fox, cat ) After popFront() = Array( fox, cat ) After popBack() = Array( fox ) Output from Array2.class ---------------------- Array( ape, bat, cat, bat, bat, cat ) array.count( bat ) = 3 array.indexOf( bat ) = 1 After array.remove( 1 ) = Array( ape, cat, bat, bat, cat ) After array.replace( 0, 2, bat, BAT ) = Array( ape, cat, BAT, bat, cat ) array.remove( cat ) = 2 After array.remove( cat ) = Array( ape, BAT, bat ) After array.remove( begin() ) = Array( BAT, bat ) Output from Array3.class ---------------------- array = Array( bat, cat, dog ) After insert at begin = Array( ape, bat, cat, dog ) After insert at end = Array( ape, bat, cat, dog, emu ) After array.insert( 3, 2, fox ) = Array( ape, bat, cat, fox, fox, dog, emu ) Output from Array4.class ---------------------- array = Array( bat, CAT, dog ), capacity = 3 array = bat CAT dog array = Array( bat, CAT, DOG ), capacity = 100 array = bat CAT dog Output from Array5.class ---------------------- Caught jgl.InvalidOperationException: Array is empty Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5 when valid range is 0..2 Output from Comparing1.class ---------------------- median of cat, ape and dog = cat array1 = Array( ape, bat, emu ) array2 = Array( ape, bat, dog, cat ) array1 mismatch @ emu array2 mismatch @ dog array2 equals deque1? true (array1 < deque1) = false Output from Container1.class ---------------------- array = Array( triangle, square, pentagon, hexagon ) array.size() = 4 array.empty() = false after array is cleared... array.size() = 0 array.empty() = true Output from Container10.class ---------------------- unsorted native int array = int[]( 3, -1, 2, 0, -6 ) sorted = -6 -1 0 2 3 Output from Container2.class ---------------------- triangle square pentagon hexagon Output from Container3.class ---------------------- array1 = Array( triangle, square, pentagon ) array2 = Array( triangle, square, pentagon ) array1.equals( array2 ) = true before copy, array3 = Array( heptagon, octagon ) after copy, array3 = Array( triangle, square, pentagon ) array4 = Array( triangle, square, pentagon ) Output from Container4.class ---------------------- array1 = Array( ape, bat, cat ), array2 = Array( red, blue ) array1 = Array( red, blue ), array2 = Array( ape, bat, cat ) Output from Container5.class ---------------------- Array = Array( 2, false, x, 3.14 ) Output from Container6.class ---------------------- The headquarters of Company( ObjectSpace ) are in Texas Output from Container7.class ---------------------- Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5 when valid range is 0..1 Output from Container8.class ---------------------- Caught jgl.InvalidOperationException: Array is empty Output from Container9.class ---------------------- Caught java.lang.IllegalArgumentException: Attempt to create an Array with a negative size Output from Copying1.class ---------------------- array = Array( 3, 6, 4, 1 ), deque = Deque( 6, 4 ) Copy array to System.out. 3 6 4 1 array = Array( 3, 6, 6, 4 ) Output from DList1.class ---------------------- DList( ape, bat, cat ) Enumerate the DList ape bat cat Iterate through the DList ape bat cat Demonstrate access dlist.at( 0 ) = ape dlist.front() = ape dlist.at( 2 ) = cat dlist.back() = cat Demonstrate modification DList( ape, fox, cat ) popFront() returns: ape After popFront() = DList( fox, cat ) popBack() returns: cat After popBack() = DList( fox ) Output from DList2.class ---------------------- DList( ape, bat, cat, bat, bat, cat ) dlist.count( bat ) = 3 object at dlist.find( bat ) = bat After dlist.remove( iterator ) = DList( ape, cat, bat, bat, cat ) After dlist.replace( start, finish, bat, BAT ) = DList( ape, cat, BAT, bat, cat ) dlist.remove( cat ) = 2 After dlist.remove( cat ) = DList( ape, BAT, bat ) After dlist.remove( begin() ) = DList( BAT, bat ) Output from DList3.class ---------------------- dlist = DList( bat, cat, dog ) After insert at begin = DList( ape, bat, cat, dog ) After insert at end = DList( ape, bat, cat, dog, emu ) After dlist.insert( i, 2, fox ) = DList( ape, bat, cat, fox, fox, dog, emu ) Output from DList4.class ---------------------- Caught jgl.InvalidOperationException: DList is empty Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5 when valid range is 0..2 Output from DList5.class ---------------------- before: dlist1 = DList( apple, banana ), dlist2 = DList( lotus, ferrari, lamborghini ) after: dlist1 = DList( lotus, ferrari, lamborghini, apple, banana ), dlist2 = DList() Output from DList6.class ---------------------- before: dlist1 = DList( apple, banana ), dlist2 = DList( lotus, ferrari, lamborghini ) after: dlist1 = DList( apple, lotus, ferrari, banana ), dlist2 = DList( lamborghini ) Output from DList7.class ---------------------- dlist = DList( x, l, x, g, s, s ) After dlist.reverse() = DList( s, s, g, x, l, x ) After dlist.remove( x ) = DList( s, s, g, l ) After dlist.unique() = DList( s, g, l ) Output from DList8.class ---------------------- dlist = DList( apple, banana, lotus, ferrari, lamborghini ) Output from Deque1.class ---------------------- Deque( ape, bat, cat ) Enumerate the Deque ape bat cat Iterate through the Deque ape bat cat Demonstrate access deque.at( 0 ) = ape deque.front() = ape deque.at( 2 ) = cat deque.back() = cat Demonstrate modification Deque( ape, fox, cat ) After popFront() = Deque( fox, cat ) After popBack() = Deque( fox ) Output from Deque2.class ---------------------- Deque( ape, bat, cat, bat, bat, cat ) deque.count( bat ) = 3 deque.indexOf( bat ) = 1 After deque.remove( 1 ) = Deque( ape, cat, bat, bat, cat ) After deque.replace( 0, 2, bat, BAT ) = Deque( ape, cat, BAT, bat, cat ) deque.remove( cat ) = 2 After deque.remove( cat ) = Deque( ape, BAT, bat ) After deque.remove( begin() ) = Deque( BAT, bat ) Output from Deque3.class ---------------------- deque = Deque( bat, cat, dog ) After insert at begin = Deque( ape, bat, cat, dog ) After insert at end = Deque( ape, bat, cat, dog, emu ) After deque.insert( 3, 2, fox ) = Deque( ape, bat, cat, fox, fox, dog, emu ) Output from Deque4.class ---------------------- Caught jgl.InvalidOperationException: Deque is empty Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5 when valid range is 0..2 Output from Filling1.class ---------------------- Fill a native array of integers with 42 ( 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 ) array = Array( cat, dog, emu, fox ) Fill the array with gnu array = Array( gnu, gnu, gnu, gnu ) Fill the first 3 elements with bat. array = Array( bat, bat, bat, gnu ) Output from Filtering1.class ---------------------- strings = ( gnu, emu, emu, fox, fox, fox, gnu ) filtered strings = ( gnu, emu, fox, gnu, fox, fox, gnu ) remaining = 4 filtered array with bounds given = ( gnu, emu, fox ) array = Array( gnu, emu, emu, fox, fox, fox, gnu ) deque = Deque( gnu, emu, fox, gnu ) Output from Filtering2.class ---------------------- array = Array( cat, monkey, lion, armadillo, zebra ) Collecting strings > 5 chars == Array( monkey, armadillo ) Rejecting strings > 5 chars == Array( cat, lion, zebra ) Output from Finding1.class ---------------------- iterator found dog at index 1 iterator found dog at index 3 iterator found dog at index 4 First element > 7 is 8 at index 4 First consecutive sequence is of emu at index 2 Output from Finding2.class ---------------------- array = Array( cat, monkey, lion, armadillo, zebra ) Array has SOME string > 5 chars == true Array has EVERY string > 5 chars == false 1st Object in array > 5 chars == monkey Output from Functions1.class ---------------------- Number of positive Integers in Array( 3, -2, 3, -5, -4 ) = 2 Output from Functions2.class ---------------------- Number of false in boolean[]( false, false, true, false, true ) = 3 Output from Functions3.class ---------------------- unsorted = Deque( cat, ape, dog, bat ) sorted = Deque( dog, cat, bat, ape ) Output from Functions4.class ---------------------- unsorted = int[]( 3, 1, 5, -2, 7, 9 ) sorted = int[]( -2, 1, 3, 5, 7, 9 ) Output from Functions5.class ---------------------- before = Deque( 4, -2, 3 ) after = Deque( -4, 2, -3 ) Output from Functions6.class ---------------------- The number of strings in DList( dog, ape, emu ) > bat = 2 Output from Functions7.class ---------------------- before = Array( ape, giraffe, lizard ) after = Array( giraffe, lizard, ape ) Output from HashMap1.class ---------------------- HashMap( Pair( 2, two ), Pair( 4, four ) ) Enumerate the HashMap two four Iterate through the HashMap Pair( 2, two ), key = 2, value = two Pair( 4, four ), key = 4, value = four Demonstrate access map.get( 2 ) = two map.get( 5 ) = null map = HashMap( Pair( 2, two ), Pair( 4, four ) ) Show that duplicates cannot be added. Added 8. map = HashMap( Pair( 2, two ), Pair( 4, four ), Pair( 8, eight ) ) Could not add 4. map = HashMap( Pair( 2, two ), Pair( 4, four ), Pair( 8, eight ) ) Demonstrate modification map = HashMap( Pair( 2, two ), Pair( 4, FOUR ), Pair( 8, eight ) ) Output from HashMap2.class ---------------------- map = HashMap( Pair( ape, Squeak ), Pair( dog, Woof ), Pair( bat, Squeak ), Pair( cat, Meow ) ) Enumerate the HashMap: Squeak Woof Squeak Meow map.keys() = ape dog bat cat map.keys( Squeak ) = ape bat map.values( bat ) = Squeak Output from HashMap3.class ---------------------- HashMap( Pair( ape, Squeak ), Pair( dog, Woof ), Pair( bat, Squeak ), Pair( cat, Meow ) ) map.count( dog ) = 1 Found Pair( dog, Woof ) map.remove( dog ) = Woof Could not find dog. Output from HashMap4.class ---------------------- HashMap( Pair( 2, two ), Pair( 4, four ) ) Enumerate the HashMap two four Iterate through the HashMap Pair( 2, two ), key = 2, value = two Pair( 4, four ), key = 4, value = four Show that duplicates can be added. map = HashMap( Pair( 2, two ), Pair( 4, four ), Pair( 8, eight ) ) map = HashMap( Pair( 2, two ), Pair( 4, four ), Pair( 4, FOUR ), Pair( 8, eight ) ) Show that even with duplicates, put() does a replacement. map = HashMap( Pair( 2, two ), Pair( 4, FoUr ), Pair( 4, FOUR ), Pair( 8, eight ) ) Output from HashMap5.class ---------------------- map = HashMap( Pair( ape, Squeak ), Pair( ape, Whoop ), Pair( bat, Squeak ), Pair( cat, Meow ) ) Enumerate the HashMap Squeak Whoop Squeak Meow map.keys() = ape ape bat cat map.keys( Squeak ) = ape bat map.keys( ape ) = Squeak Whoop Output from HashMap6.class ---------------------- HashMap( Pair( ape, Squeak ), Pair( ape, Whoop ), Pair( bat, Squeak ), Pair( cat, Meow ) ) map.count( ape ) = 2 Found Pair( ape, Squeak ) Found Pair( ape, Whoop ) map.remove( ape ) = Squeak Could not find ape. Output from HashMap7.class ---------------------- HashMap( Pair( 2, two ), Pair( 3, three ), Pair( 3, THREE ), Pair( 8, eight ) ) match @ Pair( 3, three ) match @ Pair( 3, THREE ) Output from HashSet1.class ---------------------- HashSet( 1, 4, 6 ) Enumerate the HashSet 1 4 6 Iterate through the HashSet 1 4 6 Show that duplicates cannot be added. Added 8 New contents are HashSet( 1, 4, 6, 8 ) Could not add 4. Output from HashSet2.class ---------------------- set1 = HashSet( ape, bat, cat ), set2 = HashSet( ape, bat, fox ) set3 = set1.union( set2 ) = HashSet( ape, bat, fox, cat ) set4 = set1.intersection( set2 ) = HashSet( ape, bat ) set5 = set1.difference( set2 ) = HashSet( cat ) set6 = set1.symmetricDifference( set2 ) = HashSet( fox, cat ) set4.subsetOf( set3 ) = true set3.subsetOf( set4 ) = false Output from HashSet3.class ---------------------- HashSet( ape, dog, bat, cat ) set.count( dog ) = 1 Found dog set.remove( dog ) = dog Could not find dog. Output from HashSet4.class ---------------------- HashSet( 1, 1, 4, 6 ) Enumerate the HashSet 1 1 4 6 Iterate through the HashSet 1 1 4 6 Show that duplicates can be added. set = HashSet( 1, 1, 4, 6, 8 ) set = HashSet( 1, 1, 4, 4, 6, 8 ) Output from HashSet5.class ---------------------- HashSet( ape, dog, dog, bat, cat ) set.count( dog ) = 2 Found dog set.remove( dog ) = dog Could not find dog. Output from HashSet6.class ---------------------- HashSet( 2, 3, 3, 8, 10, -2 ) match @ 3 match @ 3 Output from HashSet7.class ---------------------- HashSet( 1, 1, 4, 6 ) Add an object Integer(100) add returns: null set = HashSet( 1, 1, 4, 6, 100 ) Try to add the EXACT same object Integer(100) add returns: 100 set = HashSet( 1, 1, 4, 6, 100 ) Output from Heap1.class ---------------------- fox emu dog cat bat ape unsorted vector = Array( bat, ape, fox, cat, dog, emu ) sorted vector = Array( ape, bat, cat, dog, emu, fox ) Output from Iterators1.class ---------------------- magical mystery tour Output from Iterators2.class ---------------------- before array = Array( magical, mystery, tour ) after array = Array( MAGICAL, MYSTERY, TOUR ) before list = DList( magical, mystery, tour ) after list = DList( MAGICAL, MYSTERY, TOUR ) Output from Iterators3.class ---------------------- array = Array( ape, giraffe, lizard ) lizard giraffe ape Output from Iterators4.class ---------------------- array = Array( 4, 7, 2, 7, 1, 7 ) array = Array( 2, 4, 7, 7, 1, 7 ) array = Array( 2, 4, 7, 0, 1, 0 ) Output from Iterators5.class ---------------------- list = DList( ape, bat, cat, dog ) iterator positioned @ cat list = DList( ape, bat, dog ) Output from Iterators6.class ---------------------- map = HashMap( Pair( dog, barky ), Pair( fox, paula ), Pair( cat, beauty ), Pair( cat, agatha ) ) pair = Pair( cat, beauty ), key = cat, value = beauty pair = Pair( cat, agatha ), key = cat, value = agatha Output from Iterators7.class ---------------------- array = Array( ape, bat, cat, dog ) dog cat bat ape Output from Iterators8.class ---------------------- array = Array( ape, giraffe, elephant ) deque = Deque( 3, 7, 8 ) Output from Iterators9.class ---------------------- ape bat cat ape bat cat Output from Maps1.class ---------------------- value from add = null value from add = null map = HashMap( Pair( Cat, Beauty ), Pair( Dog, Barky ) ) value from add = Beauty map = HashMap( Pair( Cat, Beauty ), Pair( Dog, Barky ) ) Cat name is Beauty Ape name is null value from put = Beauty map = HashMap( Pair( Cat, Agatha ), Pair( Dog, Barky ) ) Cat name is Agatha Output from Maps2.class ---------------------- value from add = null value from add = null map = HashMap( Pair( Cat, Beauty ), Pair( Dog, Barky ) ) value from add = null map = HashMap( Pair( Cat, Beauty ), Pair( Cat, Agatha ), Pair( Dog, Barky ) ) Cat name is Beauty Ape name is null value from put = Beauty map = HashMap( Pair( Cat, Agatha ), Pair( Cat, Agatha ), Pair( Dog, Barky ) ) Cat name is Agatha Output from Maps3.class ---------------------- map = HashMap( Pair( Cat, Beauty ), Pair( Cat, Agatha ), Pair( Dog, Barky ) ) Enumerator through values... Beauty Agatha Barky Enumerate through keys... Cat Cat Dog Output from Maps4.class ---------------------- map1 = OrderedMap( Pair( 1, one ), Pair( 2, two ), Pair( 3, three ) ) map2 = OrderedMap( Pair( 3, three ), Pair( 2, two ), Pair( 1, one ) ) Output from Maps5.class ---------------------- map = OrderedMap( Pair( 5, V ), Pair( 5, five ), Pair( 10, X ), Pair( 10, ten ) ) There are 2 key-value pairs with key 10 Removing all occurrences of 10... There are now 0 key-value pairs with key 10 map = OrderedMap( Pair( 5, V ), Pair( 5, five ) ) Output from Maps6.class ---------------------- Using equals() to compare elements... map1.add( i1, two ) = null map1.add( i1, two ) = two map1.add( i2, TWO ) = two map1.get( i1 ) = two map1.get( i2 ) = two Using == to compare elements... map2.add( i1, two ) = null map2.add( i1, two ) = two map2.add( i2, TWO ) = null map2.get( i1 ) = two map2.get( i2 ) = TWO Output from Maps7.class ---------------------- map = HashMap( Pair( CAT, Agatha ), Pair( DOG, Misty ) ) Output from MinMax1.class ---------------------- array = Array( cat, ape, bat ) min = ape at index 1 intArray = ( 3, 2, 7, 8, 1, 6 ) max = 8 at index 3 Output from OrderedMap1.class ---------------------- OrderedMap( Pair( 2, two ), Pair( 4, four ) ) Enumerate the OrderedMap two four Iterate through the OrderedMap Pair( 2, two ), key = 2, value = two Pair( 4, four ), key = 4, value = four Demonstrate access map.at( 2 ) = two map.at( 5 ) = null map = OrderedMap( Pair( 2, two ), Pair( 4, four ) ) Show that duplicates cannot be added. Added 8. map = OrderedMap( Pair( 2, two ), Pair( 4, four ), Pair( 8, eight ) ) Could not add 4. map = OrderedMap( Pair( 2, two ), Pair( 4, four ), Pair( 8, eight ) ) Demonstrate modification map = OrderedMap( Pair( 2, two ), Pair( 4, FOUR ), Pair( 8, eight ) ) Output from OrderedMap2.class ---------------------- OrderedMap( Pair( ape, Squeak ), Pair( bat, Squeak ), Pair( cat, Meow ), Pair( dog, Woof ) ) Enumerate the OrderedMap Squeak Squeak Meow Woof map.keys() = ape bat cat dog map.keys( Squeak ) = ape bat map.values( bat ) = Squeak Output from OrderedMap3.class ---------------------- OrderedMap( Pair( ape, Squeak ), Pair( bat, Squeak ), Pair( cat, Meow ), Pair( dog, Woof ) ) map.count( dog ) = 1 Found Pair( dog, Woof ) map.remove( dog ) = Woof Could not find dog. Output from OrderedMap4.class ---------------------- OrderedMap( Pair( 2, two ), Pair( 3, three ), Pair( 8, eight ), Pair( 10, ten ) ) First pair whose key is not before 3 = Pair( 3, three ) First pair whose key is after 3 = Pair( 8, eight ) Output from OrderedMap5.class ---------------------- OrderedMap( Pair( 2, two ), Pair( 4, four ) ) Enumerate the OrderedMap two four Iterate through the OrderedMap Pair( 2, two ), key = 2, value = two Pair( 4, four ), key = 4, value = four Show that duplicates can be added. map = OrderedMap( Pair( 2, two ), Pair( 4, four ), Pair( 8, eight ) ) map = OrderedMap( Pair( 2, two ), Pair( 4, four ), Pair( 4, FOUR ), Pair( 8, eight ) ) Output from OrderedMap6.class ---------------------- map = OrderedMap( Pair( ape, Squeak ), Pair( ape, Whoop ), Pair( bat, Squeak ), Pair( cat, Meow ) ) Enumerate the OrderedMap Squeak Whoop Squeak Meow map.keys() = ape ape bat cat map.keys( Squeak ) = ape bat map.values( ape ) = Squeak Whoop Output from OrderedMap7.class ---------------------- OrderedMap( Pair( ape, Squeak ), Pair( ape, Whoop ), Pair( bat, Squeak ), Pair( cat, Meow ) ) map.count( ape ) = 2 Found Pair( ape, Squeak ) Found Pair( ape, Whoop ) map.remove( ape ) = Squeak Could not find ape. Output from OrderedMap8.class ---------------------- OrderedMap( Pair( 2, two ), Pair( 3, three ), Pair( 8, eight ), Pair( 10, ten ) ) First pair whose key is not before 3 = Pair( 3, three ) First pair whose key is after 3 = Pair( 8, eight ) first of equalRange = Pair( 3, three ) second of equalRange = Pair( 8, eight ) Iterating values in the range... Pair( 3, three ) Output from OrderedSet1.class ---------------------- OrderedSet( 1, 4, 6 ) Enumerate the OrderedSet 1 4 6 Iterate through the OrderedSet 1 4 6 Show that duplicates cannot be added. Added 8. New contents are OrderedSet( 1, 4, 6, 8 ) Could not add 4. Output from OrderedSet2.class ---------------------- OrderedSet( ape, bat, cat, dog ) Output from OrderedSet3.class ---------------------- set1 = OrderedSet( ape, bat, cat ), set2 = OrderedSet( ape, bat, fox ) set3 = set1.union( set2 ) = OrderedSet( ape, bat, cat, fox ) set4 = set1.intersection( set2 ) = OrderedSet( ape, bat ) set5 = set1.difference( set2 ) = OrderedSet( cat ) set6 = set1.symmetricDifference( set2 ) = OrderedSet( cat, fox ) set4.subsetOf( set3 ) = true set3.subsetOf( set4 ) = false Output from OrderedSet4.class ---------------------- OrderedSet( ape, bat, cat, dog ) set.count( dog ) = 1 Found dog set.remove( dog ) = dog Could not find dog. Output from OrderedSet5.class ---------------------- OrderedSet( -2, 2, 3, 8, 10 ) First element that is not before 3 = 3 First element that is after 3 = 8 Output from OrderedSet6.class ---------------------- OrderedSet( 1, 1, 4, 6 ) Enumerate the OrderedSet 1 1 4 6 Iterate through the OrderedSet 1 1 4 6 Show that duplicates can be added. set = OrderedSet( 1, 1, 4, 6, 8 ) set = OrderedSet( 1, 1, 4, 4, 6, 8 ) Output from OrderedSet7.class ---------------------- OrderedSet( ape, bat, bat, bat, cat, cat, dog ) Output from OrderedSet8.class ---------------------- OrderedSet( ape, bat, cat, dog, dog ) set.count( dog ) = 2 Found dog set.remove( dog ) = dog Could not find dog. Output from OrderedSet9.class ---------------------- OrderedSet( -2, 2, 3, 3, 8, 10 ) First element that is not before 3 = 3 First element that is after 3 = 8 equalRange.first = 3 equalRange.second = 8 Iterating values in the range... 3 3 Output from OrderedSetOperations1.class ---------------------- set1 = OrderedSet( ape, bat, dog ), set2 = OrderedSet( ape, dog, fox ) union = OrderedSet( ape, bat, dog, fox ) union = OrderedSet( ape, bat, dog, fox ) intersection = OrderedSet( ape, dog ) intersection = OrderedSet( ape, dog ) difference = Array( bat ) symmetric difference = Array( bat, fox ) includes1 = false includes2 = true Output from Overview1.class ---------------------- chemicals = HashMap( Pair( Au, Gold ), Pair( He, Helium ), Pair( Ca, Calcium ) ) Au means Gold Output from Overview10.class ---------------------- show good jolly Output from Overview2.class ---------------------- set1 = HashSet( blue, green, red ) set2 = HashSet( blue, yellow ) union of set1 and set2 = HashSet( blue, green, red, yellow ) intersection of set1 and set2 = HashSet( blue ) Output from Overview3.class ---------------------- nemesis dig myst agatha beauty truth Output from Overview4.class ---------------------- Unsorted Array = Array( 3, -1, 2 ) Sorted = Array( -1, 2, 3 ) Output from Overview5.class ---------------------- Unsorted java.util.Vector = [3, -1, 2] Sorted = [-1, 2, 3] Output from Overview6.class ---------------------- Unsorted native int array = int[]( 3, -1, 2 ) Sorted native array = -1 2 3 Output from Overview7.class ---------------------- Original deque = Deque( your, mission, jim ) Shuffled deque = Deque( your, mission, jim ) Output from Overview8.class ---------------------- Unsorted Array = Array( 3, -1, 2 ) Sorted = Array( 3, 2, -1 ) Output from Overview9.class ---------------------- # of positive numbers in Array( 3, -1, 2 ) = 2 Array without positive numbers = Array( -1 ) Output from Permuting1.class ---------------------- array = Array( 0, 2, 5 ) array = Array( 0, 5, 2 ) array = Array( 2, 0, 5 ) array = Array( 2, 5, 0 ) array = Array( 5, 0, 2 ) array = Array( 5, 2, 0 ) Object[]( gnu, emu, dog ) Object[]( gnu, dog, emu ) Object[]( emu, gnu, dog ) Object[]( emu, dog, gnu ) Object[]( dog, gnu, emu ) Object[]( dog, emu, gnu ) Output from Printing1.class ---------------------- strings = ( gnu, emu, dog ) strings = ( gnu, emu, dog ) ints = ( 3, 4, 7 ) ints = ( 3, 4, 7 ) Output from PriorityQueue1.class ---------------------- Print the PriorityQueue. PriorityQueue( Array( 20, 10, 5, -2, 6, -10 ) ) Non-destructively enumerate the PriorityQueue. 20 10 5 -2 6 -10 Pop and print each element. 20 10 6 5 -2 -10 Output from Queue1.class ---------------------- Print the Queue. Queue( SList( bat, cat, dog ) ) Non-destructively enumerate the Queue. bat cat dog Pop and print each element. bat cat dog Output from Queue2.class ---------------------- Print the queue. Queue( DList( bat, cat, dog ) ) Output from Removing1.class ---------------------- Before = Array( ape, cat, dog, cat, emu ) After = Array( ape, dog, emu, cat, emu ) deque = Deque( 3, 8, 4, 10 ), result = DList( 8, 10 ) Output from Replacing1.class ---------------------- Before: ( 3, 6, 2, 1, 9, 6, 4, 2 ) After: ( 3, 0, 2, 1, 9, 0, 4, 2 ) array = Array( ape, cat, bat, cat ), deque = Deque( ape, emu, bat, emu ) Output from Reversing1.class ---------------------- array = Array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ) after reverse = Array( 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ) primitive array = int[]( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ) Array of reversed array = Array( 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ) Output from Rotating1.class ---------------------- Rotate around index 0, Array( 0, 1, 2, 3, 4 ) -> Array( 0, 1, 2, 3, 4 ) Rotate around index 1, Array( 0, 1, 2, 3, 4 ) -> Array( 1, 2, 3, 4, 0 ) Rotate around index 2, Array( 0, 1, 2, 3, 4 ) -> Array( 2, 3, 4, 0, 1 ) Rotate around index 3, Array( 0, 1, 2, 3, 4 ) -> Array( 3, 4, 0, 1, 2 ) Rotate around index 4, Array( 0, 1, 2, 3, 4 ) -> Array( 4, 0, 1, 2, 3 ) Rotate around index 2, Array( 0, 1, 2, 3, 4 ) -> Deque( 1, 2, 3, 4, 0 ) Output from SList1.class ---------------------- SList( ape, bat, cat ) Enumerate the SList ape bat cat Iterate through the SList ape bat cat Demonstrate access list.at( 0 ) = ape list.front() = ape list.at( 2 ) = cat list.back() = cat Demonstrate modification SList( ape, fox, cat ) popFront() returns: ape After popFront() = SList( fox, cat ) popBack() returns: cat After popBack() = SList( fox ) Output from SList2.class ---------------------- SList( ape, bat, cat, bat, bat, cat ) list.count( bat ) = 3 object at list.find( bat ) = bat After list.remove( iterator ) = SList( ape, cat, bat, bat, cat ) After list.replace( start, finish, bat, BAT ) = SList( ape, cat, BAT, bat, cat ) list.remove( cat ) = 2 After list.remove( cat ) = SList( ape, BAT, bat ) After list.remove( begin() ) = SList( BAT, bat ) Output from SList3.class ---------------------- list = SList( bat, cat, dog ) After insert at begin = SList( ape, bat, cat, dog ) After insert at end = SList( ape, bat, cat, dog, emu ) After list.insert( i, 2, fox ) = SList( ape, bat, cat, fox, fox, dog, emu ) Output from SList4.class ---------------------- Caught jgl.InvalidOperationException: SList is empty Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5 when valid range is 0..2 Output from SList5.class ---------------------- before: list1 = SList( apple, banana ), list2 = SList( lotus, ferrari, lamborghini ) after: list1 = SList( lotus, ferrari, lamborghini, apple, banana ), list2 = SList() Output from SList6.class ---------------------- before: list1 = SList( apple, banana ), list2 = SList( lotus, ferrari, lamborghini ) after: list1 = SList( apple, lotus, ferrari, banana ), list2 = SList( lamborghini ) Output from SList7.class ---------------------- list = SList( x, l, x, g, s, s ) After list.remove( x ) = SList( l, g, s, s ) Output from Sequences1.class ---------------------- array = Array( ape, bat, cat ) Demonstrate access array.at( 0 ) = ape array.front() = ape array.at( 2 ) = cat array.back() = cat array.put( 1, "fox" ) array = Array( ape, fox, cat ) After popFront() = Array( fox, cat ) After popBack() = Array( fox ) Output from Sequences2.class ---------------------- deque = Deque( ape, bat, cat, bat, bat, cat ) deque.count( bat ) = 3 deque.indexOf( bat ) = 1 After deque.remove( 1 ) = Deque( ape, cat, bat, bat, cat ) After deque.replace( 0, 2, bat, BAT ) = Deque( ape, cat, BAT, bat, cat ) deque.remove( cat ) = 2 After deque.remove( cat ) = Deque( ape, BAT, bat ) Output from Sequences3.class ---------------------- list = DList( bat, cat, dog ) After insert at begin = DList( ape, bat, cat, dog ) After insert at end = DList( ape, bat, cat, dog, emu ) After list.insert( 3, 2, fox ) = DList( ape, bat, cat, fox, fox, dog, emu ) Output from Sequences4.class ---------------------- array = Array(), size = 0, capacity = 10 array = Array( x, x, x, x, x, x, x, x, x ), size = 9, capacity = 10 array = Array( x, x, x, x, x, x, x, x, x, x ), size = 10, capacity = 10 array = Array( x, x, x, x, x, x, x, x, x, x, x ), size = 11, capacity = 20 array = Array( x, x, x, x, x, x, x, x, x, x, x ), size = 11, capacity = 1000 array = Array( x, x, x, x, x, x, x, x, x, x, x ), size = 11, capacity = 11 Output from Sequences5.class ---------------------- array = Array( ape, bat, cat ), size = 3, capacity = 3 array = Array( ape, bat, CAT ) Original = ape bat CAT array = Array( ape, bat, CAT, dog ), size = 4, capacity = 6 Original = ape bat CAT ape bat CAT dog Output from Sequences6.class ---------------------- slist1 = SList( D, B ), slist2 = SList( E, A, C ) slist1 = SList( E, A, C, D, B ), slist2 = SList() slist1 = SList( A, C, D, B, E ), slist2 = SList() slist1 = SList( A, B, C, D, E ), slist2 = SList() Output from Sequences7.class ---------------------- list = DList( D, C, C, B, A, A ) list = DList( D, C, B, A ) list = DList( A, B, C, D ) Output from SetOperations1.class ---------------------- set1 = OrderedSet( ape, bat, dog ), set2 = OrderedSet( ape, dog, fox ) union = OrderedSet( ape, bat, dog, fox ) union = OrderedSet( ape, bat, dog, fox ) intersection = OrderedSet( ape, dog ) intersection = OrderedSet( ape, dog ) difference = Array( bat ) symmetric difference = Array( bat, fox ) includes1 = false includes2 = true Output from Sets1.class ---------------------- value from add = null value from add = null set = HashSet( Widget( button, 100 ), Widget( menu, 200 ) ) value from add = Widget( button, 100 ) set = HashSet( Widget( button, 100 ), Widget( menu, 200 ) ) value from put = Widget( button, 100 ) set = HashSet( Widget( button, 300 ), Widget( menu, 200 ) ) Output from Sets2.class ---------------------- value from add = null value from add = null set = HashSet( Widget( button, 100 ), Widget( menu, 200 ) ) value from add = null set = HashSet( Widget( button, 100 ), Widget( button, 300 ), Widget( menu, 200 ) ) value from put = Widget( button, 100 ) set = HashSet( Widget( button, 300 ), Widget( button, 300 ), Widget( menu, 200 ) ) Output from Sets3.class ---------------------- set1 = OrderedSet( 1, 2, 3 ) set2 = OrderedSet( 3, 2, 1 ) Output from Sets4.class ---------------------- set = OrderedSet( 5, 5, 10, 10 ) There are 2 objects that match 10 Removing all occurrences of 10... There are now 0 objects that match 10 set = OrderedSet( 5, 5 ) Output from Sets5.class ---------------------- Using equals() to compare elements... set1.add( i1 ) = null set1.add( i1 ) = 2 set1.add( i2 ) = 2 set1.get( i1 ) = 2 set1.get( i2 ) = 2 Using == to compare elements... set2.add( i1 ) = null set2.add( i1 ) = 2 set2.add( i2 ) = null set2.get( i1 ) = 2 set2.get( i2 ) = 2 Output from Sets6.class ---------------------- set1 = HashSet( ape, bat, cat ), set2 = HashSet( ape, bat, fox ) set3 = set1.union( set2 ) = HashSet( ape, bat, fox, cat ) set4 = set1.intersection( set2 ) = HashSet( ape, bat ) set5 = set1.difference( set2 ) = HashSet( cat ) set6 = set1.symmetricDifference( set2 ) = HashSet( fox, cat ) set4.subsetOf( set3 ) = true set3.subsetOf( set4 ) = false Output from Shuffling1.class ---------------------- array = Array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ) after shuffle = Array( 9, 2, 6, 5, 3, 7, 1, 0, 8, 4 ) Output from Sorting1.class ---------------------- Sort an Array of Integers unsorted = Array( 7, 10, 3, -4 ) ascending = Array( -4, 3, 7, 10 ) descending = Array( 10, 7, 3, -4 ) Sort a java.util.Vector of Strings unsorted = [cat, ape, fox, bat] ascending = [ape, bat, cat, fox] Sort a primitive array of ints unsorted = int[]( 3, 6, 1, 2, 9, 8, 1, 8 ) descending = int[]( 9, 8, 8, 6, 3, 2, 1, 1 ) partially ascending = int[]( 9, 8, 8, 1, 1, 2, 3, 6 ) Output from Sorting2.class ---------------------- Sort a primitive array of chars unsorted = czefgoa sorted = acefgoz Output from Stack1.class ---------------------- Print the Stack. Stack( Array( bat, cat, dog ) ) Non-destructively enumerate the Stack. bat cat dog Pop and print each element. dog cat bat Output from Stack2.class ---------------------- Print the Stack. Stack( Array( bat, cat, dog ) ) Output from Stacks1.class ---------------------- stack = Stack( Array( bat, cat, dog ) ) Non-destructively enumerate the Stack. bat cat dog Pop and print each element. dog cat bat Output from Stacks2.class ---------------------- Print the Stack. Stack( DList( bat, cat, dog ) ) Output from Stacks3.class ---------------------- queue = Queue( SList( bat, cat, dog ) ) Non-destructively enumerate the Queue. bat cat dog Pop and print each element. bat cat dog Output from Stacks4.class ---------------------- queue = PriorityQueue( Array( 20, 10, 5, -2, 6, -10 ) ) Non-destructively enumerate the PriorityQueue. 20 10 5 -2 6 -10 Pop and print each element. 20 10 6 5 -2 -10 Output from Stacks5.class ---------------------- Pop and print each element. ape bat cat dog emu fox Output from Swapping1.class ---------------------- array = Array( cat, dog, emu ) After swapping first and last elements = Array( emu, dog, cat ) deque = Deque( pig, hog ), array = Array( emu, dog, cat ) deque = Deque( emu, dog ), array = Array( pig, hog, cat ) Output from Transforming1.class ---------------------- before = Deque( 5, 2, -2 ) doubled = Deque( 10, 4, -4 ) original = int[]( 3, 4, 1, 2 ) negated = Array( -3, -4, -1, -2 ) list1 = DList( ape, dog ), list2 = DList( 1, 2 ) result = Array( ape1, dog2 ) Output from Transforming2.class ---------------------- array = Array( cat, barking animal, walking ) dlist = DList( cat, barking animal, walking ) collect(array) = Array( 3, 14, 7 ) collect(dlist) = DList( 3, 14, 7 ) Output from Vector1.class ---------------------- unsorted = [cat, ape, bat] sorted = [ape, bat, cat]