New chapters, renamed chapters
This commit is contained in:
parent
bc0026c3e1
commit
8279efc16c
@ -1,4 +1,5 @@
|
||||
// HelloDate.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.*;
|
||||
|
||||
public class HelloDate {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/AtUnitComposition.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Creating non-embedded tests.
|
||||
package annotations;
|
||||
import com.mindviewinc.atunit.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/AtUnitExample1.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations;
|
||||
import com.mindviewinc.atunit.*;
|
||||
import onjava.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/AtUnitExample2.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Assertions and exceptions can be used in @Tests.
|
||||
package annotations;
|
||||
import java.io.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/AtUnitExample3.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations;
|
||||
import com.mindviewinc.atunit.*;
|
||||
import onjava.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/AtUnitExample4.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations;
|
||||
import java.util.*;
|
||||
import com.mindviewinc.atunit.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/AtUnitExample5.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations;
|
||||
import java.io.*;
|
||||
import com.mindviewinc.atunit.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/AtUnitExternalTest.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Creating non-embedded tests.
|
||||
package annotations;
|
||||
import com.mindviewinc.atunit.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/HashSetTest.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations;
|
||||
import java.util.*;
|
||||
import com.mindviewinc.atunit.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/PasswordUtils.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.*;
|
||||
|
||||
public class PasswordUtils {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/SimulatingNull.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/StackL.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// A stack built on a linkedList.
|
||||
package annotations;
|
||||
import java.util.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/StackLStringTest.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Applying @Unit to generics.
|
||||
package annotations;
|
||||
import com.mindviewinc.atunit.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/Testable.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations;
|
||||
import com.mindviewinc.atunit.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/UseCase.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/UseCaseTracker.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/database/Constraints.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations.database;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/database/DBTable.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations.database;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/database/Member.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations.database;
|
||||
|
||||
@DBTable(name = "MEMBER")
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/database/SQLInteger.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations.database;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/database/SQLString.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package annotations.database;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/database/TableCreator.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Reflection-based annotation processor.
|
||||
// {Args: annotations.database.Member}
|
||||
package annotations.database;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/database/Uniqueness.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Sample of nested annotations
|
||||
package annotations.database;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/ifx/ExtractInterface.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// javac-based annotation processing.
|
||||
package annotations.ifx;
|
||||
import java.lang.annotation.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/ifx/IfaceExtractorProcessor.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// javac-based annotation processing.
|
||||
package annotations.ifx;
|
||||
import javax.annotation.processing.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/ifx/Multiplier.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// javac-based annotation processing.
|
||||
package annotations.ifx;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/simplest/Simple.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// A bare-bones annotation.
|
||||
package annotations.simplest;
|
||||
import java.lang.annotation.Retention;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/simplest/SimpleProcessor.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// A bare-bones annotation processor.
|
||||
package annotations.simplest;
|
||||
import javax.annotation.processing.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// annotations/simplest/SimpleTest.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Test the "Simple" annotation
|
||||
package annotations.simplest;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/AlphabeticSearch.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Searching with a Comparator.
|
||||
import java.util.*;
|
||||
import onjava.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/ArrayOfGenericType.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Arrays of generic types won't compile.
|
||||
|
||||
public class ArrayOfGenericType<T> {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/ArrayOfGenerics.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// It is possible to create arrays of generics.
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/ArrayOptions.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Initialization & re-assignment of arrays.
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/ArraySearching.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Using Arrays.binarySearch().
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/AssemblingMultidimensionalArrays.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Creating multidimensional arrays.
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/AutoboxingArrays.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.*;
|
||||
|
||||
public class AutoboxingArrays {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/CompType.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Implementing Comparable in a class.
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/ComparatorTest.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Implementing a Comparator for a class.
|
||||
import java.util.*;
|
||||
import onjava.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/ComparingArrays.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Using Arrays.equals()
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/ContainerComparison.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.*;
|
||||
|
||||
class BerylliumSphere {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/CopyingArrays.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Using System.arraycopy()
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/FillingArrays.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Using Arrays.fill()
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/IceCream.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Returning arrays from methods.
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/MultiDimWrapperArray.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Multidimensional arrays of "wrapper" objects.
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/MultidimensionalObjectArrays.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.*;
|
||||
|
||||
public class MultidimensionalObjectArrays {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/MultidimensionalPrimitiveArray.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Creating multidimensional arrays.
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/ParameterizedArrayType.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
|
||||
class ClassParameter<T> {
|
||||
public T[] f(T[] arg) { return arg; }
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/PrimitiveConversionDemonstration.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.*;
|
||||
import onjava.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
# arrays/PythonLists.py
|
||||
# ©2016 MindView LLC: see Copyright.txt
|
||||
|
||||
aList = [1, 2, 3, 4, 5]
|
||||
print(type(aList)) # <type 'list'>
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/RaggedArray.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.*;
|
||||
|
||||
public class RaggedArray {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/RandomSuppliersTest.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import onjava.*;
|
||||
|
||||
public class RandomSuppliersTest {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/Reverse.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// The Collections.reverseOrder() Comparator
|
||||
import java.util.*;
|
||||
import onjava.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/StringSorting.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Sorting an array of Strings.
|
||||
import java.util.*;
|
||||
import onjava.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/SuppliersTest.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.function.*;
|
||||
import onjava.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/TestArrayGeneration.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Test the tools that use generators to fill arrays.
|
||||
import java.util.*;
|
||||
import onjava.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/TestGenerated.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.*;
|
||||
import onjava.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// arrays/ThreeDWithNew.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.*;
|
||||
|
||||
public class ThreeDWithNew {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// assertions/Assert1.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Non-informative style of assert
|
||||
// {JVMArgs: -ea} // Must run with -ea
|
||||
// {ThrowsException}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// assertions/Assert2.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Assert with an informative message
|
||||
// {JVMArgs: -ea}
|
||||
// {ThrowsException}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// assertions/LoaderAssertions.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Using the class loader to enable assertions
|
||||
// {ThrowsException}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// assertions/Queue.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Demonstration of Design by Contract (DbC) combined
|
||||
// with white-box unit testing.
|
||||
// (Install libraries from www.junit.org)
|
||||
|
@ -30,7 +30,7 @@
|
||||
polymorphism/build.xml
|
||||
interfaces/build.xml
|
||||
innerclasses/build.xml
|
||||
functions/build.xml
|
||||
functional/build.xml
|
||||
containers/build.xml
|
||||
streams/build.xml
|
||||
exceptions/build.xml
|
||||
|
@ -1,4 +1,5 @@
|
||||
// com/mindviewinc/atunit/AtUnit.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// An annotation-based unit-test framework.
|
||||
package com.mindviewinc.atunit;
|
||||
import java.lang.reflect.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// com/mindviewinc/atunit/ClassNameFinder.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
package com.mindviewinc.atunit;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// com/mindviewinc/atunit/Test.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// The @Test tag.
|
||||
package com.mindviewinc.atunit;
|
||||
import java.lang.annotation.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// com/mindviewinc/atunit/TestObjectCleanup.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// The @Unit @TestObjectCleanup tag.
|
||||
package com.mindviewinc.atunit;
|
||||
import java.lang.annotation.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// com/mindviewinc/atunit/TestObjectCreate.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// The @Unit @TestObjectCreate tag.
|
||||
package com.mindviewinc.atunit;
|
||||
import java.lang.annotation.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// com/mindviewinc/atunit/TestProperty.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// The @Unit @TestProperty tag.
|
||||
package com.mindviewinc.atunit;
|
||||
import java.lang.annotation.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// com/mindviewinc/simple/List.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Creating a package.
|
||||
package com.mindviewinc.simple;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// com/mindviewinc/simple/Vector.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Creating a package.
|
||||
package com.mindviewinc.simple;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// compression/GZIPcompress.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// {Args: GZIPcompress.java}
|
||||
import java.util.zip.*;
|
||||
import java.io.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// compression/ZipCompress.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Uses Zip compression to compress any
|
||||
// number of files given on the command line.
|
||||
// {Args: ZipCompress.java}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/ActiveObjectDemo.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Can only pass constants, immutables, "disconnected
|
||||
// objects," or other active objects as arguments
|
||||
// to asynch methods.
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/AtomicEvenSupplier.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Atomic classes are occasionally useful in regular code.
|
||||
// {TimeOutDuringTesting}
|
||||
import java.util.concurrent.atomic.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/AtomicIntegerTest.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.*;
|
||||
import java.util.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/Atomicity.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// {Exec: javap -c Atomicity}
|
||||
|
||||
public class Atomicity {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/AtomicityTest.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class AtomicityTest implements Runnable {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/AttemptLocking.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Locks in the concurrent library allow you
|
||||
// to give up on trying to acquire a lock.
|
||||
import java.util.concurrent.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/BankTellerSimulation.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Using queues and multithreading.
|
||||
// {Args: 5}
|
||||
import java.util.concurrent.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/BasicThreads.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// The most basic use of the Thread class.
|
||||
|
||||
public class BasicThreads {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/CachedThreadPool.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class CachedThreadPool {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/CallableDemo.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.concurrent.*;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/CaptureUncaughtException.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// {TimeOutDuringTesting}
|
||||
import java.util.concurrent.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/CarBuilder.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// A complex example of tasks working together.
|
||||
import java.util.concurrent.*;
|
||||
import java.util.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/Chopstick.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Chopsticks for dining philosophers.
|
||||
|
||||
public class Chopstick {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/CloseResource.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Interrupting a blocked task by
|
||||
// closing the underlying resource.
|
||||
// {TimeOutDuringTesting}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/CountDownLatchDemo.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.concurrent.*;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/CriticalSection.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// {TimeOutDuringTesting}
|
||||
// (Behavior may have changed in Java 8).
|
||||
// Synchronizing blocks instead of entire methods. Also
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/DaemonFromFactory.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Using a Thread Factory to create daemons.
|
||||
import java.util.concurrent.*;
|
||||
import onjava.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/Daemons.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Daemon threads spawn other daemon threads.
|
||||
import java.util.concurrent.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/DaemonsDoRunFinally.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Daemon threads now run the finally clause
|
||||
import java.util.concurrent.*;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/DeadlockingDiningPhilosophers.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Demonstrates how deadlock can be hidden in a program.
|
||||
// {Args: 0 5 timeout}
|
||||
import java.util.concurrent.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/DelayQueueDemo.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.concurrent.*;
|
||||
import java.util.*;
|
||||
import static java.util.concurrent.TimeUnit.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/EvenChecker.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class EvenChecker implements Runnable {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/EvenSupplier.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// When threads collide.
|
||||
|
||||
public class EvenSupplier extends IntSupplier {
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/ExceptionThread.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// {ValidateByHand}
|
||||
// {ThrowsException}
|
||||
import java.util.concurrent.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/ExchangerDemo.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.concurrent.*;
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/ExplicitCriticalSection.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// {ThrowsException} on a multiprocessor machine
|
||||
// Using explicit Lock objects to create
|
||||
// critical sections.
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/FastSimulation.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.*;
|
||||
import java.util.*;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// concurrency/Fat.java
|
||||
// ©2016 MindView LLC: see Copyright.txt
|
||||
// Objects that are expensive to create.
|
||||
|
||||
public class Fat {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user