New chapters, renamed chapters

This commit is contained in:
Bruce Eckel 2015-11-14 16:18:05 -08:00
parent bc0026c3e1
commit 8279efc16c
986 changed files with 1193 additions and 99 deletions

View File

@ -1,4 +1,5 @@
// HelloDate.java // HelloDate.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.*; import java.util.*;
public class HelloDate { public class HelloDate {

View File

@ -1,4 +1,5 @@
// annotations/AtUnitComposition.java // annotations/AtUnitComposition.java
// ©2016 MindView LLC: see Copyright.txt
// Creating non-embedded tests. // Creating non-embedded tests.
package annotations; package annotations;
import com.mindviewinc.atunit.*; import com.mindviewinc.atunit.*;

View File

@ -1,4 +1,5 @@
// annotations/AtUnitExample1.java // annotations/AtUnitExample1.java
// ©2016 MindView LLC: see Copyright.txt
package annotations; package annotations;
import com.mindviewinc.atunit.*; import com.mindviewinc.atunit.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// annotations/AtUnitExample2.java // annotations/AtUnitExample2.java
// ©2016 MindView LLC: see Copyright.txt
// Assertions and exceptions can be used in @Tests. // Assertions and exceptions can be used in @Tests.
package annotations; package annotations;
import java.io.*; import java.io.*;

View File

@ -1,4 +1,5 @@
// annotations/AtUnitExample3.java // annotations/AtUnitExample3.java
// ©2016 MindView LLC: see Copyright.txt
package annotations; package annotations;
import com.mindviewinc.atunit.*; import com.mindviewinc.atunit.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// annotations/AtUnitExample4.java // annotations/AtUnitExample4.java
// ©2016 MindView LLC: see Copyright.txt
package annotations; package annotations;
import java.util.*; import java.util.*;
import com.mindviewinc.atunit.*; import com.mindviewinc.atunit.*;

View File

@ -1,4 +1,5 @@
// annotations/AtUnitExample5.java // annotations/AtUnitExample5.java
// ©2016 MindView LLC: see Copyright.txt
package annotations; package annotations;
import java.io.*; import java.io.*;
import com.mindviewinc.atunit.*; import com.mindviewinc.atunit.*;

View File

@ -1,4 +1,5 @@
// annotations/AtUnitExternalTest.java // annotations/AtUnitExternalTest.java
// ©2016 MindView LLC: see Copyright.txt
// Creating non-embedded tests. // Creating non-embedded tests.
package annotations; package annotations;
import com.mindviewinc.atunit.*; import com.mindviewinc.atunit.*;

View File

@ -1,4 +1,5 @@
// annotations/HashSetTest.java // annotations/HashSetTest.java
// ©2016 MindView LLC: see Copyright.txt
package annotations; package annotations;
import java.util.*; import java.util.*;
import com.mindviewinc.atunit.*; import com.mindviewinc.atunit.*;

View File

@ -1,4 +1,5 @@
// annotations/PasswordUtils.java // annotations/PasswordUtils.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.*; import java.util.*;
public class PasswordUtils { public class PasswordUtils {

View File

@ -1,4 +1,5 @@
// annotations/SimulatingNull.java // annotations/SimulatingNull.java
// ©2016 MindView LLC: see Copyright.txt
import java.lang.annotation.*; import java.lang.annotation.*;
@Target(ElementType.METHOD) @Target(ElementType.METHOD)

View File

@ -1,4 +1,5 @@
// annotations/StackL.java // annotations/StackL.java
// ©2016 MindView LLC: see Copyright.txt
// A stack built on a linkedList. // A stack built on a linkedList.
package annotations; package annotations;
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// annotations/StackLStringTest.java // annotations/StackLStringTest.java
// ©2016 MindView LLC: see Copyright.txt
// Applying @Unit to generics. // Applying @Unit to generics.
package annotations; package annotations;
import com.mindviewinc.atunit.*; import com.mindviewinc.atunit.*;

View File

@ -1,4 +1,5 @@
// annotations/Testable.java // annotations/Testable.java
// ©2016 MindView LLC: see Copyright.txt
package annotations; package annotations;
import com.mindviewinc.atunit.*; import com.mindviewinc.atunit.*;

View File

@ -1,4 +1,5 @@
// annotations/UseCase.java // annotations/UseCase.java
// ©2016 MindView LLC: see Copyright.txt
import java.lang.annotation.*; import java.lang.annotation.*;
@Target(ElementType.METHOD) @Target(ElementType.METHOD)

View File

@ -1,4 +1,5 @@
// annotations/UseCaseTracker.java // annotations/UseCaseTracker.java
// ©2016 MindView LLC: see Copyright.txt
import java.lang.reflect.*; import java.lang.reflect.*;
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// annotations/database/Constraints.java // annotations/database/Constraints.java
// ©2016 MindView LLC: see Copyright.txt
package annotations.database; package annotations.database;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,5 @@
// annotations/database/DBTable.java // annotations/database/DBTable.java
// ©2016 MindView LLC: see Copyright.txt
package annotations.database; package annotations.database;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,5 @@
// annotations/database/Member.java // annotations/database/Member.java
// ©2016 MindView LLC: see Copyright.txt
package annotations.database; package annotations.database;
@DBTable(name = "MEMBER") @DBTable(name = "MEMBER")

View File

@ -1,4 +1,5 @@
// annotations/database/SQLInteger.java // annotations/database/SQLInteger.java
// ©2016 MindView LLC: see Copyright.txt
package annotations.database; package annotations.database;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,5 @@
// annotations/database/SQLString.java // annotations/database/SQLString.java
// ©2016 MindView LLC: see Copyright.txt
package annotations.database; package annotations.database;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,5 @@
// annotations/database/TableCreator.java // annotations/database/TableCreator.java
// ©2016 MindView LLC: see Copyright.txt
// Reflection-based annotation processor. // Reflection-based annotation processor.
// {Args: annotations.database.Member} // {Args: annotations.database.Member}
package annotations.database; package annotations.database;

View File

@ -1,4 +1,5 @@
// annotations/database/Uniqueness.java // annotations/database/Uniqueness.java
// ©2016 MindView LLC: see Copyright.txt
// Sample of nested annotations // Sample of nested annotations
package annotations.database; package annotations.database;

View File

@ -1,4 +1,5 @@
// annotations/ifx/ExtractInterface.java // annotations/ifx/ExtractInterface.java
// ©2016 MindView LLC: see Copyright.txt
// javac-based annotation processing. // javac-based annotation processing.
package annotations.ifx; package annotations.ifx;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,5 @@
// annotations/ifx/IfaceExtractorProcessor.java // annotations/ifx/IfaceExtractorProcessor.java
// ©2016 MindView LLC: see Copyright.txt
// javac-based annotation processing. // javac-based annotation processing.
package annotations.ifx; package annotations.ifx;
import javax.annotation.processing.*; import javax.annotation.processing.*;

View File

@ -1,4 +1,5 @@
// annotations/ifx/Multiplier.java // annotations/ifx/Multiplier.java
// ©2016 MindView LLC: see Copyright.txt
// javac-based annotation processing. // javac-based annotation processing.
package annotations.ifx; package annotations.ifx;

View File

@ -1,4 +1,5 @@
// annotations/simplest/Simple.java // annotations/simplest/Simple.java
// ©2016 MindView LLC: see Copyright.txt
// A bare-bones annotation. // A bare-bones annotation.
package annotations.simplest; package annotations.simplest;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -1,4 +1,5 @@
// annotations/simplest/SimpleProcessor.java // annotations/simplest/SimpleProcessor.java
// ©2016 MindView LLC: see Copyright.txt
// A bare-bones annotation processor. // A bare-bones annotation processor.
package annotations.simplest; package annotations.simplest;
import javax.annotation.processing.*; import javax.annotation.processing.*;

View File

@ -1,4 +1,5 @@
// annotations/simplest/SimpleTest.java // annotations/simplest/SimpleTest.java
// ©2016 MindView LLC: see Copyright.txt
// Test the "Simple" annotation // Test the "Simple" annotation
package annotations.simplest; package annotations.simplest;

View File

@ -1,4 +1,5 @@
// arrays/AlphabeticSearch.java // arrays/AlphabeticSearch.java
// ©2016 MindView LLC: see Copyright.txt
// Searching with a Comparator. // Searching with a Comparator.
import java.util.*; import java.util.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// arrays/ArrayOfGenericType.java // arrays/ArrayOfGenericType.java
// ©2016 MindView LLC: see Copyright.txt
// Arrays of generic types won't compile. // Arrays of generic types won't compile.
public class ArrayOfGenericType<T> { public class ArrayOfGenericType<T> {

View File

@ -1,4 +1,5 @@
// arrays/ArrayOfGenerics.java // arrays/ArrayOfGenerics.java
// ©2016 MindView LLC: see Copyright.txt
// It is possible to create arrays of generics. // It is possible to create arrays of generics.
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// arrays/ArrayOptions.java // arrays/ArrayOptions.java
// ©2016 MindView LLC: see Copyright.txt
// Initialization & re-assignment of arrays. // Initialization & re-assignment of arrays.
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// arrays/ArraySearching.java // arrays/ArraySearching.java
// ©2016 MindView LLC: see Copyright.txt
// Using Arrays.binarySearch(). // Using Arrays.binarySearch().
import java.util.*; import java.util.*;
import java.util.function.*; import java.util.function.*;

View File

@ -1,4 +1,5 @@
// arrays/AssemblingMultidimensionalArrays.java // arrays/AssemblingMultidimensionalArrays.java
// ©2016 MindView LLC: see Copyright.txt
// Creating multidimensional arrays. // Creating multidimensional arrays.
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// arrays/AutoboxingArrays.java // arrays/AutoboxingArrays.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.*; import java.util.*;
public class AutoboxingArrays { public class AutoboxingArrays {

View File

@ -1,4 +1,5 @@
// arrays/CompType.java // arrays/CompType.java
// ©2016 MindView LLC: see Copyright.txt
// Implementing Comparable in a class. // Implementing Comparable in a class.
import java.util.*; import java.util.*;
import java.util.function.*; import java.util.function.*;

View File

@ -1,4 +1,5 @@
// arrays/ComparatorTest.java // arrays/ComparatorTest.java
// ©2016 MindView LLC: see Copyright.txt
// Implementing a Comparator for a class. // Implementing a Comparator for a class.
import java.util.*; import java.util.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// arrays/ComparingArrays.java // arrays/ComparingArrays.java
// ©2016 MindView LLC: see Copyright.txt
// Using Arrays.equals() // Using Arrays.equals()
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// arrays/ContainerComparison.java // arrays/ContainerComparison.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.*; import java.util.*;
class BerylliumSphere { class BerylliumSphere {

View File

@ -1,4 +1,5 @@
// arrays/CopyingArrays.java // arrays/CopyingArrays.java
// ©2016 MindView LLC: see Copyright.txt
// Using System.arraycopy() // Using System.arraycopy()
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// arrays/FillingArrays.java // arrays/FillingArrays.java
// ©2016 MindView LLC: see Copyright.txt
// Using Arrays.fill() // Using Arrays.fill()
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// arrays/IceCream.java // arrays/IceCream.java
// ©2016 MindView LLC: see Copyright.txt
// Returning arrays from methods. // Returning arrays from methods.
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// arrays/MultiDimWrapperArray.java // arrays/MultiDimWrapperArray.java
// ©2016 MindView LLC: see Copyright.txt
// Multidimensional arrays of "wrapper" objects. // Multidimensional arrays of "wrapper" objects.
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// arrays/MultidimensionalObjectArrays.java // arrays/MultidimensionalObjectArrays.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.*; import java.util.*;
public class MultidimensionalObjectArrays { public class MultidimensionalObjectArrays {

View File

@ -1,4 +1,5 @@
// arrays/MultidimensionalPrimitiveArray.java // arrays/MultidimensionalPrimitiveArray.java
// ©2016 MindView LLC: see Copyright.txt
// Creating multidimensional arrays. // Creating multidimensional arrays.
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// arrays/ParameterizedArrayType.java // arrays/ParameterizedArrayType.java
// ©2016 MindView LLC: see Copyright.txt
class ClassParameter<T> { class ClassParameter<T> {
public T[] f(T[] arg) { return arg; } public T[] f(T[] arg) { return arg; }

View File

@ -1,4 +1,5 @@
// arrays/PrimitiveConversionDemonstration.java // arrays/PrimitiveConversionDemonstration.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.*; import java.util.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
# arrays/PythonLists.py # arrays/PythonLists.py
# ©2016 MindView LLC: see Copyright.txt
aList = [1, 2, 3, 4, 5] aList = [1, 2, 3, 4, 5]
print(type(aList)) # <type 'list'> print(type(aList)) # <type 'list'>

View File

@ -1,4 +1,5 @@
// arrays/RaggedArray.java // arrays/RaggedArray.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.*; import java.util.*;
public class RaggedArray { public class RaggedArray {

View File

@ -1,4 +1,5 @@
// arrays/RandomSuppliersTest.java // arrays/RandomSuppliersTest.java
// ©2016 MindView LLC: see Copyright.txt
import onjava.*; import onjava.*;
public class RandomSuppliersTest { public class RandomSuppliersTest {

View File

@ -1,4 +1,5 @@
// arrays/Reverse.java // arrays/Reverse.java
// ©2016 MindView LLC: see Copyright.txt
// The Collections.reverseOrder() Comparator // The Collections.reverseOrder() Comparator
import java.util.*; import java.util.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// arrays/StringSorting.java // arrays/StringSorting.java
// ©2016 MindView LLC: see Copyright.txt
// Sorting an array of Strings. // Sorting an array of Strings.
import java.util.*; import java.util.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// arrays/SuppliersTest.java // arrays/SuppliersTest.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.function.*; import java.util.function.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// arrays/TestArrayGeneration.java // arrays/TestArrayGeneration.java
// ©2016 MindView LLC: see Copyright.txt
// Test the tools that use generators to fill arrays. // Test the tools that use generators to fill arrays.
import java.util.*; import java.util.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// arrays/TestGenerated.java // arrays/TestGenerated.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.*; import java.util.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// arrays/ThreeDWithNew.java // arrays/ThreeDWithNew.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.*; import java.util.*;
public class ThreeDWithNew { public class ThreeDWithNew {

View File

@ -1,4 +1,5 @@
// assertions/Assert1.java // assertions/Assert1.java
// ©2016 MindView LLC: see Copyright.txt
// Non-informative style of assert // Non-informative style of assert
// {JVMArgs: -ea} // Must run with -ea // {JVMArgs: -ea} // Must run with -ea
// {ThrowsException} // {ThrowsException}

View File

@ -1,4 +1,5 @@
// assertions/Assert2.java // assertions/Assert2.java
// ©2016 MindView LLC: see Copyright.txt
// Assert with an informative message // Assert with an informative message
// {JVMArgs: -ea} // {JVMArgs: -ea}
// {ThrowsException} // {ThrowsException}

View File

@ -1,4 +1,5 @@
// assertions/LoaderAssertions.java // assertions/LoaderAssertions.java
// ©2016 MindView LLC: see Copyright.txt
// Using the class loader to enable assertions // Using the class loader to enable assertions
// {ThrowsException} // {ThrowsException}

View File

@ -1,4 +1,5 @@
// assertions/Queue.java // assertions/Queue.java
// ©2016 MindView LLC: see Copyright.txt
// Demonstration of Design by Contract (DbC) combined // Demonstration of Design by Contract (DbC) combined
// with white-box unit testing. // with white-box unit testing.
// (Install libraries from www.junit.org) // (Install libraries from www.junit.org)

View File

@ -30,7 +30,7 @@
polymorphism/build.xml polymorphism/build.xml
interfaces/build.xml interfaces/build.xml
innerclasses/build.xml innerclasses/build.xml
functions/build.xml functional/build.xml
containers/build.xml containers/build.xml
streams/build.xml streams/build.xml
exceptions/build.xml exceptions/build.xml

View File

@ -1,4 +1,5 @@
// com/mindviewinc/atunit/AtUnit.java // com/mindviewinc/atunit/AtUnit.java
// ©2016 MindView LLC: see Copyright.txt
// An annotation-based unit-test framework. // An annotation-based unit-test framework.
package com.mindviewinc.atunit; package com.mindviewinc.atunit;
import java.lang.reflect.*; import java.lang.reflect.*;

View File

@ -1,4 +1,5 @@
// com/mindviewinc/atunit/ClassNameFinder.java // com/mindviewinc/atunit/ClassNameFinder.java
// ©2016 MindView LLC: see Copyright.txt
package com.mindviewinc.atunit; package com.mindviewinc.atunit;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// com/mindviewinc/atunit/Test.java // com/mindviewinc/atunit/Test.java
// ©2016 MindView LLC: see Copyright.txt
// The @Test tag. // The @Test tag.
package com.mindviewinc.atunit; package com.mindviewinc.atunit;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,5 @@
// com/mindviewinc/atunit/TestObjectCleanup.java // com/mindviewinc/atunit/TestObjectCleanup.java
// ©2016 MindView LLC: see Copyright.txt
// The @Unit @TestObjectCleanup tag. // The @Unit @TestObjectCleanup tag.
package com.mindviewinc.atunit; package com.mindviewinc.atunit;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,5 @@
// com/mindviewinc/atunit/TestObjectCreate.java // com/mindviewinc/atunit/TestObjectCreate.java
// ©2016 MindView LLC: see Copyright.txt
// The @Unit @TestObjectCreate tag. // The @Unit @TestObjectCreate tag.
package com.mindviewinc.atunit; package com.mindviewinc.atunit;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,5 @@
// com/mindviewinc/atunit/TestProperty.java // com/mindviewinc/atunit/TestProperty.java
// ©2016 MindView LLC: see Copyright.txt
// The @Unit @TestProperty tag. // The @Unit @TestProperty tag.
package com.mindviewinc.atunit; package com.mindviewinc.atunit;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,5 @@
// com/mindviewinc/simple/List.java // com/mindviewinc/simple/List.java
// ©2016 MindView LLC: see Copyright.txt
// Creating a package. // Creating a package.
package com.mindviewinc.simple; package com.mindviewinc.simple;

View File

@ -1,4 +1,5 @@
// com/mindviewinc/simple/Vector.java // com/mindviewinc/simple/Vector.java
// ©2016 MindView LLC: see Copyright.txt
// Creating a package. // Creating a package.
package com.mindviewinc.simple; package com.mindviewinc.simple;

View File

@ -1,4 +1,5 @@
// compression/GZIPcompress.java // compression/GZIPcompress.java
// ©2016 MindView LLC: see Copyright.txt
// {Args: GZIPcompress.java} // {Args: GZIPcompress.java}
import java.util.zip.*; import java.util.zip.*;
import java.io.*; import java.io.*;

View File

@ -1,4 +1,5 @@
// compression/ZipCompress.java // compression/ZipCompress.java
// ©2016 MindView LLC: see Copyright.txt
// Uses Zip compression to compress any // Uses Zip compression to compress any
// number of files given on the command line. // number of files given on the command line.
// {Args: ZipCompress.java} // {Args: ZipCompress.java}

View File

@ -1,4 +1,5 @@
// concurrency/ActiveObjectDemo.java // concurrency/ActiveObjectDemo.java
// ©2016 MindView LLC: see Copyright.txt
// Can only pass constants, immutables, "disconnected // Can only pass constants, immutables, "disconnected
// objects," or other active objects as arguments // objects," or other active objects as arguments
// to asynch methods. // to asynch methods.

View File

@ -1,4 +1,5 @@
// concurrency/AtomicEvenSupplier.java // concurrency/AtomicEvenSupplier.java
// ©2016 MindView LLC: see Copyright.txt
// Atomic classes are occasionally useful in regular code. // Atomic classes are occasionally useful in regular code.
// {TimeOutDuringTesting} // {TimeOutDuringTesting}
import java.util.concurrent.atomic.*; import java.util.concurrent.atomic.*;

View File

@ -1,4 +1,5 @@
// concurrency/AtomicIntegerTest.java // concurrency/AtomicIntegerTest.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.atomic.*; import java.util.concurrent.atomic.*;
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// concurrency/Atomicity.java // concurrency/Atomicity.java
// ©2016 MindView LLC: see Copyright.txt
// {Exec: javap -c Atomicity} // {Exec: javap -c Atomicity}
public class Atomicity { public class Atomicity {

View File

@ -1,4 +1,5 @@
// concurrency/AtomicityTest.java // concurrency/AtomicityTest.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.concurrent.*; import java.util.concurrent.*;
public class AtomicityTest implements Runnable { public class AtomicityTest implements Runnable {

View File

@ -1,4 +1,5 @@
// concurrency/AttemptLocking.java // concurrency/AttemptLocking.java
// ©2016 MindView LLC: see Copyright.txt
// 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.
import java.util.concurrent.*; import java.util.concurrent.*;

View File

@ -1,4 +1,5 @@
// concurrency/BankTellerSimulation.java // concurrency/BankTellerSimulation.java
// ©2016 MindView LLC: see Copyright.txt
// Using queues and multithreading. // Using queues and multithreading.
// {Args: 5} // {Args: 5}
import java.util.concurrent.*; import java.util.concurrent.*;

View File

@ -1,4 +1,5 @@
// concurrency/BasicThreads.java // concurrency/BasicThreads.java
// ©2016 MindView LLC: see Copyright.txt
// The most basic use of the Thread class. // The most basic use of the Thread class.
public class BasicThreads { public class BasicThreads {

View File

@ -1,4 +1,5 @@
// concurrency/CachedThreadPool.java // concurrency/CachedThreadPool.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.concurrent.*; import java.util.concurrent.*;
public class CachedThreadPool { public class CachedThreadPool {

View File

@ -1,4 +1,5 @@
// concurrency/CallableDemo.java // concurrency/CallableDemo.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// concurrency/CaptureUncaughtException.java // concurrency/CaptureUncaughtException.java
// ©2016 MindView LLC: see Copyright.txt
// {TimeOutDuringTesting} // {TimeOutDuringTesting}
import java.util.concurrent.*; import java.util.concurrent.*;

View File

@ -1,4 +1,5 @@
// concurrency/CarBuilder.java // concurrency/CarBuilder.java
// ©2016 MindView LLC: see Copyright.txt
// A complex example of tasks working together. // A complex example of tasks working together.
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// concurrency/Chopstick.java // concurrency/Chopstick.java
// ©2016 MindView LLC: see Copyright.txt
// Chopsticks for dining philosophers. // Chopsticks for dining philosophers.
public class Chopstick { public class Chopstick {

View File

@ -1,4 +1,5 @@
// concurrency/CloseResource.java // concurrency/CloseResource.java
// ©2016 MindView LLC: see Copyright.txt
// Interrupting a blocked task by // Interrupting a blocked task by
// closing the underlying resource. // closing the underlying resource.
// {TimeOutDuringTesting} // {TimeOutDuringTesting}

View File

@ -1,4 +1,5 @@
// concurrency/CountDownLatchDemo.java // concurrency/CountDownLatchDemo.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// concurrency/CriticalSection.java // concurrency/CriticalSection.java
// ©2016 MindView LLC: see Copyright.txt
// {TimeOutDuringTesting} // {TimeOutDuringTesting}
// (Behavior may have changed in Java 8). // (Behavior may have changed in Java 8).
// Synchronizing blocks instead of entire methods. Also // Synchronizing blocks instead of entire methods. Also

View File

@ -1,4 +1,5 @@
// concurrency/DaemonFromFactory.java // concurrency/DaemonFromFactory.java
// ©2016 MindView LLC: see Copyright.txt
// Using a Thread Factory to create daemons. // Using a Thread Factory to create daemons.
import java.util.concurrent.*; import java.util.concurrent.*;
import onjava.*; import onjava.*;

View File

@ -1,4 +1,5 @@
// concurrency/Daemons.java // concurrency/Daemons.java
// ©2016 MindView LLC: see Copyright.txt
// Daemon threads spawn other daemon threads. // Daemon threads spawn other daemon threads.
import java.util.concurrent.*; import java.util.concurrent.*;

View File

@ -1,4 +1,5 @@
// concurrency/DaemonsDoRunFinally.java // concurrency/DaemonsDoRunFinally.java
// ©2016 MindView LLC: see Copyright.txt
// Daemon threads now run the finally clause // Daemon threads now run the finally clause
import java.util.concurrent.*; import java.util.concurrent.*;

View File

@ -1,4 +1,5 @@
// concurrency/DeadlockingDiningPhilosophers.java // concurrency/DeadlockingDiningPhilosophers.java
// ©2016 MindView LLC: see Copyright.txt
// Demonstrates how deadlock can be hidden in a program. // Demonstrates how deadlock can be hidden in a program.
// {Args: 0 5 timeout} // {Args: 0 5 timeout}
import java.util.concurrent.*; import java.util.concurrent.*;

View File

@ -1,4 +1,5 @@
// concurrency/DelayQueueDemo.java // concurrency/DelayQueueDemo.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.*; import java.util.*;
import static java.util.concurrent.TimeUnit.*; import static java.util.concurrent.TimeUnit.*;

View File

@ -1,4 +1,5 @@
// concurrency/EvenChecker.java // concurrency/EvenChecker.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.concurrent.*; import java.util.concurrent.*;
public class EvenChecker implements Runnable { public class EvenChecker implements Runnable {

View File

@ -1,4 +1,5 @@
// concurrency/EvenSupplier.java // concurrency/EvenSupplier.java
// ©2016 MindView LLC: see Copyright.txt
// When threads collide. // When threads collide.
public class EvenSupplier extends IntSupplier { public class EvenSupplier extends IntSupplier {

View File

@ -1,4 +1,5 @@
// concurrency/ExceptionThread.java // concurrency/ExceptionThread.java
// ©2016 MindView LLC: see Copyright.txt
// {ValidateByHand} // {ValidateByHand}
// {ThrowsException} // {ThrowsException}
import java.util.concurrent.*; import java.util.concurrent.*;

View File

@ -1,4 +1,5 @@
// concurrency/ExchangerDemo.java // concurrency/ExchangerDemo.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.*; import java.util.*;
import java.util.function.*; import java.util.function.*;

View File

@ -1,4 +1,5 @@
// concurrency/ExplicitCriticalSection.java // concurrency/ExplicitCriticalSection.java
// ©2016 MindView LLC: see Copyright.txt
// {ThrowsException} on a multiprocessor machine // {ThrowsException} on a multiprocessor machine
// Using explicit Lock objects to create // Using explicit Lock objects to create
// critical sections. // critical sections.

View File

@ -1,4 +1,5 @@
// concurrency/FastSimulation.java // concurrency/FastSimulation.java
// ©2016 MindView LLC: see Copyright.txt
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.atomic.*; import java.util.concurrent.atomic.*;
import java.util.*; import java.util.*;

View File

@ -1,4 +1,5 @@
// concurrency/Fat.java // concurrency/Fat.java
// ©2016 MindView LLC: see Copyright.txt
// Objects that are expensive to create. // Objects that are expensive to create.
public class Fat { public class Fat {

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