Added "no guarantees" and Info URl

This commit is contained in:
Bruce Eckel 2015-11-15 15:51:35 -08:00
parent 8279efc16c
commit e7291af6ec
984 changed files with 1968 additions and 2 deletions

View File

@ -1,5 +1,5 @@
// Copyright.txt
This computer source code is Copyright ©2015 MindView LLC
This computer source code is Copyright ©2016 MindView LLC
All Rights Reserved.
Permission to use, copy, modify, and distribute this

View File

@ -1,5 +1,7 @@
// HelloDate.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.*;
public class HelloDate {

View File

@ -1,5 +1,7 @@
// annotations/AtUnitComposition.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Creating non-embedded tests.
package annotations;
import com.mindviewinc.atunit.*;

View File

@ -1,5 +1,7 @@
// annotations/AtUnitExample1.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations;
import com.mindviewinc.atunit.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// annotations/AtUnitExample2.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Assertions and exceptions can be used in @Tests.
package annotations;
import java.io.*;

View File

@ -1,5 +1,7 @@
// annotations/AtUnitExample3.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations;
import com.mindviewinc.atunit.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// annotations/AtUnitExample4.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations;
import java.util.*;
import com.mindviewinc.atunit.*;

View File

@ -1,5 +1,7 @@
// annotations/AtUnitExample5.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations;
import java.io.*;
import com.mindviewinc.atunit.*;

View File

@ -1,5 +1,7 @@
// annotations/AtUnitExternalTest.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Creating non-embedded tests.
package annotations;
import com.mindviewinc.atunit.*;

View File

@ -1,5 +1,7 @@
// annotations/HashSetTest.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations;
import java.util.*;
import com.mindviewinc.atunit.*;

View File

@ -1,5 +1,7 @@
// annotations/PasswordUtils.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.*;
public class PasswordUtils {

View File

@ -1,5 +1,7 @@
// annotations/SimulatingNull.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.lang.annotation.*;
@Target(ElementType.METHOD)

View File

@ -1,5 +1,7 @@
// annotations/StackL.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// A stack built on a linkedList.
package annotations;
import java.util.*;

View File

@ -1,5 +1,7 @@
// annotations/StackLStringTest.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Applying @Unit to generics.
package annotations;
import com.mindviewinc.atunit.*;

View File

@ -1,5 +1,7 @@
// annotations/Testable.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations;
import com.mindviewinc.atunit.*;

View File

@ -1,5 +1,7 @@
// annotations/UseCase.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.lang.annotation.*;
@Target(ElementType.METHOD)

View File

@ -1,5 +1,7 @@
// annotations/UseCaseTracker.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.lang.reflect.*;
import java.util.*;

View File

@ -1,5 +1,7 @@
// annotations/database/Constraints.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations.database;
import java.lang.annotation.*;

View File

@ -1,5 +1,7 @@
// annotations/database/DBTable.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations.database;
import java.lang.annotation.*;

View File

@ -1,5 +1,7 @@
// annotations/database/Member.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations.database;
@DBTable(name = "MEMBER")

View File

@ -1,5 +1,7 @@
// annotations/database/SQLInteger.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations.database;
import java.lang.annotation.*;

View File

@ -1,5 +1,7 @@
// annotations/database/SQLString.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package annotations.database;
import java.lang.annotation.*;

View File

@ -1,5 +1,7 @@
// annotations/database/TableCreator.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Reflection-based annotation processor.
// {Args: annotations.database.Member}
package annotations.database;

View File

@ -1,5 +1,7 @@
// annotations/database/Uniqueness.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Sample of nested annotations
package annotations.database;

View File

@ -1,5 +1,7 @@
// annotations/ifx/ExtractInterface.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// javac-based annotation processing.
package annotations.ifx;
import java.lang.annotation.*;

View File

@ -1,5 +1,7 @@
// annotations/ifx/IfaceExtractorProcessor.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// javac-based annotation processing.
package annotations.ifx;
import javax.annotation.processing.*;

View File

@ -1,5 +1,7 @@
// annotations/ifx/Multiplier.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// javac-based annotation processing.
package annotations.ifx;

View File

@ -1,5 +1,7 @@
// annotations/simplest/Simple.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// A bare-bones annotation.
package annotations.simplest;
import java.lang.annotation.Retention;

View File

@ -1,5 +1,7 @@
// annotations/simplest/SimpleProcessor.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// A bare-bones annotation processor.
package annotations.simplest;
import javax.annotation.processing.*;

View File

@ -1,5 +1,7 @@
// annotations/simplest/SimpleTest.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Test the "Simple" annotation
package annotations.simplest;

View File

@ -1,5 +1,7 @@
// arrays/AlphabeticSearch.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Searching with a Comparator.
import java.util.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// arrays/ArrayOfGenericType.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Arrays of generic types won't compile.
public class ArrayOfGenericType<T> {

View File

@ -1,5 +1,7 @@
// arrays/ArrayOfGenerics.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// It is possible to create arrays of generics.
import java.util.*;

View File

@ -1,5 +1,7 @@
// arrays/ArrayOptions.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Initialization & re-assignment of arrays.
import java.util.*;

View File

@ -1,5 +1,7 @@
// arrays/ArraySearching.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Using Arrays.binarySearch().
import java.util.*;
import java.util.function.*;

View File

@ -1,5 +1,7 @@
// arrays/AssemblingMultidimensionalArrays.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Creating multidimensional arrays.
import java.util.*;

View File

@ -1,5 +1,7 @@
// arrays/AutoboxingArrays.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.*;
public class AutoboxingArrays {

View File

@ -1,5 +1,7 @@
// arrays/CompType.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Implementing Comparable in a class.
import java.util.*;
import java.util.function.*;

View File

@ -1,5 +1,7 @@
// arrays/ComparatorTest.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Implementing a Comparator for a class.
import java.util.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// arrays/ComparingArrays.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Using Arrays.equals()
import java.util.*;

View File

@ -1,5 +1,7 @@
// arrays/ContainerComparison.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.*;
class BerylliumSphere {

View File

@ -1,5 +1,7 @@
// arrays/CopyingArrays.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Using System.arraycopy()
import java.util.*;

View File

@ -1,5 +1,7 @@
// arrays/FillingArrays.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Using Arrays.fill()
import java.util.*;

View File

@ -1,5 +1,7 @@
// arrays/IceCream.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Returning arrays from methods.
import java.util.*;

View File

@ -1,5 +1,7 @@
// arrays/MultiDimWrapperArray.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Multidimensional arrays of "wrapper" objects.
import java.util.*;

View File

@ -1,5 +1,7 @@
// arrays/MultidimensionalObjectArrays.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.*;
public class MultidimensionalObjectArrays {

View File

@ -1,5 +1,7 @@
// arrays/MultidimensionalPrimitiveArray.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Creating multidimensional arrays.
import java.util.*;

View File

@ -1,5 +1,7 @@
// arrays/ParameterizedArrayType.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
class ClassParameter<T> {
public T[] f(T[] arg) { return arg; }

View File

@ -1,5 +1,7 @@
// arrays/PrimitiveConversionDemonstration.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
# arrays/PythonLists.py
# ©2016 MindView LLC: see Copyright.txt
# We make no guarantees that this code is fit for any purpose.
# Visit http://mindviewinc.com/Books/OnJava/ for more book information.
aList = [1, 2, 3, 4, 5]
print(type(aList)) # <type 'list'>

View File

@ -1,5 +1,7 @@
// arrays/RaggedArray.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.*;
public class RaggedArray {

View File

@ -1,5 +1,7 @@
// arrays/RandomSuppliersTest.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import onjava.*;
public class RandomSuppliersTest {

View File

@ -1,5 +1,7 @@
// arrays/Reverse.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// The Collections.reverseOrder() Comparator
import java.util.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// arrays/StringSorting.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Sorting an array of Strings.
import java.util.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// arrays/SuppliersTest.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.function.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// arrays/TestArrayGeneration.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Test the tools that use generators to fill arrays.
import java.util.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// arrays/TestGenerated.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// arrays/ThreeDWithNew.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.*;
public class ThreeDWithNew {

View File

@ -1,5 +1,7 @@
// assertions/Assert1.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Non-informative style of assert
// {JVMArgs: -ea} // Must run with -ea
// {ThrowsException}

View File

@ -1,5 +1,7 @@
// assertions/Assert2.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Assert with an informative message
// {JVMArgs: -ea}
// {ThrowsException}

View File

@ -1,5 +1,7 @@
// assertions/LoaderAssertions.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Using the class loader to enable assertions
// {ThrowsException}

View File

@ -1,5 +1,7 @@
// assertions/Queue.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Demonstration of Design by Contract (DbC) combined
// with white-box unit testing.
// (Install libraries from www.junit.org)

View File

@ -1,5 +1,7 @@
// com/mindviewinc/atunit/AtUnit.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// An annotation-based unit-test framework.
package com.mindviewinc.atunit;
import java.lang.reflect.*;

View File

@ -1,5 +1,7 @@
// com/mindviewinc/atunit/ClassNameFinder.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
package com.mindviewinc.atunit;
import java.io.*;
import java.util.*;

View File

@ -1,5 +1,7 @@
// com/mindviewinc/atunit/Test.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// The @Test tag.
package com.mindviewinc.atunit;
import java.lang.annotation.*;

View File

@ -1,5 +1,7 @@
// com/mindviewinc/atunit/TestObjectCleanup.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// The @Unit @TestObjectCleanup tag.
package com.mindviewinc.atunit;
import java.lang.annotation.*;

View File

@ -1,5 +1,7 @@
// com/mindviewinc/atunit/TestObjectCreate.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// The @Unit @TestObjectCreate tag.
package com.mindviewinc.atunit;
import java.lang.annotation.*;

View File

@ -1,5 +1,7 @@
// com/mindviewinc/atunit/TestProperty.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// The @Unit @TestProperty tag.
package com.mindviewinc.atunit;
import java.lang.annotation.*;

View File

@ -1,5 +1,7 @@
// com/mindviewinc/simple/List.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Creating a package.
package com.mindviewinc.simple;

View File

@ -1,5 +1,7 @@
// com/mindviewinc/simple/Vector.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Creating a package.
package com.mindviewinc.simple;

View File

@ -1,5 +1,7 @@
// compression/GZIPcompress.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// {Args: GZIPcompress.java}
import java.util.zip.*;
import java.io.*;

View File

@ -1,5 +1,7 @@
// compression/ZipCompress.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Uses Zip compression to compress any
// number of files given on the command line.
// {Args: ZipCompress.java}

View File

@ -1,5 +1,7 @@
// concurrency/ActiveObjectDemo.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Can only pass constants, immutables, "disconnected
// objects," or other active objects as arguments
// to asynch methods.

View File

@ -1,5 +1,7 @@
// concurrency/AtomicEvenSupplier.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Atomic classes are occasionally useful in regular code.
// {TimeOutDuringTesting}
import java.util.concurrent.atomic.*;

View File

@ -1,5 +1,7 @@
// concurrency/AtomicIntegerTest.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.*;

View File

@ -1,5 +1,7 @@
// concurrency/Atomicity.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// {Exec: javap -c Atomicity}
public class Atomicity {

View File

@ -1,5 +1,7 @@
// concurrency/AtomicityTest.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.concurrent.*;
public class AtomicityTest implements Runnable {

View File

@ -1,5 +1,7 @@
// concurrency/AttemptLocking.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Locks in the concurrent library allow you
// to give up on trying to acquire a lock.
import java.util.concurrent.*;

View File

@ -1,5 +1,7 @@
// concurrency/BankTellerSimulation.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Using queues and multithreading.
// {Args: 5}
import java.util.concurrent.*;

View File

@ -1,5 +1,7 @@
// concurrency/BasicThreads.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// The most basic use of the Thread class.
public class BasicThreads {

View File

@ -1,5 +1,7 @@
// concurrency/CachedThreadPool.java
// Š2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.concurrent.*;
public class CachedThreadPool {

View File

@ -1,5 +1,7 @@
// concurrency/CallableDemo.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.concurrent.*;
import java.util.*;

View File

@ -1,5 +1,7 @@
// concurrency/CaptureUncaughtException.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// {TimeOutDuringTesting}
import java.util.concurrent.*;

View File

@ -1,5 +1,7 @@
// concurrency/CarBuilder.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// A complex example of tasks working together.
import java.util.concurrent.*;
import java.util.*;

View File

@ -1,5 +1,7 @@
// concurrency/Chopstick.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Chopsticks for dining philosophers.
public class Chopstick {

View File

@ -1,5 +1,7 @@
// concurrency/CloseResource.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Interrupting a blocked task by
// closing the underlying resource.
// {TimeOutDuringTesting}

View File

@ -1,5 +1,7 @@
// concurrency/CountDownLatchDemo.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.concurrent.*;
import java.util.*;

View File

@ -1,5 +1,7 @@
// concurrency/CriticalSection.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// {TimeOutDuringTesting}
// (Behavior may have changed in Java 8).
// Synchronizing blocks instead of entire methods. Also

View File

@ -1,5 +1,7 @@
// concurrency/DaemonFromFactory.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Using a Thread Factory to create daemons.
import java.util.concurrent.*;
import onjava.*;

View File

@ -1,5 +1,7 @@
// concurrency/Daemons.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Daemon threads spawn other daemon threads.
import java.util.concurrent.*;

View File

@ -1,5 +1,7 @@
// concurrency/DaemonsDoRunFinally.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Daemon threads now run the finally clause
import java.util.concurrent.*;

View File

@ -1,5 +1,7 @@
// concurrency/DeadlockingDiningPhilosophers.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Demonstrates how deadlock can be hidden in a program.
// {Args: 0 5 timeout}
import java.util.concurrent.*;

View File

@ -1,5 +1,7 @@
// concurrency/DelayQueueDemo.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.concurrent.*;
import java.util.*;
import static java.util.concurrent.TimeUnit.*;

View File

@ -1,5 +1,7 @@
// concurrency/EvenChecker.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.concurrent.*;
public class EvenChecker implements Runnable {

View File

@ -1,5 +1,7 @@
// concurrency/EvenSupplier.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// When threads collide.
public class EvenSupplier extends IntSupplier {

View File

@ -1,5 +1,7 @@
// concurrency/ExceptionThread.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// {ValidateByHand}
// {ThrowsException}
import java.util.concurrent.*;

View File

@ -1,5 +1,7 @@
// concurrency/ExchangerDemo.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.concurrent.*;
import java.util.*;
import java.util.function.*;

View File

@ -1,5 +1,7 @@
// concurrency/ExplicitCriticalSection.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// {ThrowsException} on a multiprocessor machine
// Using explicit Lock objects to create
// critical sections.

View File

@ -1,5 +1,7 @@
// concurrency/FastSimulation.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.*;

View File

@ -1,5 +1,7 @@
// concurrency/Fat.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// 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