home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
ExampleOutput.txt
< prev
next >
Wrap
Text File
|
1998-05-08
|
42KB
|
1,596 lines
Output from Adapters1.java
----------------------
Unsorted native int array = int[]( 3, -1, 2, -3, 4 )
Sorted = int[]( -3, -1, 2, 3, 4 )
Randomized = int[]( -1, 3, 4, 2, -3 )
-1 3 4 2 -3
Output from Adapters2.java
----------------------
Unsorted JDK Vector = [3, -1, 2, -3, 4]
Sorted = [-3, -1, 2, 3, 4]
Randomized = [4, 3, -1, -3, 2]
JDK vector = [4, 3, -1, -3, 2]
Output from Adapters3.java
----------------------
native = ( 3.0, -1.1, 2.0, -3.1, 4.0 )
Unsorted = float[]( 3.0, -1.1, 2.0, -3.1, 4.0 )
Sorted = float[]( -1.1, -3.1, 2.0, 3.0, 4.0 )
Randomized = float[]( -3.1, 3.0, 4.0, 2.0, -1.1 )
native = ( -3.1, 3.0, 4.0, 2.0, -1.1 )
Unsorted = FloatBuffer( -3.1, 3.0, 4.0, 2.0, -1.1 )
Sorted = FloatBuffer( -1.1, -3.1, 2.0, 3.0, 4.0 )
Randomized = FloatBuffer( 4.0, -1.1, -3.1, 3.0, 2.0 )
native = ( -3.1, 3.0, 4.0, 2.0, -1.1 )
Inserted = FloatBuffer( 4.0, -1.1, -3.1, 5.6, 3.0, 2.0 )
Removed = FloatBuffer( 4.0, 3.0, 2.0 )
native = ( 4.0, 3.0, 2.0 )
Output from Algorithms1.java
----------------------
PRINT cat
PRINT monkey
PRINT goat
list = SList( 3, 7, 4 ), total = 14
Output from Algorithms2.java
----------------------
vector before copying = [1, 4]
vector after copying = [1, 4, 2, 6, 3, 7]
Output from Algorithms3.java
----------------------
list = SList( -1, 1, -2, 1, -3 )
Occurences of 1 = 2
Occurences of a negative = 3
Output from Algorithms4.java
----------------------
array = int[]( 3, 7, 8, 2, -5, 8, 9, -2 )
first negative = -5
some items are negative = true
Output from Algorithms5.java
----------------------
array1 = Array( cat, monkey, goat, elephant )
strings with length > 4 = Array( monkey, elephant )
strings with length <= 4 = Array( cat, goat )
Output from Algorithms6.java
----------------------
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.java
----------------------
before reverse = Deque( Batman, Superman, Phantom, Spider-Man )
after reverse = Deque( Spider-Man, Phantom, Superman, Batman )
Output from Algorithms8.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
array = Array( 100, 2, 71 )
injecting TimesNumber(initial value==1) = 14200
injecting PlusNumber(initial value==0) = 173
injecting MinusNumber(initial value==0) = -173
injecting DividesNumber(initial value==100000) = 7
Output from Array1.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
Caught com.objectspace.jgl.InvalidOperationException: Array is empty
Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5; valid range is 0..2
Output from Array6.java
----------------------
Array( Texas, Alabama, Texas, Mississippi, Texas, Louisiana, Texas, Alabama, Texas )
removed 4
Array( Alabama, Mississippi, Louisiana, Alabama, Texas )
removed 2
Array( Mississippi, Louisiana, Texas )
removed 0
Array( Mississippi, Louisiana, Texas )
Output from Collate1.java
----------------------
default collating
texas
Texas
Texas Fight
case insensitive
Texas
texas
Texas Fight
Output from Collate2.java
----------------------
default collating
texas
Texas
Texas Fight
case insensitive
Texas
texas
Texas Fight
Output from Collate3.java
----------------------
old style
OrderedSet( Texas, Texas Fight, texas )
default collating
OrderedSet( texas, Texas, Texas Fight )
case insensitive
OrderedSet( Texas, texas, Texas Fight )
Output from Comparing1.java
----------------------
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.java
----------------------
array = Array( triangle, square, pentagon, hexagon )
array.size() = 4
array.empty() = false
after array is cleared...
array.size() = 0
array.empty() = true
Output from Container2.java
----------------------
triangle
square
pentagon
hexagon
Output from Container3.java
----------------------
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.java
----------------------
array1 = Array( ape, bat, cat ), array2 = Array( red, blue )
array1 = Array( red, blue ), array2 = Array( ape, bat, cat )
Output from Container5.java
----------------------
Array = Array( 2, false, x, 3.14 )
Output from Container6.java
----------------------
The headquarters of Company( ObjectSpace ) are in Texas
Output from Container7.java
----------------------
Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5; valid range is 0..1
Output from Container8.java
----------------------
Caught com.objectspace.jgl.InvalidOperationException: Array is empty
Output from Container9.java
----------------------
Caught java.lang.IllegalArgumentException: Attempt to create an Array with a negative size
Output from Container10.java
----------------------
unsorted native int array = int[]( 3, -1, 2, 0, -6 )
sorted = -6 -1 0 2 3
Output from Copying1.java
----------------------
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 Counting1.java
----------------------
Sum = 15
Output from Counting2.java
----------------------
Product = 120
Output from Counting3.java
----------------------
( 1, 2, 4, 8, 16 )
( 1, 1, 2, 4, 8 )
Output from Counting4.java
----------------------
Array( 0, 1, 4, 9, 16, 25, 36, 49, 64, 81 )
Array( 0, 1, 3, 5, 7, 9, 11, 13, 15, 17 )
Output from Counting5.java
----------------------
Array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 )
Array( 1, 2, 6, 12, 20, 30, 42, 56, 72, 90 )
Output from DList1.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
Caught com.objectspace.jgl.InvalidOperationException: DList is empty
Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5 when valid range is 0..2
Output from DList5.java
----------------------
before: dlist1 = DList( apple, banana ), dlist2 = DList( lotus, ferrari, lamborghini )
after: dlist1 = DList( lotus, ferrari, lamborghini, apple, banana ), dlist2 = DList()
Output from DList6.java
----------------------
before: dlist1 = DList( apple, banana ), dlist2 = DList( lotus, ferrari, lamborghini )
after: dlist1 = DList( apple, lotus, ferrari, banana ), dlist2 = DList( lamborghini )
Output from DList7.java
----------------------
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.java
----------------------
dlist = DList( apple, banana, lotus, ferrari, lamborghini )
Output from Deque1.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
Caught com.objectspace.jgl.InvalidOperationException: Deque is empty
Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5 when valid range is 0..2
Output from Filling1.java
----------------------
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.java
----------------------
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.java
----------------------
Original set: HashSet( dog, dog, armadillo, monkey, zebra, lion )
Collecting strings > 5 chars: HashSet( armadillo, monkey )
Rejecting strings > 5 chars: HashSet( dog, dog, zebra, lion )
Output from Finding1.java
----------------------
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: emu at index 2
Output from Finding2.java
----------------------
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.java
----------------------
Number of positive Integers in Array( 3, -2, 3, -5, -4 ) = 2
Output from Functions2.java
----------------------
Number of false in boolean[]( false, false, true, false, true ) = 3
Output from Functions3.java
----------------------
unsorted = Deque( cat, ape, dog, bat )
sorted = Deque( dog, cat, bat, ape )
Output from Functions4.java
----------------------
unsorted = long[]( 3, 1, 5, -2, 7, 9 )
sorted = long[]( -2, 1, 3, 5, 7, 9 )
Output from Functions5.java
----------------------
before = Deque( 4, -2, 3 )
after = Deque( -4, 2, -3 )
Output from Functions6.java
----------------------
The number of strings in DList( dog, ape, emu ) > bat = 2
Output from Functions7.java
----------------------
before = Array( ape, giraffe, lizard )
after = Array( giraffe, lizard, ape )
Output from Functions8.java
----------------------
unsorted = double[]( 3.0, 1.0, 5.0, -2.0, 7.0, 9.0 )
sorted = double[]( -2.0, 1.0, 3.0, 5.0, 7.0, 9.0 )
Output from HashMap1.java
----------------------
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.java
----------------------
map = HashMap( Pair( dog, Woof ), Pair( ape, Squeak ), Pair( bat, Squeak ), Pair( cat, Meow ) )
Enumerate the HashMap: Woof Squeak Squeak Meow
map.keys() = dog ape bat cat
map.keys( Squeak ) = ape bat
map.values( bat ) = Squeak
Output from HashMap3.java
----------------------
HashMap( Pair( dog, Woof ), Pair( ape, Squeak ), 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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
HashMap( Pair( 2, two ), Pair( 3, three ), Pair( 3, THREE ), Pair( 8, eight ) )
match @ Pair( 3, three )
match @ Pair( 3, THREE )
Output from HashSet1.java
----------------------
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.java
----------------------
set1 = HashSet( ape, bat, cat ), set2 = HashSet( ape, bat, fox )
set3 = set1.union( set2 ) = HashSet( ape, bat, cat, fox )
set4 = set1.intersection( set2 ) = HashSet( ape, bat )
set5 = set1.difference( set2 ) = HashSet( cat )
set6 = set1.symmetricDifference( set2 ) = HashSet( cat, fox )
set4.subsetOf( set3 ) = true
set3.subsetOf( set4 ) = false
Output from HashSet3.java
----------------------
HashSet( dog, ape, bat, cat )
set.count( dog ) = 1
Found dog
set.remove( dog ) = 1
Could not find dog.
Output from HashSet4.java
----------------------
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.java
----------------------
HashSet( dog, dog, ape, bat, cat )
set.count( dog ) = 2
Found dog
set.remove( dog ) = 2
Could not find dog.
Output from HashSet6.java
----------------------
HashSet( 2, 3, 3, 8, 10, -2 )
match @ 3
match @ 3
Output from HashSet7.java
----------------------
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.java
----------------------
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.java
----------------------
magical
mystery
tour
Output from Iterators2.java
----------------------
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.java
----------------------
array = Array( ape, giraffe, lizard )
lizard
giraffe
ape
Output from Iterators4.java
----------------------
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.java
----------------------
list = DList( ape, bat, cat, dog )
iterator positioned @ cat
list = DList( ape, bat, dog )
Output from Iterators6.java
----------------------
map = HashMap( Pair( dog, marble ), Pair( cat, beauty ), Pair( cat, agatha ), Pair( fox, paula ) )
pair = Pair( cat, beauty ), key = cat, value = beauty
pair = Pair( cat, agatha ), key = cat, value = agatha
Output from Iterators7.java
----------------------
array = Array( ape, bat, cat, dog )
dog
cat
bat
ape
Output from Iterators8.java
----------------------
array = Array( ape, giraffe, elephant )
deque = Deque( 3, 7, 8 )
Output from Iterators9.java
----------------------
ape bat cat
ape bat cat
Output from Maps1.java
----------------------
value from add = null
value from add = null
map = HashMap( Pair( Cat, Beauty ), Pair( Dog, Marble ) )
value from add = Beauty
map = HashMap( Pair( Cat, Beauty ), Pair( Dog, Marble ) )
Cat name is Beauty
Ape name is null
value from put = Beauty
map = HashMap( Pair( Cat, Agatha ), Pair( Dog, Marble ) )
Cat name is Agatha
Output from Maps2.java
----------------------
value from add = null
value from add = null
map = HashMap( Pair( Cat, Beauty ), Pair( Dog, Marble ) )
value from add = null
map = HashMap( Pair( Cat, Beauty ), Pair( Cat, Agatha ), Pair( Dog, Marble ) )
Cat name is Beauty
Ape name is null
value from put = Beauty
map = HashMap( Pair( Cat, Agatha ), Pair( Cat, Agatha ), Pair( Dog, Marble ) )
Cat name is Agatha
Output from Maps3.java
----------------------
map = HashMap( Pair( Cat, Beauty ), Pair( Cat, Agatha ), Pair( Dog, Marble ) )
Enumerator through values...
Beauty
Agatha
Marble
Enumerate through keys...
Cat
Cat
Dog
Output from Maps4.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
map = HashMap( Pair( CAT, Agatha ), Pair( DOG, Misty ) )
Output from MinMax1.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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 OrderedMap9.java
----------------------
-----wrong
Key=7 Value=Disciplina Praesidium Civitatis
Key=42 Value=Hook 'Em
Key=42 Value=Hook 'Em
Key=69 Value=University of Texas
Key=86 Value=Texas Fight
-----easy
Key=7 Value=Disciplina Praesidium Civitatis
Key=42 Value=Bevo
Key=42 Value=Hook 'Em
Key=69 Value=University of Texas
Key=86 Value=Texas Fight
-----hard
Key=7 Value=Disciplina Praesidium Civitatis
Key=42 Value=Bevo
Key=42 Value=Hook 'Em
Key=69 Value=University of Texas
Key=86 Value=Texas Fight
Output from OrderedSet1.java
----------------------
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.java
----------------------
OrderedSet( ape, bat, cat, dog )
Output from OrderedSet3.java
----------------------
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.java
----------------------
OrderedSet( ape, bat, cat, dog )
set.count( dog ) = 1
Found dog
set.remove( dog ) = 1
Could not find dog.
Output from OrderedSet5.java
----------------------
OrderedSet( -2, 2, 3, 8, 10 )
First element that is not before 3 = 3
First element that is after 3 = 8
Output from OrderedSet6.java
----------------------
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.java
----------------------
OrderedSet( ape, bat, bat, bat, cat, cat, dog )
Output from OrderedSet8.java
----------------------
OrderedSet( ape, bat, cat, dog, dog )
set.count( dog ) = 2
Found dog
set.remove( dog ) = 2
Could not find dog.
Output from OrderedSet9.java
----------------------
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.java
----------------------
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.java
----------------------
chemicals = HashMap( Pair( Ca, Calcium ), Pair( He, Helium ), Pair( Au, Gold ) )
Au means Gold
Output from Overview2.java
----------------------
set1 = HashSet( red, green, blue )
set2 = HashSet( yellow, blue )
union of set1 and set2 = HashSet( red, yellow, green, blue )
intersection of set1 and set2 = HashSet( blue )
Output from Overview3.java
----------------------
nemesis
dig
myst
agatha
beauty
truth
Output from Overview4.java
----------------------
Unsorted Array = Array( 3, -1, 2 )
Sorted = Array( -1, 2, 3 )
Output from Overview5.java
----------------------
Unsorted java.util.Vector = [3, -1, 2]
Sorted = [-1, 2, 3]
Output from Overview6.java
----------------------
Unsorted native int array = int[]( 3, -1, 2 )
Sorted native array = -1 2 3
Output from Overview7.java
----------------------
Original deque = Deque( your, mission, jim )
Shuffled deque = Deque( mission, your, jim )
Output from Overview8.java
----------------------
Unsorted Array = Array( 3, -1, 2 )
Sorted = Array( 3, 2, -1 )
Output from Overview9.java
----------------------
# of positive numbers in Array( 3, -1, 2 ) = 2
Array without positive numbers = Array( -1 )
Output from Overview10.java
----------------------
show
good
jolly
Output from Overview11.java
----------------------
voyager(tm) 2.0 beta 1, copyright objectspace 1997
address = 285.42.132.60:1889
container=Array( Texas Fight!, Bevo, Hook 'Em )
sorted container=Array( Bevo, Hook 'Em, Texas Fight! )
element=Bevo
element=Hook 'Em
element=Texas Fight!
Output from Permuting1.java
----------------------
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.java
----------------------
strings = ( gnu, emu, dog )
strings = ( gnu, emu, dog )
ints = ( 3, 4, 7 )
ints = ( 3, 4, 7 )
Output from PriorityQueue1.java
----------------------
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.java
----------------------
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.java
----------------------
Print the queue.
Queue( DList( bat, cat, dog ) )
Output from Removing1.java
----------------------
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 Removing2.java
----------------------
original=Deque( 7, 86, 21, 69 )
after algo=Deque( 86, 69, 21, 69 )
after remove=Deque( 86, 69 )
Output from Replacing1.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
Caught com.objectspace.jgl.InvalidOperationException: SList is empty
Caught java.lang.IndexOutOfBoundsException: Attempt to access index 5 when valid range is 0..2
Output from SList5.java
----------------------
before: list1 = SList( apple, banana ), list2 = SList( lotus, ferrari, lamborghini )
after: list1 = SList( lotus, ferrari, lamborghini, apple, banana ), list2 = SList()
Output from SList6.java
----------------------
before: list1 = SList( apple, banana ), list2 = SList( lotus, ferrari, lamborghini )
after: list1 = SList( apple, lotus, ferrari, banana ), list2 = SList( lamborghini )
Output from SList7.java
----------------------
list = SList( x, l, x, g, s, s )
After list.remove( x ) = SList( l, g, s, s )
Output from Sequences1.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
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.java
----------------------
list = DList( D, C, C, B, A, A )
list = DList( D, C, B, A )
list = DList( A, B, C, D )
Output from Serial1.java
----------------------
ORB means Object Request Broker
FAQ means Frequently Asked Questions
Output from Serial2.java
----------------------
Wolverine is also known as Logan
Don't know who the Hulk is
Output from Sets1.java
----------------------
value from add = null
value from add = null
set = HashSet( Widget( menu, 200 ), Widget( button, 100 ) )
value from add = Widget( button, 100 )
set = HashSet( Widget( menu, 200 ), Widget( button, 100 ) )
value from put = Widget( button, 100 )
set = HashSet( Widget( menu, 200 ), Widget( button, 300 ) )
Output from Sets2.java
----------------------
value from add = null
value from add = null
set = HashSet( Widget( menu, 200 ), Widget( button, 100 ) )
value from add = null
set = HashSet( Widget( menu, 200 ), Widget( button, 100 ), Widget( button, 300 ) )
value from put = Widget( button, 100 )
set = HashSet( Widget( menu, 200 ), Widget( button, 300 ), Widget( button, 300 ) )
Output from Sets3.java
----------------------
set1 = OrderedSet( 1, 2, 3 )
set2 = OrderedSet( 3, 2, 1 )
Output from Sets4.java
----------------------
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.java
----------------------
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.java
----------------------
set1 = HashSet( dog, ape, bat ), set2 = HashSet( ape, bat, fox )
set3 = set1.union( set2 ) = HashSet( dog, ape, bat, fox )
set4 = set1.intersection( set2 ) = HashSet( ape, bat )
set5 = set1.difference( set2 ) = HashSet( dog )
set6 = set1.symmetricDifference( set2 ) = HashSet( dog, fox )
set4.subsetOf( set3 ) = true
set3.subsetOf( set4 ) = false
Output from SetOperations1.java
----------------------
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 Shuffling1.java
----------------------
array = Array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 )
after shuffle = Array( 3, 9, 2, 5, 7, 1, 8, 4, 0, 6 )
Output from Sorting1.java
----------------------
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 = [dog, ape, fox, bat]
ascending = [ape, bat, dog, 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.java
----------------------
Sort a primitive array of chars
unsorted = czefgoa
sorted = acefgoz
Output from Sorting3.java
----------------------
normal: ( Texas, Austin, Bevo, Fight, longhorn )
less: ( Austin, Bevo, Fight, Texas, longhorn )
greater: ( longhorn, Texas, Fight, Bevo, Austin )
normal: ( Texas, Austin, Bevo, Fight, longhorn )
Output from Stack1.java
----------------------
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.java
----------------------
Print the Stack.
Stack( Array( bat, cat, dog ) )
Output from Stacks1.java
----------------------
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.java
----------------------
Print the Stack.
Stack( DList( bat, cat, dog ) )
Output from Stacks3.java
----------------------
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.java
----------------------
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.java
----------------------
Pop and print each element.
ape bat cat dog emu fox
Output from Swapping1.java
----------------------
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.java
----------------------
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.java
----------------------
array = Array( dog, barking animal, walking )
dlist = DList( dog, barking animal, walking )
collect(array) = Array( 3, 14, 7 )
collect(dlist) = DList( 3, 14, 7 )
Output from Vector1.java
----------------------
unsorted = [dog, ape, bat]
sorted = [ape, bat, dog]
Output from Voyager1.java
----------------------
voyager(tm) 2.0 beta 1, copyright objectspace 1997
address = 285.42.132.60:1891
map = HashMap( Pair( mascot, Bevo ), Pair( mascot, Longhorns ), Pair( song, Texas Fight! ), Pair( city, Austin ) )
map.size() = 4
map.empty() = false
map.get( "song" ) = Texas Fight!
after remote map is cleared...
map.size() = 0
map.empty() = true
map.get( "song" ) = null
Output from Voyager2.java
----------------------
voyager(tm) 2.0 beta 1, copyright objectspace 1997
address = 285.42.132.60:1893
lowercase = SList( yakko, wakko, dot )
uppercase = SList( YAKKO, WAKKO, DOT )
Output from Voyager3.java
----------------------
voyager(tm) 2.0 beta 1, copyright objectspace 1997
address = 285.42.132.60:1895
deque = Deque( Texas Fight!, Bevo, Hook 'Em )
default sort = Deque( Hook 'Em, Texas Fight!, Bevo )
alpha sort = Deque( Bevo, Hook 'Em, Texas Fight! )
before = Deque( White, White, Bevo, Hook 'Em, Texas Fight!, White, White )
after = Deque( White, Orange, Bevo, Hook 'Em, Texas Fight!, Orange, White )
Output from Voyager4A.java
----------------------
voyager(tm) 2.0 beta 1, copyright objectspace 1997
address = 285.42.132.60:1897
saved HashMap( Pair( Wolverine, Logan ), Pair( Batman, Bruce Wayne ), Pair( Spider-Man, Peter Parker ), Pair( Oracle, Barbara Gordon ) )
Output from Voyager4B.java
----------------------
voyager(tm) 2.0 beta 1, copyright objectspace 1997
address = 285.42.132.60:1899
Spider-Man is really Peter Parker
Mr. Fantastic is not in the database