Skip to content

十三章修改语句拗口问题 #630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d88c904
1
Nov 19, 2020
6739439
Merge pull request #1 from LingCoder/master
andyphone Nov 24, 2020
ec2e1fa
2
Nov 24, 2020
c3373df
Merge branch 'master' of github.com:andyphone/OnJava8
Nov 24, 2020
7fbae68
没有第三种形式吧?
Nov 24, 2020
94afe9c
Merge pull request #2 from LingCoder/master
andyphone Nov 25, 2020
84e298c
修改语句拗口问题
Nov 25, 2020
429c653
修改语句拗口问题 2
Nov 25, 2020
34e5908
修改语句拗口问题 3
Nov 25, 2020
b027cf3
修改语句拗口问题 4
Nov 26, 2020
a183c0b
Merge pull request #3 from LingCoder/master
andyphone Nov 26, 2020
7ddf47f
修改语句拗口问题 5
Nov 26, 2020
57e0635
Merge branch 'master' of github.com:LingCoder/OnJava8
Nov 27, 2020
82aedb0
修改语句拗口问题 6
Nov 27, 2020
07231d7
修改语句拗口问题 7
Nov 27, 2020
b0d16e7
修改语句拗口问题 8
Nov 27, 2020
95a4cbb
修改语句拗口问题 9
Nov 27, 2020
826b9a2
拗口问题
andyphone Nov 29, 2020
ff9d336
修改语句拗口问题 10
Nov 30, 2020
a65ebda
Merge branch 'master' into master
andyphone Nov 30, 2020
446e2bd
修改语句拗口问题 11
Dec 1, 2020
e3e0f50
修改语句拗口问题 12
Dec 1, 2020
49dd428
修改语句拗口问题 13
Dec 1, 2020
25992cf
修改语句拗口问题 14
andyphone Dec 1, 2020
19d6135
Merge branch 'master' into master
andyphone Dec 1, 2020
1633ffd
修改语句拗口问题 14
Dec 2, 2020
8d1651b
修改语句拗口问题 15
Dec 3, 2020
1149eca
Merge pull request #4 from LingCoder/master
andyphone Dec 3, 2020
a4d14cc
修改语句拗口问题 16
Dec 3, 2020
1b97c98
修改语句拗口问题 17
Dec 4, 2020
952b2ff
十三章修改语句拗口问题
andyphone Dec 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Next Next commit
1
  • Loading branch information
jim.deng committed Nov 19, 2020
commit d88c9042d8fb6b7fecad67ac0fd325ecacc08f73
17 changes: 17 additions & 0 deletions code/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
111 changes: 111 additions & 0 deletions code/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

*.class
*output.txt
Generated.txt
*-control.txt
*-results.txt
*-out.txt
OutputErrors.txt
report.txt
failures
People.xml
annotations/Test0.txt
annotations/Test1.txt
annotations/Test2.txt
io/*.out
io/*.txt
io/*.dat
io/*.tmp
io/test.zip
io/test.gz
io/X.file
*.pyc

*.out
*.err
/files/bytes.dat
/files/test/
/exceptions/Results.txt
/files/Cheese.txt
/files/StreamInAndOut.txt

.gradle
/*.iml
/.idea/

/serialization/Blip3.serialized
/serialization/Blips.serialized

build/
buildSrc/

/compression/test.gz
/compression/test.zip
/iostreams/BasicFileOutput.dat
/iostreams/Data.txt
/iostreams/FileOutputShortcut.dat
/iostreams/rtest.dat
/logging/LogToFile.xml
/logging/LogToFile2.txt
/logging/MultipleHandlers.xml
/logging/MultipleHandlers2.xml
/logging/java0.log
/logging/java1.log
/logging/java2.log
/newio/TransferTo.txt
/newio/data2.txt
/newio/file.txt
/newio/test.dat
/newio/test.txt
/serialization/CADState.dat
/serialization/worm.dat
/serialization/Logon.dat
/serialization/X.file
/standardio/Redirecting.txt
/threads/PSP2.txt
/threads/primes.txt
_*
config.py
8 changes: 8 additions & 0 deletions code/.travisXX.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: java
jdk:
- oraclejdk11
install: true
script:
- ./gradlew --no-daemon --stacktrace run
# - ./gradlew --parallel --stacktrace run
# - ./gradlew --parallel --stacktrace :validating:jmh
5 changes: 5 additions & 0 deletions code/CI.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Links formerly in the README. Both of these mysteriously started breaking.

[![](https://travis-ci.org/BruceEckel/OnJava8-Examples.svg?branch=master)](https://travis-ci.org/BruceEckel/OnJava8-Examples)

[![](https://ci.appveyor.com/api/projects/status/github/BruceEckel/OnJava8-Examples)](https://ci.appveyor.com/project/BruceEckel/onjava-examples)
72 changes: 72 additions & 0 deletions code/Copyright.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright.txt
This computer source code is Copyright �2020 MindView LLC.
All Rights Reserved.

Permission to use, copy, modify, and distribute this
computer source code (Source Code) and its documentation
without fee and without a written agreement for the
purposes set forth below is hereby granted, provided that
the above copyright notice, this paragraph and the
following five numbered paragraphs appear in all copies.

1. Permission is granted to compile the Source Code and to
include the compiled code, in executable format only, in
personal and commercial software programs.

2. Permission is granted to use the Source Code without
modification in classroom situations, including in
presentation materials, provided that the book "On
Java 8" is cited as the origin.

3. Permission to incorporate the Source Code into printed
media may be obtained by contacting:

MindView LLC, PO Box 969, Crested Butte, CO 81224
MindViewInc@gmail.com

4. The Source Code and documentation are copyrighted by
MindView LLC. The Source code is provided without express
or implied warranty of any kind, including any implied
warranty of merchantability, fitness for a particular
purpose or non-infringement. MindView LLC does not
warrant that the operation of any program that includes the
Source Code will be uninterrupted or error-free. MindView
LLC makes no representation about the suitability of the
Source Code or of any software that includes the Source
Code for any purpose. The entire risk as to the quality
and performance of any program that includes the Source
Code is with the user of the Source Code. The user
understands that the Source Code was developed for research
and instructional purposes and is advised not to rely
exclusively for any reason on the Source Code or any
program that includes the Source Code. Should the Source
Code or any resulting software prove defective, the user
assumes the cost of all necessary servicing, repair, or
correction.

5. IN NO EVENT SHALL MINDVIEW LLC, OR ITS PUBLISHER BE
LIABLE TO ANY PARTY UNDER ANY LEGAL THEORY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
INCLUDING LOST PROFITS, BUSINESS INTERRUPTION, LOSS OF
BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS, OR FOR
PERSONAL INJURIES, ARISING OUT OF THE USE OF THIS SOURCE
CODE AND ITS DOCUMENTATION, OR ARISING OUT OF THE INABILITY
TO USE ANY RESULTING PROGRAM, EVEN IF MINDVIEW LLC, OR
ITS PUBLISHER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. MINDVIEW LLC SPECIFICALLY DISCLAIMS ANY
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE SOURCE CODE AND DOCUMENTATION PROVIDED
HEREUNDER IS ON AN "AS IS" BASIS, WITHOUT ANY ACCOMPANYING
SERVICES FROM MINDVIEW LLC, AND MINDVIEW LLC HAS NO
OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
ENHANCEMENTS, OR MODIFICATIONS.

Please note that MindView LLC maintains a Web site which
is the sole distribution point for electronic copies of the
Source Code, https://github.com/BruceEckel/OnJava8-examples,
where it is freely available under the terms stated above.

If you think you've found an error in the Source Code,
please submit a correction at:
https://github.com/BruceEckel/OnJava8-examples/issues
43 changes: 43 additions & 0 deletions code/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Example Source Code for the Book "On Java 8" by Bruce Eckel

Download release from [here](https://github.com/BruceEckel/OnJava8-Examples/releases/tag/v1.0).

To compile and run these programs, you only need JDK 8 installed.
Invoking `gradlew` will automatically download and install Gradle.
Gradle will also install all additional libraries necessary to compile
and run the Java examples in the book.

To compile and run everything, the command is:

`gradlew run`

If you are on a Unix/Linux based system, you must select the local directory for all commands, for example:

`./gradlew run`

To only compile everything, the command is:

`gradlew compileJava`

To compile only a single chapter (including dependencies), use for example:

`gradlew :strings:compileJava`

To run only a single chapter, say:

`gradlew :strings:run`

Gradle can also be used to run a single program. Here, we run the **ReplacingStringTokenizer.java**
program in the **strings** chapter subdirectory:

`gradlew :strings:ReplacingStringTokenizer`

However, if the file name is unique throughout the book (the majority are), you can just give the
program name, like this:

`gradlew ReplacingStringTokenizer`

Note that all commands are run from the base directory where the example code is installed, and where you find the
`gradlew` script.

You can learn about other options by just typing `gradlew` with no arguments.
30 changes: 30 additions & 0 deletions code/annotations/AUComposition.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// annotations/AUComposition.java
// (c)2020 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// Creating non-embedded tests
// {java onjava.atunit.AtUnit
// build/classes/java/main/annotations/AUComposition.class}
package annotations;
import onjava.atunit.*;
import onjava.*;

public class AUComposition {
AtUnitExample1 testObject = new AtUnitExample1();
@Test
boolean tMethodOne() {
return testObject.methodOne()
.equals("This is methodOne");
}
@Test
boolean tMethodTwo() {
return testObject.methodTwo() == 2;
}
}
/* Output:
annotations.AUComposition
. tMethodTwo This is methodTwo

. tMethodOne
OK (2 tests)
*/
29 changes: 29 additions & 0 deletions code/annotations/AUExternalTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// annotations/AUExternalTest.java
// (c)2020 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// Creating non-embedded tests
// {java onjava.atunit.AtUnit
// build/classes/java/main/annotations/AUExternalTest.class}
package annotations;
import onjava.atunit.*;
import onjava.*;

public class
AUExternalTest extends AtUnitExample1 {
@Test
boolean tMethodOne() {
return methodOne().equals("This is methodOne");
}
@Test
boolean tMethodTwo() {
return methodTwo() == 2;
}
}
/* Output:
annotations.AUExternalTest
. tMethodOne
. tMethodTwo This is methodTwo

OK (2 tests)
*/
48 changes: 48 additions & 0 deletions code/annotations/AtUnitExample1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// annotations/AtUnitExample1.java
// (c)2020 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// {java onjava.atunit.AtUnit
// build/classes/java/main/annotations/AtUnitExample1.class}
package annotations;
import onjava.atunit.*;
import onjava.*;

public class AtUnitExample1 {
public String methodOne() {
return "This is methodOne";
}
public int methodTwo() {
System.out.println("This is methodTwo");
return 2;
}
@Test
boolean methodOneTest() {
return methodOne().equals("This is methodOne");
}
@Test
boolean m2() { return methodTwo() == 2; }
@Test
private boolean m3() { return true; }
// Shows output for failure:
@Test
boolean failureTest() { return false; }
@Test
boolean anotherDisappointment() {
return false;
}
}
/* Output:
annotations.AtUnitExample1
. m3
. methodOneTest
. m2 This is methodTwo

. failureTest (failed)
. anotherDisappointment (failed)
(5 tests)

>>> 2 FAILURES <<<
annotations.AtUnitExample1: failureTest
annotations.AtUnitExample1: anotherDisappointment
*/
Loading