Output update and exclude AttemptLocking for Appveyor

This commit is contained in:
Bruce Eckel 2017-05-03 12:00:00 -06:00
parent 3febbb2722
commit 7bf05f592b
123 changed files with 692 additions and 698 deletions

View File

@ -1,10 +0,0 @@
#! py -3
# Requires Python 3.5
# Displays all the Findbugs main.html reports from "On Java 8" on Windows
# Must run "gradlew findbugsMain" first
from pathlib import Path
import os
cmds = ["start " + str(report) for report in Path(".").rglob("main.html")]
(Path(".") / "ShowFindbugs.bat").write_text("\n".join(cmds).strip() + "\n")
os.system("ShowFindbugs.bat")

View File

@ -2,6 +2,10 @@
# Requires Python 3.5 # Requires Python 3.5
# Validates output from executable Java programs in "On Java 8." # Validates output from executable Java programs in "On Java 8."
# Use chain of responsibility to successively try strategies until one matches # Use chain of responsibility to successively try strategies until one matches
'''
Intended to be copied into the ExtractedExamples directory,
thus it doesn't use config.py
'''
from pathlib import Path from pathlib import Path
import textwrap import textwrap
import re import re

View File

@ -23,8 +23,8 @@ public class AtUnitComposition {
} }
/* Output: /* Output:
annotations.AtUnitComposition annotations.AtUnitComposition
. tMethodOne
. tMethodTwo This is methodTwo . tMethodTwo This is methodTwo
. tMethodOne
OK (2 tests) OK (2 tests)
*/ */

View File

@ -34,15 +34,15 @@ public class AtUnitExample1 {
} }
/* Output: /* Output:
annotations.AtUnitExample1 annotations.AtUnitExample1
. anotherDisappointment (failed)
. m2 This is methodTwo . m2 This is methodTwo
. m3 . m3
. failureTest (failed) . failureTest (failed)
. methodOneTest . methodOneTest
. anotherDisappointment (failed)
(5 tests) (5 tests)
>>> 2 FAILURES <<< >>> 2 FAILURES <<<
annotations.AtUnitExample1: anotherDisappointment
annotations.AtUnitExample1: failureTest annotations.AtUnitExample1: failureTest
annotations.AtUnitExample1: anotherDisappointment
*/ */

View File

@ -40,18 +40,18 @@ public class AtUnitExample2 {
} }
/* Output: /* Output:
annotations.AtUnitExample2 annotations.AtUnitExample2
. assertFailureExample java.lang.AssertionError: What a
surprise!
(failed)
. assertExample . assertExample
. exceptionExample java.io.FileNotFoundException: . exceptionExample java.io.FileNotFoundException:
nofile.txt (The system cannot find the file specified) nofile.txt (The system cannot find the file specified)
(failed) (failed)
. assertAndReturn This is methodTwo . assertAndReturn This is methodTwo
. assertFailureExample java.lang.AssertionError: What a
surprise!
(failed)
(4 tests) (4 tests)
>>> 2 FAILURES <<< >>> 2 FAILURES <<<
annotations.AtUnitExample2: assertFailureExample
annotations.AtUnitExample2: exceptionExample annotations.AtUnitExample2: exceptionExample
annotations.AtUnitExample2: assertFailureExample
*/ */

View File

@ -34,9 +34,9 @@ public class AtUnitExample3 {
} }
/* Output: /* Output:
annotations.AtUnitExample3 annotations.AtUnitExample3
. m2 This is methodTwo
. methodOneTest . methodOneTest
. initialization . initialization
. m2 This is methodTwo
OK (3 tests) OK (3 tests)
*/ */

View File

@ -67,16 +67,15 @@ public class AtUnitExample4 {
annotations.AtUnitExample4 annotations.AtUnitExample4
. words 'All' . words 'All'
(failed) (failed)
. scramble1 'brontosauruses' . scramble2 'brontosauruses'
ntsaueorosurbs tsaeborornussu
(failed)
. scramble2 'are' . scramble1 'are'
are rae
(failed) (failed)
(3 tests) (3 tests)
>>> 3 FAILURES <<< >>> 2 FAILURES <<<
annotations.AtUnitExample4: words annotations.AtUnitExample4: words
annotations.AtUnitExample4: scramble1 annotations.AtUnitExample4: scramble1
annotations.AtUnitExample4: scramble2
*/ */

View File

@ -53,11 +53,11 @@ public class AtUnitExample5 {
} }
/* Output: /* Output:
annotations.AtUnitExample5 annotations.AtUnitExample5
. test1
Running cleanup
. test3 . test3
Running cleanup Running cleanup
. test2 . test2
Running cleanup
. test1
Running cleanup Running cleanup
OK (3 tests) OK (3 tests)
*/ */

View File

@ -22,8 +22,8 @@ AtUnitExternalTest extends AtUnitExample1 {
} }
/* Output: /* Output:
annotations.AtUnitExternalTest annotations.AtUnitExternalTest
. tMethodOne
. tMethodTwo This is methodTwo . tMethodTwo This is methodTwo
. tMethodOne
OK (2 tests) OK (2 tests)
*/ */

View File

@ -29,8 +29,8 @@ public class HashSetTest {
} }
/* Output: /* Output:
annotations.HashSetTest annotations.HashSetTest
. tRemove
. tContains
. initialization . initialization
. tContains
. tRemove
OK (3 tests) OK (3 tests)
*/ */

View File

@ -27,11 +27,11 @@ public class UseCaseTracker {
} }
} }
/* Output: /* Output:
Found Use Case 49
New passwords can't equal previously used ones
Found Use Case 47 Found Use Case 47
Passwords must contain at least one numeric Passwords must contain at least one numeric
Found Use Case 48 Found Use Case 48
no description no description
Found Use Case 49
New passwords can't equal previously used ones
Missing use case 50 Missing use case 50
*/ */

View File

@ -19,11 +19,11 @@ public class AlphabeticSearch {
} }
} }
/* Output: /* Output:
[anmkkyh, bhmupju, btpenpc, cjwzmmr, cuxszgv, [anmkkyh, bhmupju, btpenpc, cjwzmmr, cuxszgv, eloztdv,
eloztdv, ewcippc, ezdeklu, fcjpthl, ewcippc, ezdeklu, fcjpthl, fqmlgsh, gmeinne, hyoubzl,
fqmlgsh, gmeinne, hyoubzl, jbvlgwc, jlxpqds, jbvlgwc, jlxpqds, ljlbynx, mvducuj, qgekgly, skddcat,
ljlbynx, mvducuj, qgekgly, skddcat, taprwxz, uybypgp, vjsszkn, vniyapk, vqqakbm, vwodhcf,
taprwxz, uybypgp, vjsszkn, vniyapk, vqqakbm, ydpulcq, ygpoalk, yskvett, zehpfmm, zofmmvm, zrxmclh]
vwodhcf, ydpulcq, ygpoalk, yskvett, Index: 10
zehpfmm, zofmmvm, zrxmclh] Index: 10 gmeinne gmeinne
*/ */

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // CI Systems have trouble // {ValidateByHand} CI Systems have trouble
import java.util.*; import java.util.*;
public class ParallelPrefix3 { public class ParallelPrefix3 {

View File

@ -1,2 +0,0 @@
cp ..\..\OnJava-Tools\verify_output.py .
py -3 verify_output.py

View File

@ -21,8 +21,8 @@ public class GenericsAndUpcasting {
} }
} }
/* Output: /* Output:
GrannySmith@1db9742 GrannySmith@15db9742
Gala@106d69c Gala@6d06d69c
Fuji@52e922 Fuji@7852e922
Braeburn@25154f Braeburn@4e25154f
*/ */

View File

@ -27,8 +27,8 @@ public class ListIteration {
} }
} }
/* Output: /* Output:
Rat, 1, 0; Manx, 2, 1; Cymric, 3, 2; Mutt, 4, 3; Rat, 1, 0; Manx, 2, 1; Cymric, 3, 2; Mutt, 4, 3; Pug, 5, 4;
Pug, 5, 4; Cymric, 6, 5; Pug, 7, 6; Manx, 8, 7; Cymric, 6, 5; Pug, 7, 6; Manx, 8, 7;
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
[Rat, Manx, Cymric, Mutt, Pug, Cymric, Pug, Manx] [Rat, Manx, Cymric, Mutt, Pug, Cymric, Pug, Manx]
[Rat, Manx, Cymric, Cymric, Rat, EgyptianMau, Hamster, [Rat, Manx, Cymric, Cymric, Rat, EgyptianMau, Hamster,

View File

@ -39,26 +39,26 @@ public class MapOfList {
} }
} }
/* Output: /* Output:
People: [Person Marilyn, Person Dawn, Person Luke, Person People: [Person Dawn, Person Kate, Person Isaac, Person
Isaac, Person Kate] Marilyn, Person Luke]
Pets: [[Pug Louie aka Louis Snorkelstein Dupree, Cat Pets: [[Cymric Molly, Mutt Spot], [Cat Shackleton, Cat
Stanford aka Stinky el Negro, Cat Pinkola], [Cymric Molly, Elsie May, Dog Margrett], [Rat Freckly], [Pug Louie aka
Mutt Spot], [Rat Fuzzy, Rat Fizzy], [Rat Freckly], [Cat Louis Snorkelstein Dupree, Cat Stanford aka Stinky el
Shackleton, Cat Elsie May, Dog Margrett]] Negro, Cat Pinkola], [Rat Fuzzy, Rat Fizzy]]
Person Marilyn has:
Pug Louie aka Louis Snorkelstein Dupree
Cat Stanford aka Stinky el Negro
Cat Pinkola
Person Dawn has: Person Dawn has:
Cymric Molly Cymric Molly
Mutt Spot Mutt Spot
Person Luke has:
Rat Fuzzy
Rat Fizzy
Person Isaac has:
Rat Freckly
Person Kate has: Person Kate has:
Cat Shackleton Cat Shackleton
Cat Elsie May Cat Elsie May
Dog Margrett Dog Margrett
Person Isaac has:
Rat Freckly
Person Marilyn has:
Pug Louie aka Louis Snorkelstein Dupree
Cat Stanford aka Stinky el Negro
Cat Pinkola
Person Luke has:
Rat Fuzzy
Rat Fizzy
*/ */

View File

@ -60,18 +60,18 @@ public class Bits {
} }
} }
/* Output: /* Output:
byte value: 118 byte value: -107
bits: {1, 2, 4, 5, 6} bits: {0, 2, 4, 7}
bit pattern: 0110111000000000000000000000000000000000000000 bit pattern: 1010100100000000000000000000000000000000000000
000000000000000000 000000000000000000
short value: 9795 short value: 1302
bits: {0, 1, 6, 9, 10, 13} bits: {1, 2, 4, 8, 10}
bit pattern: 1100001001100100000000000000000000000000000000 bit pattern: 0110100010100000000000000000000000000000000000
000000000000000000 000000000000000000
int value: -645079414 int value: -2014573909
bits: {1, 3, 7, 9, 10, 11, 12, 14, 15, 18, 19, 23, 24, 27, bits: {0, 1, 3, 5, 7, 9, 11, 18, 19, 21, 22, 23, 24, 25,
28, 30, 31} 26, 31}
bit pattern: 0101000101111011001100011001101100000000000000 bit pattern: 1101010101010000001101111110000100000000000000
000000000000000000 000000000000000000
set bit 127: {127} set bit 127: {127}
set bit 255: {255} set bit 255: {255}

View File

@ -26,9 +26,10 @@ public class FillingLists {
} }
} }
/* Output: /* Output:
[StringAddress@1db9742 Hello, StringAddress@1db9742 Hello, [StringAddress@15db9742 Hello, StringAddress@15db9742
StringAddress@1db9742 Hello, StringAddress@1db9742 Hello] Hello, StringAddress@15db9742 Hello, StringAddress@15db9742
[StringAddress@106d69c World!, StringAddress@106d69c Hello]
World!, StringAddress@106d69c World!, StringAddress@106d69c [StringAddress@6d06d69c World!, StringAddress@6d06d69c
World!] World!, StringAddress@6d06d69c World!,
StringAddress@6d06d69c World!]
*/ */

View File

@ -123,4 +123,44 @@ public class ListOps {
} }
} }
/* Output: /* Output:
[AliceBlue, AntiqueWhite, Aquamarine, Azure, Beige, Bisque,
Black, BlanchedAlmond, Blue, BlueViolet]
b = [AliceBlue, AntiqueWhite, Aquamarine, Azure, Beige,
Bisque, Black, BlanchedAlmond, Blue, BlueViolet]
[AliceBlue, AntiqueWhite, Aquamarine, Azure, Beige, Bisque,
Black, BlanchedAlmond, Blue, BlueViolet, AliceBlue,
AntiqueWhite, Aquamarine, Azure, Beige, Bisque, Black,
BlanchedAlmond, Blue, BlueViolet, AliceBlue, AntiqueWhite,
Aquamarine, Azure, Beige, Bisque, Black, BlanchedAlmond,
Blue, BlueViolet]
[AliceBlue, AntiqueWhite, Aquamarine, Azure, Beige, Bisque,
Black, BlanchedAlmond, Blue, BlueViolet, AliceBlue,
AntiqueWhite, Aquamarine, Azure, Beige, one, Bisque, Black,
BlanchedAlmond, Blue, BlueViolet, AliceBlue, AntiqueWhite,
Aquamarine, Azure, Beige, Bisque, Black, BlanchedAlmond,
Blue, BlueViolet]
Bisque
Black
[AliceBlue, AntiqueWhite, Aquamarine, Azure, Beige, Bisque,
Black, BlanchedAlmond, Blue, BlueViolet, AliceBlue,
AntiqueWhite, Aquamarine, Azure, Beige, one, 47,
BlanchedAlmond, Blue, BlueViolet, AliceBlue, AntiqueWhite,
Aquamarine, Azure, Beige, Bisque, Black, BlanchedAlmond,
Blue, BlueViolet]
BlueViolet Blue BlanchedAlmond Black Bisque Beige Azure
Aquamarine AntiqueWhite AliceBlue BlueViolet Blue
BlanchedAlmond 47 one Beige Azure Aquamarine AntiqueWhite
AliceBlue BlueViolet Blue BlanchedAlmond Black Bisque Beige
Azure Aquamarine AntiqueWhite AliceBlue
testVisual finished
[AliceBlue, AntiqueWhite, Aquamarine, Azure, Beige, Bisque,
Black, BlanchedAlmond, Blue, BlueViolet]
[two, one, AliceBlue, AntiqueWhite, Aquamarine, Azure,
Beige, Bisque, Black, BlanchedAlmond, Blue, BlueViolet]
two
two
one
BlueViolet
[AliceBlue, AntiqueWhite, Aquamarine, Azure, Beige, Bisque,
Black, BlanchedAlmond, Blue]
*/ */

View File

@ -67,25 +67,25 @@ public class References {
} }
} }
/* Output: (First and Last 10 Lines) /* Output: (First and Last 10 Lines)
Just created: java.lang.ref.SoftReference@1db9742 Just created: java.lang.ref.SoftReference@15db9742
Just created: java.lang.ref.SoftReference@106d69c Just created: java.lang.ref.SoftReference@6d06d69c
Just created: java.lang.ref.SoftReference@52e922 Just created: java.lang.ref.SoftReference@7852e922
Just created: java.lang.ref.SoftReference@25154f Just created: java.lang.ref.SoftReference@4e25154f
Just created: java.lang.ref.SoftReference@10dea4e Just created: java.lang.ref.SoftReference@70dea4e
Just created: java.lang.ref.SoftReference@647e05 Just created: java.lang.ref.SoftReference@5c647e05
Just created: java.lang.ref.SoftReference@1909752 Just created: java.lang.ref.SoftReference@33909752
Just created: java.lang.ref.SoftReference@1f96302 Just created: java.lang.ref.SoftReference@55f96302
Just created: java.lang.ref.SoftReference@14eac69 Just created: java.lang.ref.SoftReference@3d4eac69
Just created: java.lang.ref.SoftReference@a57993 Just created: java.lang.ref.SoftReference@42a57993
...________...________...________...________... ...________...________...________...________...
Just created: java.lang.ref.PhantomReference@1ee12a7 Just created: java.lang.ref.PhantomReference@45ee12a7
In queue: null In queue: null
Just created: java.lang.ref.PhantomReference@10bedb4 Just created: java.lang.ref.PhantomReference@330bedb4
In queue: null In queue: null
Just created: java.lang.ref.PhantomReference@103dbd3 Just created: java.lang.ref.PhantomReference@2503dbd3
In queue: null In queue: null
Just created: java.lang.ref.PhantomReference@167cf4d Just created: java.lang.ref.PhantomReference@4b67cf4d
In queue: null In queue: null
Just created: java.lang.ref.PhantomReference@a987ac Just created: java.lang.ref.PhantomReference@7ea987ac
In queue: null In queue: null
*/ */

View File

@ -80,14 +80,14 @@ public class TypesForSets {
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4] [10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4]
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
[1, 6, 8, 6, 2, 7, 8, 9, 4, 10, 7, 5, 1, 3, 4, 9, 9, [1, 6, 8, 6, 2, 7, 8, 9, 4, 10, 7, 5, 1, 3, 4, 9, 9, 10, 5,
10, 5, 3, 2, 0, 4, 1, 2, 0, 8, 3, 0, 10, 6, 5, 7] 3, 2, 0, 4, 1, 2, 0, 8, 3, 0, 10, 6, 5, 7]
[3, 1, 4, 8, 7, 6, 9, 5, 3, 0, 10, 5, 5, 10, 7, 8, 8, [3, 1, 4, 8, 7, 6, 9, 5, 3, 0, 10, 5, 5, 10, 7, 8, 8, 9, 1,
9, 1, 4, 10, 2, 6, 9, 1, 6, 0, 3, 2, 0, 7, 2, 4] 4, 10, 2, 6, 9, 1, 6, 0, 3, 2, 0, 7, 2, 4]
[10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4, 10, 9, 8, 7, 6, 5, [10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4, 10, 9, 8, 7, 6, 5, 0, 1,
0, 1, 2, 3, 4, 10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4] 2, 3, 4, 10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4]
[10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4, 10, 9, 8, 7, 6, 5, [10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4, 10, 9, 8, 7, 6, 5, 0, 1,
0, 1, 2, 3, 4, 10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4] 2, 3, 4, 10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4]
SetType cannot be cast to java.lang.Comparable SetType cannot be cast to java.lang.Comparable
HashType cannot be cast to java.lang.Comparable HashType cannot be cast to java.lang.Comparable
*/ */

View File

@ -16,14 +16,14 @@ public class CachedThreadPool {
} }
} }
/* Output: /* Output:
NapTask[2] pool-1-thread-3
NapTask[9] pool-1-thread-10 NapTask[9] pool-1-thread-10
NapTask[6] pool-1-thread-7
NapTask[5] pool-1-thread-6
NapTask[7] pool-1-thread-8
NapTask[8] pool-1-thread-9
NapTask[0] pool-1-thread-1
NapTask[1] pool-1-thread-2 NapTask[1] pool-1-thread-2
NapTask[4] pool-1-thread-5 NapTask[8] pool-1-thread-9
NapTask[7] pool-1-thread-8
NapTask[5] pool-1-thread-6
NapTask[6] pool-1-thread-7
NapTask[3] pool-1-thread-4 NapTask[3] pool-1-thread-4
NapTask[4] pool-1-thread-5
NapTask[0] pool-1-thread-1
NapTask[2] pool-1-thread-3
*/ */

View File

@ -16,14 +16,14 @@ public class CachedThreadPool2 {
} }
} }
/* Output: /* Output:
0 pool-1-thread-1 200 1 pool-1-thread-2 117
4 pool-1-thread-5 300 0 pool-1-thread-1 117
3 pool-1-thread-4 400 2 pool-1-thread-3 217
1 pool-1-thread-2 200 4 pool-1-thread-5 407
2 pool-1-thread-3 200 3 pool-1-thread-4 337
6 pool-1-thread-7 500 5 pool-1-thread-6 507
8 pool-1-thread-9 757 7 pool-1-thread-8 707
5 pool-1-thread-6 657 6 pool-1-thread-7 607
7 pool-1-thread-8 657 8 pool-1-thread-9 807
9 pool-1-thread-10 857 9 pool-1-thread-10 907
*/ */

View File

@ -34,14 +34,14 @@ public class CachedThreadPool3 {
} }
/* Output: /* Output:
2 pool-1-thread-3 100 2 pool-1-thread-3 100
6 pool-1-thread-7 100
5 pool-1-thread-6 100
7 pool-1-thread-8 100
4 pool-1-thread-5 100
9 pool-1-thread-10 100
3 pool-1-thread-4 100
0 pool-1-thread-1 100 0 pool-1-thread-1 100
1 pool-1-thread-2 100 1 pool-1-thread-2 100
3 pool-1-thread-4 100
4 pool-1-thread-5 100
5 pool-1-thread-6 100
6 pool-1-thread-7 100
7 pool-1-thread-8 100
8 pool-1-thread-9 100 8 pool-1-thread-9 100
9 pool-1-thread-10 100
sum = 1000 sum = 1000
*/ */

View File

@ -52,11 +52,14 @@ public class CatchCompletableExceptions {
/* Output: /* Output:
**** Failure Mode **** **** Failure Mode ****
Breakable_exceptionally [1] Breakable_exceptionally [1]
Throwing Exception for exceptionally
result: Breakable_java.lang.RuntimeException: result: Breakable_java.lang.RuntimeException:
Breakable_exceptionally failed [0] Breakable_exceptionally failed [0]
Breakable_handle [1] Breakable_handle [1]
Throwing Exception for handle
result: Failure recovery object result: Failure recovery object
Breakable_whenComplete [1] Breakable_whenComplete [1]
Throwing Exception for whenComplete
It failed It failed
**** Success Mode **** **** Success Mode ****
Breakable_exceptionally [-1] Breakable_exceptionally [-1]

View File

@ -21,11 +21,11 @@ public class CompletableApplyAsync {
} }
} }
/* Output: /* Output:
50 45
Machina0: ONE Machina0: ONE
Machina0: TWO Machina0: TWO
Machina0: THREE Machina0: THREE
Machina0: complete Machina0: complete
Machina0: complete Machina0: complete
462 463
*/ */

View File

@ -23,5 +23,5 @@ Machina0: ONE
Machina0: TWO Machina0: TWO
Machina0: THREE Machina0: THREE
Machina0: complete Machina0: complete
460 452
*/ */

View File

@ -55,6 +55,7 @@ public class CompletableOperations {
1 1
runAsync runAsync
thenRunAsync thenRunAsync
runAsync is static
99 99
thenAcceptAsync: 4 thenAcceptAsync: 4
47 47
@ -65,7 +66,7 @@ thenAcceptAsync: 4
cancelled: true cancelled: true
completed exceptionally: true completed exceptionally: true
done: true done: true
java.util.concurrent.CompletableFuture@404b9385[Completed java.util.concurrent.CompletableFuture@6d311334[Completed
exceptionally] exceptionally]
777 777
dependents: 1 dependents: 1

View File

@ -42,46 +42,46 @@ public class CompletablePizza {
} }
} }
/* Output: /* Output:
56 69
Pizza 0: ROLLED Pizza 0: ROLLED
Pizza 1: ROLLED Pizza 1: ROLLED
Pizza 4: ROLLED
Pizza 2: ROLLED Pizza 2: ROLLED
Pizza 3: ROLLED
Pizza 0: SAUCED
Pizza 3: SAUCED
Pizza 2: SAUCED
Pizza 4: SAUCED
Pizza 1: SAUCED Pizza 1: SAUCED
Pizza 0: SAUCED
Pizza 2: SAUCED
Pizza 0: CHEESED Pizza 0: CHEESED
Pizza 4: CHEESED
Pizza 2: CHEESED
Pizza 3: CHEESED
Pizza 1: CHEESED Pizza 1: CHEESED
Pizza 2: CHEESED
Pizza 4: ROLLED
Pizza 3: ROLLED
Pizza 0: TOPPED Pizza 0: TOPPED
Pizza 4: TOPPED Pizza 3: SAUCED
Pizza 1: TOPPED Pizza 1: TOPPED
Pizza 3: TOPPED Pizza 3: CHEESED
Pizza 4: SAUCED
Pizza 2: TOPPED Pizza 2: TOPPED
Pizza 3: TOPPED
Pizza 0: BAKED Pizza 0: BAKED
Pizza 4: BAKED
Pizza 3: BAKED
Pizza 1: BAKED Pizza 1: BAKED
Pizza 2: BAKED Pizza 4: CHEESED
Pizza 3: BAKED
Pizza 0: SLICED Pizza 0: SLICED
Pizza 2: SLICED
Pizza 4: SLICED
Pizza 1: SLICED
Pizza 3: SLICED Pizza 3: SLICED
Pizza 3: BOXED
Pizza 1: SLICED
Pizza 2: BAKED
Pizza 0: BOXED Pizza 0: BOXED
Pizza0: complete Pizza0: complete
Pizza 4: BOXED
Pizza 3: BOXED
Pizza 2: BOXED
Pizza 1: BOXED Pizza 1: BOXED
Pizza1: complete Pizza1: complete
Pizza 4: TOPPED
Pizza 2: SLICED
Pizza 2: BOXED
Pizza2: complete Pizza2: complete
Pizza3: complete Pizza3: complete
Pizza 4: BAKED
Pizza 4: SLICED
Pizza 4: BOXED
Pizza4: complete Pizza4: complete
1659 3269
*/ */

View File

@ -17,15 +17,15 @@ public class CountingStream {
} }
} }
/* Output: /* Output:
4 ForkJoinPool.commonPool-worker-5 100
2 ForkJoinPool.commonPool-worker-1 100 2 ForkJoinPool.commonPool-worker-1 100
6 main 100
5 ForkJoinPool.commonPool-worker-1 100
7 ForkJoinPool.commonPool-worker-4 100
1 ForkJoinPool.commonPool-worker-3 100
8 ForkJoinPool.commonPool-worker-2 100 8 ForkJoinPool.commonPool-worker-2 100
0 ForkJoinPool.commonPool-worker-6 100 4 ForkJoinPool.commonPool-worker-1 100
9 ForkJoinPool.commonPool-worker-7 100 3 ForkJoinPool.commonPool-worker-1 100
3 ForkJoinPool.commonPool-worker-5 100 7 ForkJoinPool.commonPool-worker-1 100
0 ForkJoinPool.commonPool-worker-1 100
5 ForkJoinPool.commonPool-worker-1 100
6 main 100
1 ForkJoinPool.commonPool-worker-3 100
9 ForkJoinPool.commonPool-worker-2 100
1000 1000
*/ */

View File

@ -103,13 +103,11 @@ Workable[AW]
Workable[CW] Workable[CW]
anyOf anyOf
Workable[BW] Workable[BW]
Workable[DW]
Workable[AW] Workable[AW]
***************** *****************
Workable[CW] Workable[DW]
Workable[BW] Workable[BW]
Workable[DW] Workable[CW]
Workable[AW] Workable[AW]
***************** *****************
allOf
*/ */

View File

@ -20,7 +20,7 @@ public class MoreTasksAfterShutdown {
/* Output: /* Output:
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.RejectedExecutionException: Task
NapTask[99] rejected from NapTask[99] rejected from
java.util.concurrent.ThreadPoolExecutor@25154f[Shutting java.util.concurrent.ThreadPoolExecutor@4e25154f[Shutting
down, pool size = 1, active threads = 1, queued tasks = 0, down, pool size = 1, active threads = 1, queued tasks = 0,
completed tasks = 0] completed tasks = 0]
NapTask[1] pool-1-thread-1 NapTask[1] pool-1-thread-1

View File

@ -22,5 +22,5 @@ Pizza 0: TOPPED
Pizza 0: BAKED Pizza 0: BAKED
Pizza 0: SLICED Pizza 0: SLICED
Pizza 0: BOXED Pizza 0: BOXED
1612 1605
*/ */

View File

@ -31,5 +31,5 @@ public class ParallelPrime {
} }
} }
/* Output: /* Output:
616 1197
*/ */

View File

@ -24,5 +24,5 @@ public class ParallelStreamPuzzle {
} }
} }
/* Output: /* Output:
[2, 8, 21, 24, 27, 30, 33, 37, 40, 43] [1, 28, 30, 33, 36, 39, 42, 44, 46, 48]
*/ */

View File

@ -34,5 +34,5 @@ public class ParallelStreamPuzzle2 {
} }
} }
/* Output: /* Output:
[4, 25, 27, 32, 37, 44, 49, 56, 61, 73] [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
*/ */

View File

@ -2,6 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand}
import java.util.*; import java.util.*;
import java.util.stream.*; import java.util.stream.*;
@ -26,7 +27,7 @@ public class ParallelStreamPuzzle3 {
2: ForkJoinPool.commonPool-worker-6 2: ForkJoinPool.commonPool-worker-6
4: ForkJoinPool.commonPool-worker-1 4: ForkJoinPool.commonPool-worker-1
0: ForkJoinPool.commonPool-worker-4 0: ForkJoinPool.commonPool-worker-4
7: main 7: ForkJoinPool.commonPool-worker-1
9: ForkJoinPool.commonPool-worker-2 9: ForkJoinPool.commonPool-worker-2
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
*/ */

View File

@ -25,45 +25,45 @@ public class PizzaParallelSteps {
} }
} }
/* Output: /* Output:
Pizza 0: ROLLED
Pizza 4: ROLLED Pizza 4: ROLLED
Pizza 1: ROLLED Pizza 1: ROLLED
Pizza 3: ROLLED
Pizza 0: ROLLED
Pizza 2: ROLLED Pizza 2: ROLLED
Pizza 4: SAUCED
Pizza 3: SAUCED
Pizza 1: SAUCED
Pizza 2: SAUCED Pizza 2: SAUCED
Pizza 0: SAUCED Pizza 0: SAUCED
Pizza 4: CHEESED Pizza 1: SAUCED
Pizza 1: CHEESED Pizza 4: SAUCED
Pizza 3: CHEESED
Pizza 0: CHEESED Pizza 0: CHEESED
Pizza 4: CHEESED
Pizza 2: CHEESED Pizza 2: CHEESED
Pizza 1: CHEESED
Pizza 1: TOPPED Pizza 1: TOPPED
Pizza 3: TOPPED
Pizza 4: TOPPED
Pizza 2: TOPPED Pizza 2: TOPPED
Pizza 4: TOPPED
Pizza 0: TOPPED Pizza 0: TOPPED
Pizza 1: BAKED Pizza 0: BAKED
Pizza 3: BAKED
Pizza 4: BAKED Pizza 4: BAKED
Pizza 2: BAKED Pizza 2: BAKED
Pizza 0: BAKED Pizza 1: BAKED
Pizza 1: SLICED Pizza 0: SLICED
Pizza 3: SLICED
Pizza 2: SLICED Pizza 2: SLICED
Pizza 4: SLICED Pizza 4: SLICED
Pizza 0: SLICED Pizza 1: SLICED
Pizza 1: BOXED
Pizza 3: BOXED
Pizza3: complete
Pizza 4: BOXED Pizza 4: BOXED
Pizza4: complete
Pizza1: complete
Pizza 0: BOXED
Pizza 2: BOXED Pizza 2: BOXED
Pizza2: complete Pizza2: complete
Pizza 0: BOXED
Pizza0: complete Pizza0: complete
1673 Pizza4: complete
Pizza 1: BOXED
Pizza1: complete
Pizza 3: ROLLED
Pizza 3: SAUCED
Pizza 3: CHEESED
Pizza 3: TOPPED
Pizza 3: BAKED
Pizza 3: SLICED
Pizza 3: BOXED
Pizza3: complete
3279
*/ */

View File

@ -21,40 +21,40 @@ public class PizzaStreams {
} }
} }
/* Output: /* Output:
Pizza 1: ROLLED
Pizza 4: ROLLED Pizza 4: ROLLED
Pizza 2: ROLLED Pizza 2: ROLLED
Pizza 0: ROLLED Pizza 0: ROLLED
Pizza 3: ROLLED Pizza 2: SAUCED
Pizza 1: ROLLED
Pizza 0: SAUCED
Pizza 3: SAUCED
Pizza 4: SAUCED Pizza 4: SAUCED
Pizza 1: SAUCED Pizza 1: SAUCED
Pizza 2: SAUCED Pizza 0: SAUCED
Pizza 0: CHEESED
Pizza 4: CHEESED
Pizza 3: CHEESED
Pizza 2: CHEESED Pizza 2: CHEESED
Pizza 4: CHEESED
Pizza 0: CHEESED
Pizza 1: CHEESED Pizza 1: CHEESED
Pizza 3: TOPPED Pizza 2: TOPPED
Pizza 4: TOPPED Pizza 4: TOPPED
Pizza 0: TOPPED Pizza 0: TOPPED
Pizza 2: TOPPED
Pizza 1: TOPPED Pizza 1: TOPPED
Pizza 0: BAKED
Pizza 3: BAKED
Pizza 4: BAKED Pizza 4: BAKED
Pizza 1: BAKED
Pizza 2: BAKED Pizza 2: BAKED
Pizza 4: SLICED Pizza 1: BAKED
Pizza 3: SLICED Pizza 0: BAKED
Pizza 0: SLICED
Pizza 2: SLICED Pizza 2: SLICED
Pizza 4: SLICED
Pizza 1: SLICED Pizza 1: SLICED
Pizza 3: BOXED Pizza 0: SLICED
Pizza 2: BOXED
Pizza 4: BOXED Pizza 4: BOXED
Pizza 0: BOXED Pizza 0: BOXED
Pizza 1: BOXED Pizza 1: BOXED
Pizza 2: BOXED Pizza 3: ROLLED
1667 Pizza 3: SAUCED
Pizza 3: CHEESED
Pizza 3: TOPPED
Pizza 3: BAKED
Pizza 3: SLICED
Pizza 3: BOXED
3275
*/ */

View File

@ -23,13 +23,13 @@ public class QuittingCompletable {
} }
} }
/* Output: /* Output:
125 148 115 127 120 118 106 140 77 119 97 80 143 17 92 147 1 3 4 5 6 2 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
89 123 16 12 138 25 13 101 135 96 76 73 130 133 37 132 134 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
149 137 122 29 49 60 40 142 131 53 1 98 145 126 65 5 64 82 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
79 68 86 141 61 128 22 7 26 19 139 114 146 14 15 43 34 10 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
75 87 90 31 47 38 62 18 63 41 42 144 66 23 6 4 91 70 83 102 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
103 54 69 74 56 71 94 88 78 81 57 52 93 45 48 44 32 28 36 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
33 104 105 112 109 100 117 24 108 21 116 20 9 85 8 84 72 118 119 120 121 122 123 124 7 126 127 128 129 130 131 132
107 113 121 124 136 129 99 95 55 3 27 2 59 67 50 58 51 39 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
30 35 46 110 111 11 148 149 125
*/ */

View File

@ -23,13 +23,13 @@ public class QuittingTasks {
} }
} }
/* Output: /* Output:
125 148 115 127 120 118 106 140 77 119 97 80 143 17 92 147 2 33 32 28 31 30 26 29 27 22 1 25 4 23 24 6 5 7 3 8 10 9 12
89 123 16 12 138 25 13 101 135 96 76 73 130 133 37 132 134 11 21 17 13 14 15 16 18 19 20 39 34 36 37 35 38 40 52 57 53
149 137 122 29 49 60 40 142 131 53 1 98 145 126 65 5 64 82 54 95 88 89 91 84 90 87 85 92 86 77 94 80 81 78 59 55 71 74
79 68 86 141 61 128 22 7 26 19 139 114 146 14 15 43 34 10 60 58 76 79 62 83 63 82 61 64 68 65 72 69 67 66 47 75 73 49
75 87 90 31 47 38 62 18 63 41 42 144 66 23 6 4 91 70 83 102 45 70 42 44 51 41 43 50 46 48 56 123 126 119 120 127 121
103 54 69 74 56 71 94 88 78 81 57 52 93 45 48 44 32 28 36 114 117 99 116 115 129 96 145 142 143 148 93 140 125 139
33 104 105 112 109 100 117 24 108 21 116 20 9 85 8 84 72 124 147 101 141 128 133 100 135 137 130 144 134 146 131 149
107 113 121 124 136 129 99 95 55 3 27 2 59 67 50 58 51 39 138 113 132 110 109 111 105 118 97 122 107 98 102 104 103
30 35 46 110 111 11 106 112 108 136
*/ */

View File

@ -39,6 +39,6 @@ public class SharedConstructorArgument {
} }
} }
/* Output: /* Output:
47747 48627
0 0
*/ */

View File

@ -26,20 +26,21 @@ public class SingleThreadExecutor {
/* Output: /* Output:
All tasks submitted All tasks submitted
main awaiting termination main awaiting termination
main awaiting termination
NapTask[0] pool-1-thread-1 NapTask[0] pool-1-thread-1
main awaiting termination main awaiting termination
NapTask[1] pool-1-thread-1 NapTask[1] pool-1-thread-1
main awaiting termination main awaiting termination
NapTask[2] pool-1-thread-1 NapTask[2] pool-1-thread-1
main awaiting termination
NapTask[3] pool-1-thread-1 NapTask[3] pool-1-thread-1
main awaiting termination main awaiting termination
main awaiting termination
NapTask[4] pool-1-thread-1 NapTask[4] pool-1-thread-1
main awaiting termination main awaiting termination
NapTask[5] pool-1-thread-1 NapTask[5] pool-1-thread-1
main awaiting termination
NapTask[6] pool-1-thread-1 NapTask[6] pool-1-thread-1
main awaiting termination main awaiting termination
main awaiting termination
NapTask[7] pool-1-thread-1 NapTask[7] pool-1-thread-1
main awaiting termination main awaiting termination
NapTask[8] pool-1-thread-1 NapTask[8] pool-1-thread-1

View File

@ -41,7 +41,7 @@ public class Summing {
} }
/* Output: /* Output:
5000000050000000 5000000050000000
Sum Stream: 631ms Sum Stream: 62ms
Sum Stream Parallel: 159ms Sum Stream Parallel: 42ms
Sum Iterated: 2560ms Sum Iterated: 116ms
*/ */

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // CI has trouble // {ValidateByHand} CI has trouble
import java.util.*; import java.util.*;
public class Summing2 { public class Summing2 {

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // CI has trouble // {ValidateByHand} CI has trouble
import java.util.*; import java.util.*;
public class Summing3 { public class Summing3 {

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // CI has trouble // {ValidateByHand} CI has trouble
import java.util.*; import java.util.*;
public class Summing4 { public class Summing4 {

View File

@ -9,5 +9,5 @@ public class TestStaticIDField {
} }
} }
/* Output: /* Output:
47643 47829
*/ */

View File

@ -33,8 +33,8 @@ public enum ConstantSpecificMethod {
} }
} }
/* Output: /* Output:
Jul 27, 2016 May 2, 2017
C:\Users\Bruce\Documents\GitHub\on- C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\\gradle\wrapper\gradle-wrapper.jar java\ExtractedExamples\\gradle\wrapper\gradle-wrapper.jar
1.8.0_102 1.8.0_102
*/ */

View File

@ -34,8 +34,11 @@ Compiled from "NotClasses.java"
abstract class LikeClasses extends abstract class LikeClasses extends
java.lang.Enum<LikeClasses> { java.lang.Enum<LikeClasses> {
public static final LikeClasses WINKEN; public static final LikeClasses WINKEN;
public static final LikeClasses BLINKEN; public static final LikeClasses BLINKEN;
public static final LikeClasses NOD; public static final LikeClasses NOD;
public static LikeClasses[] values(); public static LikeClasses[] values();
Code: Code:
0: getstatic #2 // Field 0: getstatic #2 // Field

View File

@ -144,54 +144,54 @@ public class PostOffice {
} }
} }
/* Output: /* Output:
Mail 0, General Delivery: NO3, Address Scanability: YES2, Mail 0, General Delivery: NO2, Address Scanability:
Address Readability: YES1, Address Address: OK4, Return UNSCANNABLE, Address Readability: YES3, Address Address:
address: OK5 OK1, Return address: OK1
Delivering Mail 0 automatically Delivering Mail 0 normally
***** *****
Mail 1, General Delivery: NO1, Address Scanability: YES1, Mail 1, General Delivery: NO5, Address Scanability: YES3,
Address Readability: YES3, Address Address: OK6, Return Address Readability: ILLEGIBLE, Address Address: OK5,
address: OK1 Return address: OK1
Delivering Mail 1 automatically Delivering Mail 1 automatically
***** *****
Mail 2, General Delivery: NO4, Address Scanability: YES2, Mail 2, General Delivery: YES, Address Scanability: YES3,
Address Readability: ILLEGIBLE, Address Address: OK5, Address Readability: YES1, Address Address: OK1, Return
Return address: MISSING
Delivering Mail 2 automatically
*****
Mail 3, General Delivery: YES, Address Scanability:
UNSCANNABLE, Address Readability: YES2, Address Address:
OK6, Return address: OK1
Using general delivery for Mail 3
*****
Mail 4, General Delivery: YES, Address Scanability: YES4,
Address Readability: YES1, Address Address: OK6, Return
address: OK5 address: OK5
Using general delivery for Mail 4 Using general delivery for Mail 2
***** *****
Mail 5, General Delivery: NO5, Address Scanability: YES3, Mail 3, General Delivery: NO4, Address Scanability: YES3,
Address Readability: YES3, Address Address: OK1, Return Address Readability: YES1, Address Address: INCORRECT,
address: OK4 Return address: OK4
Returning Mail 3 to sender
*****
Mail 4, General Delivery: NO4, Address Scanability:
UNSCANNABLE, Address Readability: YES1, Address Address:
INCORRECT, Return address: OK2
Returning Mail 4 to sender
*****
Mail 5, General Delivery: NO3, Address Scanability: YES1,
Address Readability: ILLEGIBLE, Address Address: OK4,
Return address: OK2
Delivering Mail 5 automatically Delivering Mail 5 automatically
***** *****
Mail 6, General Delivery: YES, Address Scanability: Mail 6, General Delivery: YES, Address Scanability: YES4,
UNSCANNABLE, Address Readability: YES1, Address Address: Address Readability: ILLEGIBLE, Address Address: OK4,
OK3, Return address: MISSING Return address: OK4
Using general delivery for Mail 6 Using general delivery for Mail 6
***** *****
Mail 7, General Delivery: NO4, Address Scanability: YES1, Mail 7, General Delivery: YES, Address Scanability: YES3,
Address Readability: YES2, Address Address: OK2, Return Address Readability: YES4, Address Address: OK2, Return
address: MISSING address: MISSING
Delivering Mail 7 automatically Using general delivery for Mail 7
***** *****
Mail 8, General Delivery: NO1, Address Scanability: YES2, Mail 8, General Delivery: NO3, Address Scanability: YES1,
Address Readability: YES3, Address Address: OK3, Return Address Readability: YES3, Address Address: INCORRECT,
address: OK3 Return address: MISSING
Delivering Mail 8 automatically Mail 8 is a dead letter
***** *****
Mail 9, General Delivery: NO5, Address Scanability: YES1, Mail 9, General Delivery: NO1, Address Scanability:
Address Readability: YES3, Address Address: OK2, Return UNSCANNABLE, Address Readability: YES2, Address Address:
address: OK3 OK1, Return address: OK4
Delivering Mail 9 automatically Delivering Mail 9 normally
***** *****
*/ */

View File

@ -15,7 +15,7 @@ public class RandomTest {
} }
} }
/* Output: /* Output:
JUMPING DODGING SITTING RUNNING FLYING RUNNING DODGING STANDING FLYING RUNNING STANDING RUNNING STANDING LYING
STANDING DODGING FALLING FALLING SITTING DODGING LYING DODGING SITTING RUNNING HOPPING HOPPING HOPPING RUNNING
JUMPING JUMPING HOPPING DODGING SITTING FALLING STANDING LYING FALLING RUNNING FLYING LYING
*/ */

View File

@ -81,24 +81,24 @@ public class RoShamBo1 {
} }
} }
/* Output: /* Output:
Scissors vs. Rock: LOSE Rock vs. Rock: DRAW
Paper vs. Rock: WIN
Paper vs. Rock: WIN
Paper vs. Rock: WIN
Scissors vs. Paper: WIN
Scissors vs. Scissors: DRAW
Scissors vs. Paper: WIN Scissors vs. Paper: WIN
Rock vs. Paper: LOSE Rock vs. Paper: LOSE
Rock vs. Rock: DRAW
Rock vs. Paper: LOSE
Paper vs. Scissors: LOSE
Rock vs. Paper: LOSE
Scissors vs. Scissors: DRAW
Scissors vs. Rock: LOSE
Scissors vs. Paper: WIN
Scissors vs. Rock: LOSE
Paper vs. Scissors: LOSE
Rock vs. Rock: DRAW
Scissors vs. Scissors: DRAW
Paper vs. Paper: DRAW Paper vs. Paper: DRAW
Scissors vs. Paper: WIN
Scissors vs. Rock: LOSE
Scissors vs. Paper: WIN
Rock vs. Paper: LOSE Rock vs. Paper: LOSE
Paper vs. Scissors: LOSE
Paper vs. Scissors: LOSE
Rock vs. Scissors: WIN Rock vs. Scissors: WIN
Rock vs. Paper: LOSE
Paper vs. Rock: WIN
Scissors vs. Paper: WIN
Paper vs. Scissors: LOSE
Paper vs. Scissors: LOSE
Paper vs. Scissors: LOSE
Paper vs. Scissors: LOSE
*/ */

View File

@ -31,24 +31,24 @@ public enum RoShamBo2 implements Competitor<RoShamBo2> {
} }
} }
/* Output: /* Output:
PAPER vs. ROCK: WIN ROCK vs. ROCK: DRAW
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
PAPER vs. SCISSORS: LOSE
PAPER vs. PAPER: DRAW
PAPER vs. SCISSORS: LOSE PAPER vs. SCISSORS: LOSE
ROCK vs. SCISSORS: WIN ROCK vs. SCISSORS: WIN
ROCK vs. ROCK: DRAW
ROCK vs. SCISSORS: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. SCISSORS: WIN
PAPER vs. PAPER: DRAW
PAPER vs. ROCK: WIN
PAPER vs. SCISSORS: LOSE
PAPER vs. ROCK: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. ROCK: DRAW
PAPER vs. PAPER: DRAW
SCISSORS vs. SCISSORS: DRAW SCISSORS vs. SCISSORS: DRAW
PAPER vs. SCISSORS: LOSE
PAPER vs. ROCK: WIN
PAPER vs. SCISSORS: LOSE
ROCK vs. SCISSORS: WIN ROCK vs. SCISSORS: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. PAPER: LOSE ROCK vs. PAPER: LOSE
ROCK vs. SCISSORS: WIN
SCISSORS vs. ROCK: LOSE
PAPER vs. SCISSORS: LOSE
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
*/ */

View File

@ -48,24 +48,24 @@ public enum RoShamBo3 implements Competitor<RoShamBo3> {
} }
} }
/* Output: /* Output:
PAPER vs. ROCK: WIN ROCK vs. ROCK: DRAW
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
PAPER vs. SCISSORS: LOSE
PAPER vs. PAPER: DRAW
PAPER vs. SCISSORS: LOSE PAPER vs. SCISSORS: LOSE
ROCK vs. SCISSORS: WIN ROCK vs. SCISSORS: WIN
ROCK vs. ROCK: DRAW
ROCK vs. SCISSORS: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. SCISSORS: WIN
PAPER vs. PAPER: DRAW
PAPER vs. ROCK: WIN
PAPER vs. SCISSORS: LOSE
PAPER vs. ROCK: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. ROCK: DRAW
PAPER vs. PAPER: DRAW
SCISSORS vs. SCISSORS: DRAW SCISSORS vs. SCISSORS: DRAW
PAPER vs. SCISSORS: LOSE
PAPER vs. ROCK: WIN
PAPER vs. SCISSORS: LOSE
ROCK vs. SCISSORS: WIN ROCK vs. SCISSORS: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. PAPER: LOSE ROCK vs. PAPER: LOSE
ROCK vs. SCISSORS: WIN
SCISSORS vs. ROCK: LOSE
PAPER vs. SCISSORS: LOSE
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
*/ */

View File

@ -34,24 +34,24 @@ public enum RoShamBo4 implements Competitor<RoShamBo4> {
} }
} }
/* Output: /* Output:
ROCK vs. PAPER: LOSE PAPER vs. PAPER: DRAW
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. SCISSORS: WIN
ROCK vs. ROCK: DRAW
ROCK vs. SCISSORS: WIN ROCK vs. SCISSORS: WIN
PAPER vs. SCISSORS: LOSE PAPER vs. SCISSORS: LOSE
PAPER vs. PAPER: DRAW
PAPER vs. SCISSORS: LOSE
SCISSORS vs. ROCK: LOSE
PAPER vs. SCISSORS: LOSE
ROCK vs. ROCK: DRAW
ROCK vs. PAPER: LOSE
ROCK vs. SCISSORS: WIN
ROCK vs. PAPER: LOSE
SCISSORS vs. ROCK: LOSE
PAPER vs. PAPER: DRAW
ROCK vs. ROCK: DRAW
SCISSORS vs. SCISSORS: DRAW SCISSORS vs. SCISSORS: DRAW
ROCK vs. SCISSORS: WIN
ROCK vs. PAPER: LOSE
ROCK vs. SCISSORS: WIN
PAPER vs. SCISSORS: LOSE PAPER vs. SCISSORS: LOSE
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
PAPER vs. ROCK: WIN PAPER vs. ROCK: WIN
PAPER vs. SCISSORS: LOSE
SCISSORS vs. PAPER: WIN
ROCK vs. SCISSORS: WIN
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
*/ */

View File

@ -36,24 +36,24 @@ enum RoShamBo5 implements Competitor<RoShamBo5> {
} }
} }
/* Output: /* Output:
PAPER vs. ROCK: WIN ROCK vs. ROCK: DRAW
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
PAPER vs. SCISSORS: LOSE
PAPER vs. PAPER: DRAW
PAPER vs. SCISSORS: LOSE PAPER vs. SCISSORS: LOSE
ROCK vs. SCISSORS: WIN ROCK vs. SCISSORS: WIN
ROCK vs. ROCK: DRAW
ROCK vs. SCISSORS: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. SCISSORS: WIN
PAPER vs. PAPER: DRAW
PAPER vs. ROCK: WIN
PAPER vs. SCISSORS: LOSE
PAPER vs. ROCK: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. ROCK: DRAW
PAPER vs. PAPER: DRAW
SCISSORS vs. SCISSORS: DRAW SCISSORS vs. SCISSORS: DRAW
PAPER vs. SCISSORS: LOSE
PAPER vs. ROCK: WIN
PAPER vs. SCISSORS: LOSE
ROCK vs. SCISSORS: WIN ROCK vs. SCISSORS: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. PAPER: LOSE ROCK vs. PAPER: LOSE
ROCK vs. SCISSORS: WIN
SCISSORS vs. ROCK: LOSE
PAPER vs. SCISSORS: LOSE
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
*/ */

View File

@ -23,24 +23,24 @@ enum RoShamBo6 implements Competitor<RoShamBo6> {
} }
} }
/* Output: /* Output:
PAPER vs. ROCK: WIN ROCK vs. ROCK: DRAW
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
SCISSORS vs. ROCK: LOSE
PAPER vs. SCISSORS: LOSE
PAPER vs. PAPER: DRAW
PAPER vs. SCISSORS: LOSE PAPER vs. SCISSORS: LOSE
ROCK vs. SCISSORS: WIN ROCK vs. SCISSORS: WIN
ROCK vs. ROCK: DRAW
ROCK vs. SCISSORS: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. SCISSORS: WIN
PAPER vs. PAPER: DRAW
PAPER vs. ROCK: WIN
PAPER vs. SCISSORS: LOSE
PAPER vs. ROCK: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. ROCK: DRAW
PAPER vs. PAPER: DRAW
SCISSORS vs. SCISSORS: DRAW SCISSORS vs. SCISSORS: DRAW
PAPER vs. SCISSORS: LOSE
PAPER vs. ROCK: WIN
PAPER vs. SCISSORS: LOSE
ROCK vs. SCISSORS: WIN ROCK vs. SCISSORS: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
ROCK vs. PAPER: LOSE ROCK vs. PAPER: LOSE
ROCK vs. SCISSORS: WIN
SCISSORS vs. ROCK: LOSE
PAPER vs. SCISSORS: LOSE
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
SCISSORS vs. PAPER: WIN
*/ */

View File

@ -33,14 +33,14 @@ enum SecurityCategory {
} }
} }
/* Output: /* Output:
STOCK: MARGIN
STOCK: LONG
STOCK: LONG
STOCK: MARGIN
BOND: MUNICIPAL BOND: MUNICIPAL
BOND: MUNICIPAL BOND: MUNICIPAL
STOCK: LONG STOCK: MARGIN
STOCK: MARGIN
BOND: JUNK BOND: JUNK
STOCK: MARGIN STOCK: SHORT
STOCK: LONG
STOCK: LONG
BOND: MUNICIPAL
BOND: JUNK BOND: JUNK
*/ */

View File

@ -32,6 +32,6 @@ public class EnumImplementation {
} }
} }
/* Output: /* Output:
SILLY, SPANKY, PUNCHY, BOUNCY, BOB, SLAPPY, SLAPPY, BOB, BOB, PUNCHY, BOB, SPANKY, NUTTY, PUNCHY, SLAPPY, NUTTY,
BOB, SLAPPY, NUTTY, SLAPPY,
*/ */

View File

@ -17,29 +17,29 @@ public class Meal {
} }
} }
/* Output: /* Output:
SALAD SPRING_ROLLS
VINDALOO VINDALOO
GELATO FRUIT
CAPPUCCINO DECAF_COFFEE
*** ***
SPRING_ROLLS SOUP
BURRITO VINDALOO
GELATO FRUIT
HERB_TEA
***
SPRING_ROLLS
BURRITO
TIRAMISU
CAPPUCCINO
***
SPRING_ROLLS
BURRITO
BLACK_FOREST_CAKE
LATTE
***
SALAD
PAD_THAI
GELATO
TEA TEA
*** ***
SALAD
BURRITO
FRUIT
TEA
***
SALAD
BURRITO
CREME_CARAMEL
LATTE
***
SOUP
BURRITO
TIRAMISU
ESPRESSO
***
*/ */

View File

@ -46,29 +46,29 @@ public enum Meal2 {
} }
} }
/* Output: /* Output:
SALAD SPRING_ROLLS
VINDALOO VINDALOO
GELATO FRUIT
CAPPUCCINO DECAF_COFFEE
*** ***
SPRING_ROLLS SOUP
BURRITO VINDALOO
GELATO FRUIT
HERB_TEA
***
SPRING_ROLLS
BURRITO
TIRAMISU
CAPPUCCINO
***
SPRING_ROLLS
BURRITO
BLACK_FOREST_CAKE
LATTE
***
SALAD
PAD_THAI
GELATO
TEA TEA
*** ***
SALAD
BURRITO
FRUIT
TEA
***
SALAD
BURRITO
CREME_CARAMEL
LATTE
***
SOUP
BURRITO
TIRAMISU
ESPRESSO
***
*/ */

View File

@ -33,13 +33,13 @@ public class LoggingExceptions {
} }
/* Output: /* Output:
___[ Error Output ]___ ___[ Error Output ]___
Jul 27, 2016 10:50:30 AM LoggingException <init> May 02, 2017 3:21:47 PM LoggingException <init>
SEVERE: LoggingException SEVERE: LoggingException
at at
LoggingExceptions.main(LoggingExceptions.java:20) LoggingExceptions.main(LoggingExceptions.java:20)
Caught LoggingException Caught LoggingException
Jul 27, 2016 10:50:30 AM LoggingException <init> May 02, 2017 3:21:47 PM LoggingException <init>
SEVERE: LoggingException SEVERE: LoggingException
at at
LoggingExceptions.main(LoggingExceptions.java:25) LoggingExceptions.main(LoggingExceptions.java:25)

View File

@ -25,7 +25,7 @@ public class LoggingExceptions2 {
} }
/* Output: /* Output:
___[ Error Output ]___ ___[ Error Output ]___
Jul 27, 2016 10:50:30 AM LoggingExceptions2 logException May 02, 2017 3:21:47 PM LoggingExceptions2 logException
SEVERE: java.lang.NullPointerException SEVERE: java.lang.NullPointerException
at at
LoggingExceptions2.main(LoggingExceptions2.java:17) LoggingExceptions2.main(LoggingExceptions2.java:17)

View File

@ -53,35 +53,35 @@ public class AddAndSubtractPaths {
} }
/* Output: /* Output:
Windows 10 Windows 10
C:\Users\Bruce\Documents\GitHub C:\Users\bruce\Documents\Git
(1)r on- (1)r on-
java\ExtractedExamples\files\AddAndSubtractPaths.java java\ExtractedExamples\files\AddAndSubtractPaths.java
RealPath: C:\Users\Bruce\Documents\GitHub\on- RealPath: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files\AddAndSubtractPaths.java java\ExtractedExamples\files\AddAndSubtractPaths.java
(2)r on-java\ExtractedExamples\strings\..\files (2)r on-java\ExtractedExamples\strings\..\files
RealPath: C:\Users\Bruce\Documents\GitHub\on- RealPath: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files java\ExtractedExamples\files
(3)r on-java\ExtractedExamples\files (3)r on-java\ExtractedExamples\files
RealPath: C:\Users\Bruce\Documents\GitHub\on- RealPath: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files java\ExtractedExamples\files
(4) ..\.. (4) ..\..
RealPath: C:\Users\Bruce\Documents\GitHub\on-java RealPath: C:\Users\bruce\Documents\Git\on-java
(5) ..\.. (5) ..\..
RealPath: C:\Users\Bruce\Documents\GitHub\on-java RealPath: C:\Users\bruce\Documents\Git\on-java
(6)r on-java (6)r on-java
RealPath: C:\Users\Bruce\Documents\GitHub\on-java RealPath: C:\Users\bruce\Documents\Git\on-java
(7)r on-java\ExtractedExamples\files\.\..\.. (7)r on-java\ExtractedExamples\files\.\..\..
RealPath: C:\Users\Bruce\Documents\GitHub\on-java RealPath: C:\Users\bruce\Documents\Git\on-java
(8)r on-java (8)r on-java
RealPath: C:\Users\Bruce\Documents\GitHub\on-java RealPath: C:\Users\bruce\Documents\Git\on-java
(9)r on-java\ExtractedExamples\files (9)r on-java\ExtractedExamples\files
RealPath: C:\Users\Bruce\Documents\GitHub\on- RealPath: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files java\ExtractedExamples\files
(10)r on-java\ExtractedExamples\strings (10)r on-java\ExtractedExamples\strings
RealPath: C:\Users\Bruce\Documents\GitHub\on- RealPath: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\strings java\ExtractedExamples\strings
(11) nonexistent (11) nonexistent
java.nio.file.NoSuchFileException: java.nio.file.NoSuchFileException:
C:\Users\Bruce\Documents\GitHub\on- C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files\nonexistent java\ExtractedExamples\files\nonexistent
*/ */

View File

@ -59,7 +59,7 @@ Nope, that doesn't work.
test\bag test\bag
test\bar test\bar
test\baz test\baz
test\DIR_3697011820450773773 test\DIR_7205037124905635827
test\foo test\foo
test\Hello.txt test\Hello.txt
********* *********
@ -68,27 +68,27 @@ test\bag
test\bag\foo test\bag\foo
test\bag\foo\bar test\bag\foo\bar
test\bag\foo\bar\baz test\bag\foo\bar\baz
test\bag\foo\bar\baz\234245189903117886.tmp test\bag\foo\bar\baz\4584994277735481362.tmp
test\bag\foo\bar\baz\File.txt test\bag\foo\bar\baz\File.txt
test\bar test\bar
test\bar\baz test\bar\baz
test\bar\baz\bag test\bar\baz\bag
test\bar\baz\bag\foo test\bar\baz\bag\foo
test\bar\baz\bag\foo\8752987828022262887.tmp test\bar\baz\bag\foo\4367937361263211140.tmp
test\bar\baz\bag\foo\File.txt test\bar\baz\bag\foo\File.txt
test\baz test\baz
test\baz\bag test\baz\bag
test\baz\bag\foo test\baz\bag\foo
test\baz\bag\foo\bar test\baz\bag\foo\bar
test\baz\bag\foo\bar\465343347528104633.tmp test\baz\bag\foo\bar\7687116918707992631.tmp
test\baz\bag\foo\bar\File.txt test\baz\bag\foo\bar\File.txt
test\DIR_3697011820450773773 test\DIR_7205037124905635827
test\DIR_3697011820450773773\pre3304897437567097054.non test\DIR_7205037124905635827\pre9154379587817312624.non
test\foo test\foo
test\foo\bar test\foo\bar
test\foo\bar\baz test\foo\bar\baz
test\foo\bar\baz\bag test\foo\bar\baz\bag
test\foo\bar\baz\bag\2118206626074637804.tmp test\foo\bar\baz\bag\7686121002327077993.tmp
test\foo\bar\baz\bag\File.txt test\foo\bar\baz\bag\File.txt
test\Hello.txt test\Hello.txt
*/ */

View File

@ -27,15 +27,14 @@ public class FileSystemDemo {
} }
/* Output: /* Output:
Windows 10 Windows 10
File Store: SSD (C:) File Store: Teenyverse (C:)
Root Directory: C:\ Root Directory: C:\
Root Directory: D:\
Separator: \ Separator: \
UserPrincipalLookupService: UserPrincipalLookupService:
sun.nio.fs.WindowsFileSystem$LookupService$1@1db9742 sun.nio.fs.WindowsFileSystem$LookupService$1@15db9742
isOpen: true isOpen: true
isReadOnly: false isReadOnly: false
FileSystemProvider: FileSystemProvider:
sun.nio.fs.WindowsFileSystemProvider@106d69c sun.nio.fs.WindowsFileSystemProvider@6d06d69c
File Attribute Views: [owner, dos, acl, basic, user] File Attribute Views: [owner, dos, acl, basic, user]
*/ */

View File

@ -36,24 +36,24 @@ public class Find {
} }
} }
/* Output: /* Output:
test\bag\foo\bar\baz\369594599218802549.tmp test\bag\foo\bar\baz\7676311745640921113.tmp
test\bag\foo\bar\baz\File.txt test\bag\foo\bar\baz\File.txt
test\bar\baz\bag\foo\2372197258227988384.tmp test\bar\baz\bag\foo\5150002287600428217.tmp
test\bar\baz\bag\foo\File.txt test\bar\baz\bag\foo\File.txt
test\baz\bag\foo\bar\1091363470697614580.tmp test\baz\bag\foo\bar\8782742629206515741.tmp
test\baz\bag\foo\bar\File.txt test\baz\bag\foo\bar\File.txt
test\dir.tmp test\dir.tmp
test\foo\bar\baz\bag\48863440153181406.tmp test\foo\bar\baz\bag\5650574120756265046.tmp
test\foo\bar\baz\bag\File.txt test\foo\bar\baz\bag\File.txt
*************** ***************
369594599218802549.tmp 7676311745640921113.tmp
2372197258227988384.tmp 5150002287600428217.tmp
1091363470697614580.tmp 8782742629206515741.tmp
dir.tmp dir.tmp
48863440153181406.tmp 5650574120756265046.tmp
*************** ***************
369594599218802549.tmp 7676311745640921113.tmp
2372197258227988384.tmp 5150002287600428217.tmp
1091363470697614580.tmp 8782742629206515741.tmp
48863440153181406.tmp 5650574120756265046.tmp
*/ */

View File

@ -25,18 +25,18 @@ public class PartsOfPaths {
/* Output: /* Output:
Windows 10 Windows 10
Users Users
Bruce bruce
Documents Documents
GitHub Git
on-java on-java
ExtractedExamples ExtractedExamples
files files
PartsOfPaths.java PartsOfPaths.java
ends with '.java': false ends with '.java': false
Users: false : false Users: false : false
Bruce: false : false bruce: false : false
Documents: false : false Documents: false : false
GitHub: false : false Git: false : false
on-java: false : false on-java: false : false
ExtractedExamples: false : false ExtractedExamples: false : false
files: false : false files: false : false

View File

@ -48,9 +48,9 @@ Writable: true
notExists: false notExists: false
Hidden: false Hidden: false
size: 1630 size: 1630
FileStore: SSD (C:) FileStore: Teenyverse (C:)
LastModified: : 2016-07-27T15:52:49.898848Z LastModified: : 2017-05-02T21:19:06.828604Z
Owner: MINDVIEWTOSHIBA\Bruce (User) Owner: TEENYVERSE\bruce (User)
ContentType: null ContentType: null
SymbolicLink: false SymbolicLink: false
*/ */

View File

@ -63,40 +63,40 @@ FileName: PathInfo.java
Parent: null Parent: null
Root: null Root: null
---------------- ----------------
toString: C:\Users\Bruce\Documents\GitHub\on- toString: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files\PathInfo.java java\ExtractedExamples\files\PathInfo.java
Exists: true Exists: true
RegularFile: true RegularFile: true
Directory: false Directory: false
Absolute: true Absolute: true
FileName: PathInfo.java FileName: PathInfo.java
Parent: C:\Users\Bruce\Documents\GitHub\on- Parent: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files java\ExtractedExamples\files
Root: C:\ Root: C:\
---------------- ----------------
toString: C:\Users\Bruce\Documents\GitHub\on- toString: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files java\ExtractedExamples\files
Exists: true Exists: true
RegularFile: false RegularFile: false
Directory: true Directory: true
Absolute: true Absolute: true
FileName: files FileName: files
Parent: C:\Users\Bruce\Documents\GitHub\on- Parent: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples java\ExtractedExamples
Root: C:\ Root: C:\
---------------- ----------------
toString: C:\Users\Bruce\Documents\GitHub\on- toString: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files\PathInfo.java java\ExtractedExamples\files\PathInfo.java
Exists: true Exists: true
RegularFile: true RegularFile: true
Directory: false Directory: false
Absolute: true Absolute: true
FileName: PathInfo.java FileName: PathInfo.java
Parent: C:\Users\Bruce\Documents\GitHub\on- Parent: C:\Users\bruce\Documents\Git\on-
java\ExtractedExamples\files java\ExtractedExamples\files
Root: C:\ Root: C:\
---------------- ----------------
URI: file:///C:/Users/Bruce/Documents/GitHub/on- URI: file:///C:/Users/bruce/Documents/Git/on-
java/ExtractedExamples/files/PathInfo.java java/ExtractedExamples/files/PathInfo.java
true true
*/ */

View File

@ -2,6 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand}
import java.io.IOException; import java.io.IOException;
import java.nio.file.*; import java.nio.file.*;
import static java.nio.file.StandardWatchEventKinds.*; import static java.nio.file.StandardWatchEventKinds.*;
@ -47,7 +48,4 @@ deleting test\bar\baz\bag\foo\File.txt
evt.context(): File.txt evt.context(): File.txt
evt.count(): 1 evt.count(): 1
evt.kind(): ENTRY_DELETE evt.kind(): ENTRY_DELETE
evt.context(): File.txt
evt.count(): 1
evt.kind(): ENTRY_DELETE
*/ */

View File

@ -60,6 +60,6 @@ public class DynamicProxyMixin {
} }
/* Output: /* Output:
Hello Hello
1469638238271 1493760122461
1 1
*/ */

View File

@ -16,8 +16,8 @@ public class GenericReading {
Fruit f = readExact(fruit); Fruit f = readExact(fruit);
f = readExact(apples); f = readExact(apples);
} }
// If you have a class, its type is // A class type is established
// established when the class is instantiated: // when the class is instantiated:
static class Reader<T> { static class Reader<T> {
T readExact(List<T> list) { return list.get(0); } T readExact(List<T> list) { return list.get(0); }
} }

View File

@ -64,6 +64,6 @@ public class Mixins {
} }
} }
/* Output: /* Output:
test string 1 1469638250315 1 test string 1 1493760126621 1
test string 2 1469638250317 2 test string 2 1493760126621 2
*/ */

View File

@ -18,6 +18,6 @@ extends ArrayList<Tuple4<A, B, C, D>> {
} }
} }
/* Output: /* Output:
(Vehicle@107d329, Amphibian@1629346, hi, 47) (Vehicle@214c265e, Amphibian@448139f0, hi, 47)
(Vehicle@4b9385, Amphibian@1311334, hi, 47) (Vehicle@7cca494b, Amphibian@7ba4f24f, hi, 47)
*/ */

View File

@ -35,7 +35,7 @@ public class TupleTest {
} }
/* Output: /* Output:
(hi, 47) (hi, 47)
(Amphibian@1c7c054, hi, 47) (Amphibian@4554617c, hi, 47)
(Vehicle@14991ad, Amphibian@d93b30, hi, 47) (Vehicle@677327b6, Amphibian@14ae5a5, hi, 47)
(Vehicle@a14482, Amphibian@140e19d, hi, 47, 11.1) (Vehicle@135fbaa4, Amphibian@45ee12a7, hi, 47, 11.1)
*/ */

View File

@ -35,7 +35,7 @@ public class TupleTest2 {
/* Output: /* Output:
(hi, 47) (hi, 47)
(hi, 47) (hi, 47)
(Amphibian@a298b7, hi, 47) (Amphibian@1540e19d, hi, 47)
(Vehicle@16d3586, Amphibian@154617c, hi, 47) (Vehicle@7f31245a, Amphibian@6d6f6e28, hi, 47)
(Vehicle@17327b6, Amphibian@14ae5a5, hi, 47, 11.1) (Vehicle@330bedb4, Amphibian@2503dbd3, hi, 47, 11.1)
*/ */

View File

@ -35,19 +35,19 @@ COBALT_BLUE_HUE, PERMANENT_GREEN, VIRIDIAN_HUE]
set2: [CERULEAN_BLUE_HUE, PHTHALO_BLUE, ULTRAMARINE, set2: [CERULEAN_BLUE_HUE, PHTHALO_BLUE, ULTRAMARINE,
COBALT_BLUE_HUE, PERMANENT_GREEN, VIRIDIAN_HUE, SAP_GREEN, COBALT_BLUE_HUE, PERMANENT_GREEN, VIRIDIAN_HUE, SAP_GREEN,
YELLOW_OCHRE, BURNT_SIENNA, RAW_UMBER, BURNT_UMBER] YELLOW_OCHRE, BURNT_SIENNA, RAW_UMBER, BURNT_UMBER]
union(set1, set2): [MAGENTA, COBALT_BLUE_HUE, VIOLET, union(set1, set2): [BURNT_UMBER, MAGENTA, RAW_UMBER,
VIRIDIAN_HUE, BURNT_SIENNA, ULTRAMARINE, CERULEAN_BLUE_HUE, VIOLET, BURNT_SIENNA, ULTRAMARINE, CRIMSON,
BURNT_UMBER, BRILLIANT_RED, PHTHALO_BLUE, YELLOW_OCHRE, PERMANENT_GREEN, YELLOW_OCHRE, BRILLIANT_RED, PHTHALO_BLUE,
SAP_GREEN, CRIMSON, ROSE_MADDER, RAW_UMBER, CERULEAN_BLUE_HUE, SAP_GREEN, COBALT_BLUE_HUE, ROSE_MADDER,
PERMANENT_GREEN] VIRIDIAN_HUE]
intersection(set1, set2): [COBALT_BLUE_HUE, VIRIDIAN_HUE, intersection(set1, set2): [ULTRAMARINE, PERMANENT_GREEN,
ULTRAMARINE, CERULEAN_BLUE_HUE, PHTHALO_BLUE, PHTHALO_BLUE, COBALT_BLUE_HUE, CERULEAN_BLUE_HUE,
PERMANENT_GREEN] VIRIDIAN_HUE]
difference(set1, subset): [CRIMSON, MAGENTA, VIOLET, difference(set1, subset): [MAGENTA, VIOLET, CRIMSON,
ROSE_MADDER, BRILLIANT_RED] BRILLIANT_RED, ROSE_MADDER]
difference(set2, subset): [BURNT_SIENNA, BURNT_UMBER, difference(set2, subset): [SAP_GREEN, BURNT_UMBER,
YELLOW_OCHRE, RAW_UMBER, SAP_GREEN] RAW_UMBER, BURNT_SIENNA, YELLOW_OCHRE]
complement(set1, set2): [MAGENTA, VIOLET, BURNT_SIENNA, complement(set1, set2): [BURNT_UMBER, MAGENTA, RAW_UMBER,
BURNT_UMBER, BRILLIANT_RED, YELLOW_OCHRE, SAP_GREEN, VIOLET, BURNT_SIENNA, CRIMSON, YELLOW_OCHRE, BRILLIANT_RED,
CRIMSON, ROSE_MADDER, RAW_UMBER] SAP_GREEN, ROSE_MADDER]
*/ */

1
gg.bat
View File

@ -1 +0,0 @@
gradlew --console plain %*

View File

@ -25,6 +25,6 @@ public class NewVarArgs {
47 3.14 11.11 47 3.14 11.11
47 3.14 11.11 47 3.14 11.11
one two three one two three
A@1db9742 A@106d69c A@52e922 A@15db9742 A@6d06d69c A@7852e922
1 2 3 4 1 2 3 4
*/ */

View File

@ -22,5 +22,5 @@ public class VarArgs {
/* Output: /* Output:
47 3.14 11.11 47 3.14 11.11
one two three one two three
A@1db9742 A@106d69c A@52e922 A@15db9742 A@6d06d69c A@7852e922
*/ */

View File

@ -44,6 +44,6 @@ IF SHE WEIGHS THE SAME AS A DUCK, SHE'S MADE OF WOOD
Using Processor Downcase Using Processor Downcase
if she weighs the same as a duck, she's made of wood if she weighs the same as a duck, she's made of wood
Using Processor Splitter Using Processor Splitter
[If, she, weighs, the, same, as, a, duck,, she's, made, [If, she, weighs, the, same, as, a, duck,, she's, made, of,
of, wood] wood]
*/ */

View File

@ -22,5 +22,5 @@ public class HelloDateDoc {
} }
/* Output: /* Output:
Hello, it's: Hello, it's:
Wed Jul 27 10:50:45 MDT 2016 Tue May 02 15:22:28 MDT 2017
*/ */

View File

@ -4,6 +4,7 @@
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// Locks in the concurrent library allow you // Locks in the concurrent library allow you
// to give up on trying to acquire a lock // to give up on trying to acquire a lock
// {ValidateByHand} AppVeyor CI has trouble
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.locks.*; import java.util.concurrent.locks.*;
import onjava.Nap; import onjava.Nap;

View File

@ -70,14 +70,11 @@ public class DelayQueueDemo {
} }
} }
/* Output: /* Output:
[128] Task 12 [429] Task 6 [551] Task 13 [128] Task 12 [429] Task 6 [551] Task 13 [555] Task 2 [693]
[555] Task 2 [693] Task 3 [809] Task 15 Task 3 [809] Task 15 [961] Task 5 [1258] Task 1 [1258] Task
[961] Task 5 [1258] Task 1 [1258] Task 20 20 [1520] Task 19 [1861] Task 4 [1998] Task 17 [2200] Task
[1520] Task 19 [1861] Task 4 [1998] T 8 [2207] Task 10 [2288] Task 11 [2522] Task 9 [2589] Task
ask 17 [2200] Task 8 [2207] Task 10 [2288] 14 [2861] Task 18 [2868] Task 7 [3278] Task 16 (0:4000)
Task 11 [2522] Task 9 [2589] Task 14
[2861] Task 18 [2868] Task 7 [3278]
Task 16 (0:4000)
(1:1258) (1:1258)
(2:555) (2:555)
(3:693) (3:693)

View File

@ -3,6 +3,7 @@
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// When threads collide // When threads collide
// {ValidateByHand}
public class EvenProducer extends IntGenerator { public class EvenProducer extends IntGenerator {
private int currentEvenValue = 0; private int currentEvenValue = 0;
@ -17,10 +18,6 @@ public class EvenProducer extends IntGenerator {
} }
} }
/* Output: /* Output:
1563 not even! 303 not even!
1573 not even! 301 not even!
1571 not even!
1569 not even!
1567 not even!
1565 not even!
*/ */

View File

@ -10,5 +10,5 @@ public class NumberOfProcessors {
} }
} }
/* Output: /* Output:
8 4
*/ */

View File

@ -98,38 +98,38 @@ public class PriorityBlockingQueueDemo {
} }
} }
/* Output: /* Output:
[15] Prioritized 1 [17] Prioritized 2
[17] Prioritized 0 [18] Prioritized 26
[17] Prioritized 5 [17] Prioritized 5
[16] Prioritized 6 [16] Prioritized 6
[14] Prioritized 9
[12] Prioritized 2
[11] Prioritized 4
[11] Prioritized 12
[13] Prioritized 13
[12] Prioritized 16
[14] Prioritized 18
[15] Prioritized 23
[18] Prioritized 26
[16] Prioritized 29 [16] Prioritized 29
[15] Prioritized 1
[15] Prioritized 23
[14] Prioritized 9
[14] Prioritized 18
[13] Prioritized 13
[12] Prioritized 17 [12] Prioritized 17
[11] Prioritized 30 [12] Prioritized 0
[12] Prioritized 16
[11] Prioritized 12
[11] Prioritized 24 [11] Prioritized 24
[11] Prioritized 4
[11] Prioritized 30
[10] Prioritized 15 [10] Prioritized 15
[10] Prioritized 22 [10] Prioritized 22
[8] Prioritized 25
[8] Prioritized 11 [8] Prioritized 11
[8] Prioritized 10 [8] Prioritized 10
[8] Prioritized 25
[6] Prioritized 31 [6] Prioritized 31
[3] Prioritized 7 [3] Prioritized 7
[2] Prioritized 20 [2] Prioritized 20
[1] Prioritized 3 [1] Prioritized 3
[0] Prioritized 14
[0] Prioritized 19 [0] Prioritized 19
[0] Prioritized 8 [0] Prioritized 8
[0] Prioritized 14
[0] Prioritized 21 [0] Prioritized 21
[-1] Prioritized 28 [-1] Prioritized 28
(0:17)(2:12)(1:15)(3:1)(4:11) (1:15)(0:12)(2:17)(3:1)(4:11)
(5:17)(6:16)(7:3)(8:0)(9:14) (5:17)(6:16)(7:3)(8:0)(9:14)
(10:8)(11:8)(12:11)(13:13)(14:0) (10:8)(11:8)(12:11)(13:13)(14:0)
(15:10)(16:12)(17:12)(18:14)(19:0) (15:10)(16:12)(17:12)(18:14)(19:0)

View File

@ -9,5 +9,5 @@ public class SerialNumberTest {
} }
} }
/* Output: /* Output:
Duplicate: 4119 Duplicate: 4687
*/ */

View File

@ -78,12 +78,12 @@ public class SynchronizedComparison {
/* Output: /* Output:
-> 152 -> 152
-> 152 -> 152
-> 153 -> 152
-> 153 -> 150
CriticalSection: 610 CriticalSection: 606
-> 44 -> 72
-> 28
-> 62
-> 24 -> 24
SynchronizedMethod: 158 -> 70
-> 164
SynchronizedMethod: 330
*/ */

View File

@ -13,5 +13,5 @@ public class TestAbort {
} }
/* Output: /* Output:
Napping for 4 Napping for 4
TimedAbort 1 TimedAbort 1.0
*/ */

View File

@ -16,5 +16,5 @@ public class UnsafeReturn extends IntTestable {
} }
} }
/* Output: /* Output:
failed with: 21 failed with: 3
*/ */

View File

@ -27,15 +27,15 @@ public class WorkStealingPool {
} }
} }
/* Output: /* Output:
8 4
ForkJoinPool-1-worker-1
ForkJoinPool-1-worker-2
ForkJoinPool-1-worker-1
ForkJoinPool-1-worker-1
ForkJoinPool-1-worker-4
ForkJoinPool-1-worker-1 ForkJoinPool-1-worker-1
ForkJoinPool-1-worker-3 ForkJoinPool-1-worker-3
ForkJoinPool-1-worker-5
ForkJoinPool-1-worker-4
ForkJoinPool-1-worker-2 ForkJoinPool-1-worker-2
ForkJoinPool-1-worker-2
ForkJoinPool-1-worker-2
ForkJoinPool-1-worker-2
ForkJoinPool-1-worker-2
ForkJoinPool-1-worker-2
ForkJoinPool-1-worker-3
ForkJoinPool-1-worker-1
*/ */

View File

@ -3,7 +3,7 @@
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// Displays Charsets and aliases // Displays Charsets and aliases
// {ValidateByHand} // CI has trouble // {ValidateByHand} CI has trouble
import java.nio.charset.*; import java.nio.charset.*;
import java.util.*; import java.util.*;

View File

@ -135,10 +135,10 @@ public class MappedIO {
} }
} }
/* Output: /* Output:
Stream Write: 0.269 Stream Write: 0.285
Mapped Write: 0.022 Mapped Write: 0.022
Stream Read: 0.262 Stream Read: 0.311
Mapped Read: 0.010 Mapped Read: 0.009
Stream Read/Write: 1.620 Stream Read/Write: 1.368
Mapped Read/Write: 0.007 Mapped Read/Write: 0.005
*/ */

View File

@ -14,13 +14,13 @@ public class ShowProperties {
/* Output: (First 20 Lines) /* Output: (First 20 Lines)
-- listing properties -- -- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=C:\Program Files sun.boot.library.path=C:\Program
(x86)\Java\jdk1.8.0_... Files\Java\jdk1.8.0_102\jr...
java.vm.version=25.102-b14 java.vm.version=25.102-b14
java.vm.vendor=Oracle Corporation java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/ java.vendor.url=http://java.oracle.com/
path.separator=; path.separator=;
java.vm.name=Java HotSpot(TM) Client VM java.vm.name=Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg=sun.io file.encoding.pkg=sun.io
user.script= user.script=
user.country=US user.country=US
@ -28,12 +28,11 @@ sun.java.launcher=SUN_STANDARD
sun.os.patch.level= sun.os.patch.level=
java.vm.specification.name=Java Virtual Machine java.vm.specification.name=Java Virtual Machine
Specification Specification
user.dir=C:\Users\Bruce\Documents\GitHub\on-ja... user.dir=C:\Users\bruce\Documents\Git\on-java\...
java.runtime.version=1.8.0_102-b14 java.runtime.version=1.8.0_102-b14
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files java.endorsed.dirs=C:\Program Files\Java\jdk1.8.0_102\jr...
(x86)\Java\jdk1.8.0_... os.arch=amd64
os.arch=x86 java.io.tmpdir=C:\Users\bruce\AppData\Local\Temp\
java.io.tmpdir=C:\Users\Bruce\AppData\Local\Temp\
... ...
*/ */

View File

@ -113,63 +113,63 @@ onjava.BasicSupplier
onjava.CollectionMethodDifferences onjava.CollectionMethodDifferences
onjava.ConvertTo onjava.ConvertTo
onjava.Count$Boolean onjava.Count$Boolean
onjava.Count$Pboolean
onjava.Count$Byte onjava.Count$Byte
onjava.Count$Pbyte
onjava.Count$Character onjava.Count$Character
onjava.Count$Pchar
onjava.Count$Double onjava.Count$Double
onjava.Count$Pdouble
onjava.Count$Float onjava.Count$Float
onjava.Count$Pfloat
onjava.Count$Integer onjava.Count$Integer
onjava.Count$Pint
onjava.Count$Long onjava.Count$Long
onjava.Count$Pboolean
onjava.Count$Pbyte
onjava.Count$Pchar
onjava.Count$Pdouble
onjava.Count$Pfloat
onjava.Count$Pint
onjava.Count$Plong onjava.Count$Plong
onjava.Count$Short
onjava.Count$Pshort onjava.Count$Pshort
onjava.Count$Short
onjava.Count onjava.Count
onjava.CountingIntegerList onjava.CountingIntegerList
onjava.CountMap onjava.CountMap
onjava.Countries onjava.Countries
onjava.Enums onjava.Enums
onjava.FillMap onjava.FillMap
onjava.Hex onjava.HTMLColors
onjava.MouseClick onjava.MouseClick
onjava.Nap
onjava.Null onjava.Null
onjava.Operation onjava.Operations
onjava.OSExecute onjava.OSExecute
onjava.OSExecuteException onjava.OSExecuteException
onjava.Pair onjava.Pair
onjava.ProcessFiles$Strategy onjava.ProcessFiles$Strategy
onjava.ProcessFiles onjava.ProcessFiles
onjava.Rand$Boolean onjava.Rand$Boolean
onjava.Rand$Pboolean
onjava.Rand$Byte onjava.Rand$Byte
onjava.Rand$Pbyte
onjava.Rand$Character onjava.Rand$Character
onjava.Rand$Pchar
onjava.Rand$Double onjava.Rand$Double
onjava.Rand$Pdouble
onjava.Rand$Float onjava.Rand$Float
onjava.Rand$Pfloat
onjava.Rand$Integer onjava.Rand$Integer
onjava.Rand$Pint
onjava.Rand$Long onjava.Rand$Long
onjava.Rand$Pboolean
onjava.Rand$Pbyte
onjava.Rand$Pchar
onjava.Rand$Pdouble
onjava.Rand$Pfloat
onjava.Rand$Pint
onjava.Rand$Plong onjava.Rand$Plong
onjava.Rand$Short
onjava.Rand$Pshort onjava.Rand$Pshort
onjava.Rand$Short
onjava.Rand$String onjava.Rand$String
onjava.Rand onjava.Rand
onjava.Range onjava.Range
onjava.Repeat onjava.Repeat
onjava.RmDir onjava.RmDir
onjava.Sets onjava.Sets
onjava.Sleep
onjava.Stack onjava.Stack
onjava.Suppliers onjava.Suppliers
onjava.TimedAbort onjava.TimedAbort
onjava.TimeIt onjava.Timer
onjava.Tuple onjava.Tuple
onjava.Tuple2 onjava.Tuple2
onjava.Tuple3 onjava.Tuple3

View File

@ -12,6 +12,6 @@ public class Equivalence {
} }
} }
/* Output: /* Output:
false
true true
false
*/ */

Some files were not shown because too many files have changed in this diff Show More