Java Reference
In-Depth Information
cars3)); // Output: false
System.out.println(Objects.deepEquals(cars1,
cars4)); // Output: false
System.out.println(Objects.deepEquals(cars1,
cars5)); // Output: false
Thecommentsrevealthattwoarraysaredeeplyequalwhentheycontainthe
same number of equal elements.
3. Createa Die applicationthatuses Random tosimulatetheroleofa die (a
single dice). Output the value.
Summary
Java 5 introduced the concurrency utilities to simplify the development of concurrent
applications. The concurrency utilities are organized into executor, synchronizer, con-
currentcollection,lock,atomicvariable,andadditionalutilitiescategories,andleverage
the low-level Threading API in their implementations.
An executor decouples task submission from task-execution mechanics and is de-
scribedbythe Executor , ExecutorService ,and ScheduledExecutorSer-
vice interfaces. A synchronizer facilitates common forms of synchronization: count-
downlatches,cyclicbarriers,exchangers,phasers,andsemaphoresarecommonlyused
synchronizers.
A concurrent collection is an extension to the Collections Framework. A lock sup-
ports high-level locking and can associate with conditions in a manner that is distinct
from built-in synchronization and monitors. An atomic variable encapsulates a single
variable, and supports lock-free, thread-safe operations on that variable.
Java 7's new ThreadLocalRandom class describes a random number generator
thatisisolatedtothecurrentthread,anditsnewFork/JoinFrameworkletsyourecurs-
ivelybreakataskintosubtasksandcombineresultstomakemaximumuseoutofmul-
tiple processors and/or processor cores.
The new Objects class consists of class methods for operating on objects. These
utilitiesincludenull-safeornull-tolerantmethodsforcomparingtwoobjects,computing
thehashcodeofanobject,requiringthatareferencenotbenull,andreturningastring
for an object.
The Math class's random() methodisimplementedintermsofthe Random class,
whose instances are known as random number generators. Random generates a se-
quence of random numbers by starting with a special 48-bit seed. This value is subse-
Search WWH ::




Custom Search