J# programming language, 8
J++ programming language, 8
delegates in, 280
Jar Bundler utility, 783
creating, 780
dropping in jre/lib/ext directory, 193
sealing, 787
jar program, 780
command-line options of, 781–782
Java programming language
architecture-neutral object file format of, 5
as a programming platform, 1–2
available under GPL, 14
calling by value in, 165
case-sensitiveness of, 26, 42, 53–56, 528
communicating with JavaScript, 809
compiling/launching from the command line, 24
documentation for, 23
dynamic, 8
dynamic binding in, 209, 214–217
garbage collection in, 68, 139
interpreter in, 7
networking capabilities of, 4
no multiple inheritance in, 297
no operator overloading in, 109
no unsigned types in, 48
reliability of, 4
vs. C++, 3
Java 2 (J2), 18
floating-point coordinates in, 561
Java collections framework (JCF), 459–536
converting between collections and arrays in, 525–526
operations in:
optional, 514
separating interfaces from implementations in, 460–463
views and wrappers in, 509–517
vs. traditional collections libraries, 465
Java Concurrency in Practice (Goetz), 840
Java Development Kit (JDK), 5, 17–39
fonts shipped with, 574
default, 780
.java file extension, 43
Java Language Specification, 43
Java look-and-feel, 611
Java Memory Model and Thread Specification, 885
Java Network Launch Protocol (JNLP), 824–838
control panel of, 827
enabling, 34
installing, 803
Java console in, 807
running local applets in, 806
java program, 25
command-line options of, 385–386
Java Runtime Environment (JRE), 18
adding static methods to interfaces in, 298–299, 523
completable futures in, 931
concurrent hash maps in, 906–911
constructor expressions in, 433
hash tables in, 486
Java Plug-in for, 34
lambda expressions in, 314–329, 464, 887
LongAdder, LongAccumulator classes in, 888
parallelized operations on arrays in, 912
Java virtual machine (JVM), 6
launching, 25
monitoring and managing applications in, 412
optimizing execution in, 391
precomputing method tables in, 216
security vulnerabilities in, 803
thread priority levels in, 859
truncating arithmetic computations in, 56
watching class loading in, 411
Java Virtual Machine Specification, 44
launching, 826
printing in, 832
security of, 829
java.applet.Applet API, 807–808, 816–817, 820
java.applet.AppletContext API, 820
java.awt.BorderLayout API, 644
java.awt.Color API, 572
java.awt.Component API, 552, 559, 573, 624, 651, 724
java.awt.Container API, 595, 641
java.awt.event.ActionEvent API, 598
java.awt.event.InputEvent API, 623
java.awt.event.MouseEvent API, 623, 686
java.awt.event.WindowEvent API, 607
java.awt.event.WindowListener API, 606
java.awt.event.WindowStateListener API, 607
java.awt.EventQueue API, 943
java.awt.FlowLayout API, 641
java.awt.font.LineMetrics API, 581
java.awt.FontMetrics API, 582
java.awt.Frame API, 553
java.awt.geom.Ellipse2D.Double API, 569
java.awt.geom.Line2D.Double API, 569
java.awt.geom.Point2D.Double API, 569
java.awt.geom.Rectangle2D.Double API, 568
java.awt.geom.Rectangle2D.Float API, 569
java.awt.geom.RectangularShape API, 568
java.awt.Graphics API, 572, 581, 585–586
java.awt.Graphics2D API, 573, 582
java.awt.GraphicsEnvironment API, 778
java.awt.GridLayout API, 648
java.awt.LayoutManager API, 728
java.awt.Robot API, 778
java.awt.Toolkit API, 305, 553, 623
java.beans.EventHandler API, 598
java.io.Console API, 81
java.io.PrintWriter API, 89
java.lang.Boolean API, 237
java.lang.Byte API, 237
java.lang.Character API, 237
java.lang.Class API, 244, 265, 270, 275, 451, 457, 787
java.lang.ClassLoader API, 388
java.lang.Comparable API, 293
java.lang.Double API, 237, 294
java.lang.Enum API, 260
java.lang.Exception API, 380
java.lang.Float API, 237
java.lang.Integer API, 237, 255–256, 294
java.lang.Long API, 237
java.lang.Object API, 132, 237, 244, 489, 881–882
java.lang.Objects API, 237
java.lang.reflect package, 265, 276
java.lang.reflect.AccessibleObject API, 275
java.lang.reflect.Array API, 279
java.lang.reflect.Constructor API, 265, 270, 452
java.lang.reflect.Field API, 270, 276
java.lang.reflect.GenericArrayType API, 458
java.lang.reflect.InvocationHandler API, 355
java.lang.reflect.Method API, 270, 283, 457
java.lang.reflect.Modifier API, 271
java.lang.reflect.ParameterizedType API, 458
java.lang.reflect.Proxy API, 356
java.lang.reflect.TypeVariable API, 457
java.lang.reflect.WildcardType API, 458
java.lang.Runnable API, 851
java.lang.RuntimeException API, 380
java.lang.Short API, 237
java.lang.StackTraceElement API, 380–381
java.lang.StringBuilder API, 78
java.lang.System API, 81, 509, 793
java.lang.Thread API, 846, 851, 854, 858–861
java.lang.Thread.UncaughtExceptionHandler API, 861
java.lang.ThreadGroup API, 862
java.lang.ThreadLocal API, 893
java.lang.Throwable API, 265, 366, 379–380
java.math.BigDecimal API, 111
java.math.BigInteger API, 110
java.nio.file.Paths API, 89
java.text.NumberFormat API, 256
java.time.LocalDate API, 145
java.util.ArrayDeque API, 495
java.util.ArrayList API, 247, 251
java.util.Arrays API, 119–120, 234, 238, 294, 516
java.util.BitSet API, 533
java.util.Collection API, 468–469, 524
java.util.Collections API, 514–515, 520–524, 915
java.util.Comparator API, 521
java.util.concurrent package, 868
canned functionality classes in, 934–937
efficient collections in, 905–907
java.util.concurrent.ArrayBlockingQueue API, 903
java.util.concurrent.atomic package, 886
java.util.concurrent.BlockingDeque API, 904–905
java.util.concurrent.BlockingQueue API, 904
java.util.concurrent.Callable API, 919
java.util.concurrent.ConcurrentHashMap API, 907
java.util.concurrent.ConcurrentLinkedQueue API, 907
java.util.concurrent.ConcurrentSkipListMap API, 907
java.util.concurrent.ConcurrentSkipListSet API, 907
java.util.concurrent.Delayed API, 903
java.util.concurrent.DelayQueue API, 903
java.util.concurrent.ExecutorCompletionService API, 928
java.util.concurrent.Executors API, 925–926
java.util.concurrent.ExecutorService API, 925, 928
java.util.concurrent.Future API, 919–920
java.util.concurrent.FutureTask API, 920
java.util.concurrent.LinkedBlockingQueue API, 903
java.util.concurrent.locks.Condition API, 877, 895
java.util.concurrent.locks.Lock API, 871, 877, 894
java.util.concurrent.locks.ReentrantLock API, 872
java.util.concurrent.locks.ReentrantReadWriteLock API, 896
java.util.concurrent.PriorityBlockingQueue API, 904
java.util.concurrent.ScheduledExecutorService API, 926
java.util.concurrent.ThreadLocalRandom API, 893
java.util.concurrent.ThreadPoolExecutor API, 926
java.util.concurrent.TransferQueue API, 905
java.util.Enumeration API, 530
java.util.EnumMap API, 508
java.util.EnumSet API, 508
java.util.EventObject API, 598
java.util.function API, 319
java.util.HashMap API, 500
java.util.HashSet API, 488
java.util.Hashtable API, 530
java.util.IdentityHashMap API, 509
java.util.Iterator API, 469
java.util.LinkedHashMap API, 508
java.util.LinkedHashSet API, 507
java.util.LinkedList API, 484
java.util.List API, 482–483, 516, 521, 524
java.util.ListIterator API, 483
java.util.logging.ConsoleHandler API, 407
java.util.logging.FileHandler API, 407
java.util.logging.Filter API, 408
java.util.logging.Formatter API, 408
java.util.logging.Handler API, 406
java.util.logging.Logger API, 404–406
java.util.logging.LogRecord API, 407–408
java.util.Map API, 499, 501–503
java.util.Map.Entry API, 503
java.util.NavigableMap API, 517
java.util.NavigableSet API, 493, 516
java.util.Objects API, 235
java.util.prefs.Preferences API, 799–800
java.util.PriorityQueue API, 496
java.util.Properties API, 531, 792–793
java.util.Queue API, 494
java.util.Random API, 181
java.util.ServiceLoader API, 802
java.util.SortedMap API, 500, 516
java.util.SortedSet API, 493, 516
java.util.Stack API, 532
java.util.TreeMap API, 500
java.util.TreeSet API, 493
java.util.Vector API, 530
java.util.WeakHashMap API, 507
javac program, 25
current directory in, 192
command-line options of, 199
comments in:
general, 196
overview, 198
redeclaring Object methods for, 318
HTML markup in, 194
hyperlinks in, 198
links to other files in, 195
online documentation of, 199
JavaFX, 543
javap program, 336
JavaScript, 15
accessing applets from, 810
communicating with Java, 809
javaws program, 828
javaws.jar file, 830
javax.jnlp.BasicService API, 836
javax.jnlp.FileContents API, 837
javax.jnlp.FileOpenService API, 837
javax.jnlp.FileSaveService API, 837
javax.jnlp.PersistenceService API, 837–838
javax.jnlp.ServiceManager API, 836
javax.swing package, 545
javax.swing.AbstractAction API, 683
javax.swing.AbstractButton API, 663, 681–684, 688
javax.swing.Action API, 615
javax.swing.border.LineBorder API, 668
javax.swing.border.SoftBevelBorder API, 667
javax.swing.BorderFactory API, 666–667
javax.swing.ButtonGroup API, 663
javax.swing.ButtonModel API, 663
javax.swing.event package, 627
javax.swing.event.MenuListener API, 690
javax.swing.filechooser.FileFilter API, 764
javax.swing.filechooser.FileNameExtensionFilter API, 764
javax.swing.filechooser.FileView API, 764
javax.swing.GroupLayout API, 722
javax.swing.GroupLayout.Group API, 723
javax.swing.GroupLayout.ParallelGroup API, 723
javax.swing.GroupLayout.SequentialGroup API, 723
javax.swing.ImageIcon API, 554
javax.swing.JButton API, 595, 752
javax.swing.JCheckBox API, 659
javax.swing.JCheckBoxMenuItem API, 684
javax.swing.JColorChooser API, 770
javax.swing.JComboBox API, 671
javax.swing.JComponent API, 560, 582, 615, 650, 668, 686, 699, 752
javax.swing.JDialog API, 745
javax.swing.JFileChooser API, 762–763
javax.swing.JFrame API, 559, 682
javax.swing.JLabel API, 652
javax.swing.JMenu API, 681
javax.swing.JMenuItem API, 681–682, 688, 690
javax.swing.JOptionPane API, 304, 739–741
javax.swing.JPasswordField API, 653
javax.swing.JPopupMenu API, 685
javax.swing.JRadioButton API, 663
javax.swing.JRadioButtonMenuItem API, 684
javax.swing.JRootPane API, 752
javax.swing.JScrollPane API, 656
javax.swing.JSlider API, 678
javax.swing.JTextArea API, 656
javax.swing.JTextField API, 650
javax.swing.JToolBar API, 699
javax.swing.KeyStroke API, 615
javax.swing.SwingUtilities API, 752
javax.swing.SwingWorker API, 950
javax.swing.text.JTextComponent API, 648
javax.swing.Timer API, 305
javax.swing.UIManager API, 602
javax.swing.UIManager.LookAndFeelInfo API, 603
JButton class, 591, 595, 610, 636–638
isDefaultButton method, 752
JCheckBoxMenuItem class, 683–684
methods of, 770
getItemAt method, 669
getSelectedItem method, 669–671
isEditable method, 671
setModel method, 669
JComponent class, 554
action maps, 612
get/setComponentPopupMenu methods, 685–686
get/setInheritsPopupMenu methods, 685–686
getActionMap method, 615
getFontMetrics method, 577, 582
paintComponent method, 554–556, 560, 577, 583
repaint method, 951
revalidate method, 649–650, 951
setDebugGraphicsOptions method, 771
setFont method, 650
setSelectionStart/End methods, 952
setToolTipText method, 699
jconsole program, 393, 412, 771, 889
jcontrol program, 807
setDefaultCloseOperation method, 743, 807
setVisible method, 743, 746, 807
JDK. See Java Development Kit
JEditorPane class, 654
JFC (Java Foundation Classes), 539
addChoosableFileFilter method, 763
getSelectedFile/Files methods, 754, 763
resetChoosableFilters method, 756, 763
setAcceptAllFileFilterUsed method, 756, 763
setAccessory method, 763
setCurrentDirectory method, 754, 762
setFileFilter method, 755, 763
setFileSelectionMode method, 754, 763
setFileView method, 756–757, 763
setMultiSelectionEnabled method, 754, 763
setSelectedFile/Files methods, 754, 763
showDialog, showXxxDialog methods, 747, 752, 754, 763
getContentPane method, 559
internal structure of, 554–555
getIcon, getText methods, 652
setIcon, setText methods, 651–652
JList class, 670
jmap program, 413
JMenu class
add, addSeparator methods, 679, 681
insert, insertSeparator methods, 681
remove method, 681
setAccelerator method, 687–688
setIcon method, 682
Jmol applet, 9
compiling programs with, 830
join method (Thread), 73, 856–858
message types, 731
showConfirmDialog method, 731–732, 739
showInputDialog method, 731–732, 740
showInternalConfirmDialog method, 739
showInternalInputDialog method, 741
showInternalMessageDialog method, 739
showInternalOptionDialog method, 740
showMessageDialog method, 304, 731–732, 739
showOptionDialog method, 731–732, 739–740
getPassword, setEchoChar methods, 653
isPopupTrigger, show methods, 685
JRadioButtonMenuItem class, 684
JRootPane class, setDefaultButton method, 748, 752
JScrollbar class, 627
JScrollPane class, 656
setLabelTable method, 429, 673, 678
setPaintLabels method, 673, 678
setPaintTicks method, 673, 678
setPaintTrack method, 674, 678
setSnapToTicks method, 673, 678
setXxxTickSpacing methods, 678
insert method, 951
replaceRange method, 951
setColumns, setRows methods, 654, 656
setTabSize method, 656
setWrapStyleWord method, 656
JTextComponent class
getText method, 650
is/setEditable methods, 648
JTextField class, 627, 649–651
getColumns method, 650
add, addSeparator methods, 695–699
JUnit framework, 410
Just-in-time compiler, 6–7, 14, 153, 218, 413, 534
JVM. See Java virtual machine
K type variable, 419
Key/value pairs. See Properties
KeyAdapter class, 626
Keyboard
associating with actions, 610
focus of, 611
Keyboard focus, 729
KeyEvent class, 626
getKeyXxx, isActionKey methods, 627
KeyListener interface, 626
keyXxx methods, 627
keyPress/Release methods (Robot), 778
keys method
of Hashtable, 530
keySet method
of ConcurrentHashMap, 912
KeyStroke class, getKeyStroke method, 610, 615
Knuth, Donald, 106
KOI-8 standard, 51
L suffix (long integers), 48
Labeled break statement, 106
Labels
for slider ticks, 673
accessing variables in, 322–324
atomic updates with, 887
capturing values by, 323
for event listeners, 595
functional interfaces and, 318
method references and, 320
no assigning to a variable of type Object, 319
parameter types of, 316
result type of, 316
scope of, 324
this keyword in, 324
vs. inner classes, 318
lambda/LambdaTest.java, 317
Langer, Angelika, 458
last method (SortedSet), 493
lastIndexOf method
of List, 483
of String, 73
lastIndexOfSubList method (Collections), 524
lastKey method (SortedMap), 500
Launch4J utility, 783
absolute positioning, 723
box, 700
flow, 638
spring, 700
LayoutManager interface
methods of, 728
LayoutManager2 interface, 725
Leading (in typesetting), 576
Legacy code and generics, 429–430
hash tables, 528
stacks, 531
length method
of arrays, 112
of BitSet, 533
of StringBuilder, 78
Lightweight collection wrappers, 509–510
Line2D.Double class, 569
Linefeed, escape sequence for, 50
LineMetrics class, 577
getXxx methods, 581
Lines, 560
constructing, 565
@link comment (javadoc), 198
Linked hash maps/sets, 504–506
concurrent modifications of, 479
doubly linked, 474
printing, 481
removing elements from, 475
LinkedBlockingDeque class, 903
LinkedBlockingQueue class, 899
access vs. insertion order, 505
as a concrete collection type, 472
removeEldestEntry method, 506, 508
as a concrete collection type, 472
LinkedList class, 462, 476, 479, 494
addFirst/Last, getFirst/Last methods, 484
as a concrete collection type, 472
get method, 480
listIterator method, 476
next/previousIndex methods, 480
removeAll method, 480
removeFirst/Last methods, 484
linkedList/LinkedListTest.java, 481
linkSize method (GroupLayout), 722
Linux
debugging applets in, 807
Eclipse versions for, 27
JDK versions for, 18
no thread priorities in Oracle JVM for, 859
pop-up trigger in, 685
setting up JDK in, 20
troubleshooting Java programs in, 26
addAll method, 482
indexOf, lastIndexOf methods, 483
listIterator method, 482
replaceAll method, 524
sort method, 521
Listener interfaces, 588
Listener objects, 588
Listeners. See Action listeners, Event listeners, Window listeners
ListIterator interface, 479
next/previousIndex methods, 483
remove method, 478
listIterator method
of LinkedList, 476
of List, 482
Lists, 470
modifiable/resizable, 520
of ServiceLoader, 802
Local inner classes, 339
accessing final variables from outer methods in, 339–342
Local variables
annotating, 430
vs. instance fields, 151–152, 173
extending, 285
minusDays method, 145
processing arrays of, 446
Locales, 393
Localization, 136, 393–394, 784–785
Lock interface, 878
lockInterruptibly method, 893–895
vs. synchronization methods, 880
client-side, 883
fair, 872
hold count for, 870
inconsistent state and, 896
not with try-with-resources statement, 869
reentrant, 870
Locks
condition objects for, 872–877
in synchronized blocks, 882–883
log, log10 methods (Math), 58
Logarithms, 58
Logger class
add/removeHandler methods, 406
entering, exiting methods, 391, 405
get/setFilter methods, 398, 406
get/setParent methods, 406
get/setUseParentHandlers methods, 406
getHandlers method, 406
getLevel method, 405
info method, 389
logrb method, 405
severe, warning, info, config, fine, finer, finest methods, 390, 404
Loggers
hierarchical names of, 390
basic, 389
file pattern variables for, 396
file rotation for, 397
filters for, 398
formatters for, 399
configuring, 396
including class names in, 344
messages for, 240
Logging proxy, 410
logging/LoggingImageViewer.java, 400
logging.properties file, 392–393
Logical conditions, 52
Logical “and,” “or,” 62
LogManager class, 393
readConfiguration method, 392
LogRecord class
getLevel method, 407
getLoggerName method, 407
getMessage method, 407
getMillis method, 408
getParameters method, 407
getResourceBundle, getResourceBundleName methods, 407
getSequenceNumber method, 408
getSourceXxxName methods, 408
getThreadID method, 408
getThrown method, 408
Long class
converting from long, 252
hashCode method, 237
long type, 47
platform-independence of, 48
LongAccumulator class, methods of, 888
add, increment, sum methods, 888
appearance of buttons in, 632
pluggable, 756
LookAndFeelInfo class, methods of, 603
lookup method (ServiceManager), 836
Loops
continue statements in, 108
LotteryArray/LotteryArray.java, 126
LotteryDrawing/LotteryDrawing.java, 118
LotteryOdds/LotteryOdds.java, 102
lower method (NavigableSet), 493
Low-level events, 626
Lu, Francis, 810
Mac OS X
Eclipse versions for, 27
executing JARs in, 783
JDK versions for, 18
setting paths in, 20
setting up JDK in, 20
body of, 44
declared public, 43
eliminating, for applets, 807
loading classes from, 262
separate for each class, 409
String[] args parameter of, 116
tagged with throws, 88
make program (UNIX), 149
MANIFEST.MF (manifest file), 781–782
editing, 782
newline characters in, 782
permissions in, 823
Map interface, 469
compute, computeIfPresent/Absent methods, 501
containsKey/Value methods, 499
entrySet, keySet methods, 502–503
forEach method, 499
get, put methods, 469, 497, 499
merge method, 501
putAll method, 499
remove method, 498
replaceAll method, 502
map/MapTest.java, 498
Map.Entry interface, 502
getKey, get/setValue methods, 503
mappingCount method (ConcurrentHashMap), 906
adding/retrieving objects to/from, 497
garbage collecting, 504
hash vs. tree, 497
implementations for, 497
keys for, 498
enumerating, 502
subranges of, 511
Marker interfaces, 309
E, PI static constants, 58, 159
floorMod method, 57
logarithms, 58
round method, 60
sqrt method, 57
trigonometric functions, 58
max method (Collections), 523
Maximum value, computing, 419
menu/MenuFrame.java, 690
MenuListener interface, 689
checkboxes and radio buttons in, 683–684
keyboard mnemonics for, 686–688
menu bar in, 679
menu items in, 679–684 enabling/disabling, 689–693
submenus in, 679
merge method
of ConcurrentHashMap, 909
of Map, 501
Merge sort algorithm, 519
META-INF directory, 781
Method class, 265
getDeclaringClass method, 270
getExceptionTypes method, 270
getGenericXxx methods, 457
getParameterTypes, getReturnType methods, 270
getTypeParameters method, 457
toString method, 266
Method parameters. See Parameters
this, super parameters in, 320
Method tables, 216
Methods, 131
abstract, 222
in functional interfaces, 318
accessor, 141–145, 153–154, 444
adding, in subclasses, 207
applying to objects, 137
asynchronous, 915
calling by reference vs. by value, 164–171
concrete, 222
consistent, 231
documentation comments for, 194–198
do-nothing, 604
dynamic binding for, 209, 214–217
exception specification in, 362
factory, 161
generic, 421–422, 427–429, 466–469
invoking, 45
names of, 201
overloading, 172
exceptions and, 364
return type and, 427
package scope of, 189
passing objects to, 136
reflexive, 231
resolving conflicts in, 300–302
static, 160–161, 185, 215, 436
adding to interfaces, 298
symmetric, 231
tracing, 351
transitive, 231
passing generic types to, 432–433
visibility of, in subclasses, 217
methods/MethodTableTest.java, 282
Micro Edition (Java ME), 3, 11, 18
Microsoft
.NET platform, 6
Internet Explorer, 9, 15, 803, 810
Visual Basic, 3, 136, 587, 638
Visual Studio, 23
MIME types, 825
min method (Collections), 523
Minimum value, computing, 419
minimumLayoutSize method (LayoutManager), 728
minusDays method (LocalDate), 145
mod method (BigDecimal, BigInteger), 110–111
Model-view-controller design pattern, 632–636
classes in, 632
multiple views in, 634
Modifier class
isAbstract, isInterface, isNative, isProtected, isStatic, isStrict, isSynchronized, isVolatile methods, 271
isFinal, isPrivate, isPublic, toString methods, 265, 271
Modulus, 56
Monitor concept, 884
Mosaic, 10
with keyboard modifiers, 616
mouse/MouseComponent.java, 620
mouse/MouseFrame.java, 619
MouseEvent class, 626
getClickCount method, 616, 623, 627
isPopupTrigger method, 686
translatePoint method, 627
MouseHandler class, 619
MouseListener interface, 617, 626
mouseClicked method, 616–617, 619, 627
mouseDragged method, 619
mouseEntered/Exited methods, 619, 627
mousePressed method, 616–617, 627
mouseReleased method, 616, 627
MouseMotionHandler class, 619
MouseMotionListener interface, 617, 619, 626
mouseDragged method, 628
mouseMoved method, 618–619, 628
MouseWheelEvent class, 626
getScrollAmount, getWheelRotation methods, 628
MouseWheelListener interface, mouseWheelMoved method, 628
mouseXxx methods (Robot), 778
Mozilla Firefox, 34
Multidimensional arrays, 120–125
printing, 240
Multiple inheritance, 297
not supported in Java, 213
Multiplication operator, 56
multiply method (BigDecimal, BigInteger), 110–111
Multitasking, 839
deferred execution in, 325
performance and, 872, 888, 899, 920
preemptive vs. cooperative scheduling for, 855
Mutator methods, 444
error checking in, 154
\n escape sequence, 50
NaN (not a number), 49
Napkin look-and-feel, 542
naturalOrder method (Comparator), 329
NavigableMap interface, 471
subMap, headMap, tailMap methods, 517
NavigableSet interface, 471, 490, 511
ceiling, floor methods, 493
descendingIterator method, 493
higher, lower methods, 493
pollFirst/Last methods, 493
subSet, headSet, tailSet methods, 511, 516
nCopies method (Collections), 510, 515
Negation operator, 62
Negative infinity, 49
.NET platform, 6
specifying grid bag constraints in, 706
Netscape, 10
IFC library, 538
LiveScript/JavaScript, 15
Navigator browser, 9, 803, 810
Networking, 4
new operator, 64, 71, 136, 150
return value of, 138
with arrays, 111
with generic classes, 245
with threads, 855
new keyword, in constructor references, 321
newCachedThreadPool method (Executors), 921, 925
newCondition method (Lock), 873, 877
newFixedThreadPool method (Executors), 921, 925
newInstance method
newKeySet method (ConcurrentHashMap), 912
newProxyInstance method (Proxy), 350, 355–356
newScheduledThreadPool method (Executors), 921, 926
newSingleThreadExecutor method (Executors), 921, 925
newSingleThreadScheduledExecutor method (Executors), 921, 926
next method
of Scanner, 81
nextDouble method (Scanner), 79, 81
nextElement method (Enumeration), 465, 528, 530
nextIndex method
of LinkedList, 480
of ListIterator, 483
nextInt method
of Random, 181
nextLine method (Scanner), 79, 81
Nimbus look-and-feel, 541
No-argument constructors, 173, 208, 801
NoClassDefFoundError, 26
node method (Preferences), 794, 799
noneOf method (EnumSet), 508
NoSuchElementException, 464, 469, 483, 494–495
Notepad text editor, 26
notHelloWorld/NotHelloWorld.java, 558
notify, notifyAll methods (Objects), 878, 881–882
now method (LocalDate), 140, 145
null value, 138
equality testing to, 231
nullFirst/Last methods (Comparator), 329
NullPointerException, 361, 383
Number class, 253
NumberFormat class
factory methods, 161
parse method, 256
NumberFormatException, 383
Numeric types
converting:
to strings, 254
default initialization of, 172
fixed sizes for, 6
precision of, 108
printing, 82
Oak programming language, 10
clone method, 156, 306–313, 318
equals method, 229–235, 244, 302, 512
getClass method, 244
hashCode method, 235, 237, 489
no redefining for methods of, 302
notify, notifyAll methods, 878, 881–882
toString method, 238–244, 302, 318
Object references
as method parameters, 165
converting, 219
default initialization of, 172
modifying, 166
Object traversal algorithms, 507
Object variables, 223
in predefined classes, 136–139
initializing, 137
setting to null, 138
vs. C++ object pointers, 139
vs. objects, 137
objectAnalyzer/ObjectAnalyzer.java, 273
objectAnalyzer/ObjectAnalyzerTest.java, 273
Object-oriented programming (OOP), 4, 130–135, 203
design principles of, 632
passing objects in, 302
separating time measurement from calendars in, 140
applying methods to, 137
behavior of, 132
comparing, 295
concatenating with strings, 239
damaged, 896
default hash codes of, 235
equality testing for, 229–235, 262
identity of, 132
implementing an interface, checks of, 295
in predefined classes, 136–139
initializing, 136
intrinsic locks of, 878
passing to methods, 136
references to, 138
runtime type identification of, 261
serializing, 507
sorting, 290
vs. object variables, 137
Objects class
hash method, 237
Ocean look-and-feel, 541
Octal numbers
formatting output for, 82
prefix for, 48
of method
of EnumSet, 508
offer method
of BlockingQueue, 898–899, 904
of Queue, 494
offerFirst/Last methods
of BlockingDeque, 905
of Deque, 494
offsetByCodePoints method (String), 70, 72
Online documentation, 71, 74–77, 194, 199
openFileDialog method (FileOpenService), 830, 837
openMultiFileDialog method (FileOpenService), 837
OpenType format, 575
Operators
bitwise, 63
boolean, 62
no overloading for, 109
relational, 62
Optional operations, 514
optionDialog/ButtonPanel.java, 738
optionDialog/OptionDialogFrame.java, 734
or method (BitSet), 533
Java Plug-in, 803
JavaFX, 543
ordinal method (Enum), 260
org.omg.CORBA package, 255
Originating host, 821
OSGi platform, 800
Output statements, 66
Overloading resolution, 172, 215
@Override annotation, 234
overview.html, 198
Owner frame, 742
p (exponent), in hexadecimal numbers, 49
pack method (Window), 550, 557, 560
pack200 compression, 780
package.html, 198
package-info.java, 198
default, 185
documentation comments for, 194, 198
importing, 183
online documentation for, 71
sealing, 787
PackageTest/com/horstmann/corejava/Employee.java, 188
PackageTest/PackageTest.java, 187
paintComponent method (JComponent), 554–556, 560, 577, 583, 897
overriding, 624
pair1/PairTest1.java, 420
pair2/PairTest2.java, 423
pair3/PairTest3.java, 449
Parallelism threshold, 910
Parameterized types. See Type parameters
ParameterizedType interface, 453
getXxx methods, 458
checking, with assertions, 386–387
documentation comments for, 196
names of, 175
string, 45
using collection interfaces in, 527
passing generic types to, 432–433
ParamTest/ParamTest.java, 170
Parent classes. See Superclasses
parse method (NumberFormat), 256
parseInt method (Integer), 254, 256, 811
Pascal, 10
architecture-neutral object file format of, 5
passing parameters in, 167
PasswordChooser class, 746
Passwords
dialog box for, 746
reading from console, 80
PATH environment variable, 20
Path interface, 298
Payne, Jonathan, 11
peek method
of Queue, 494
of Stack, 532
peekFirst/Last methods (Deque), 495
Performance, 7
collections and, 471, 486, 906
JAR files and, 190
measuring with the sieve of Eratosthenes, 533–536
multithreading and, 872, 888, 899, 920
of tests vs. catching exceptions, 381
Permits, 935
PersistenceService class, 831
delete method, 838
get, getNames methods, 838
Persistent storage, 272
Phaser class, 937
Physical limitations, 359
plaf/PlafFrame.java, 601
play method (Applet), 817
plusDays method (LocalDate), 141, 145
Point class, 564
Point size (in typesetting), 574–575
Point2D.Double class, 563, 569
Point2D.Float class, 563
poll method
of BlockingQueue, 898–899, 904
of ExecutorCompletionService, 928
of Queue, 494
pollFirst/Last methods
of NavigableSet, 493
Polymorphism, 209, 213–214, 285
pop method (Stack), 532
triggers for, 685
Pop-up windows, 821
Positive infinity, 49
PostScript Type 1 format, 575
Precision, of numbers, 82
Preconditions, 387
Predefined action table names, 609
mutator and accessor methods in, 141–145
objects and object variables in, 136–139
Preemptive scheduling, 855
accessing, 794
enumerating keys in, 795
importing/exporting, 795
get, getDataType methods, 795, 800
importPreferences method, 795, 800
platform-independency of, 794
put, putDataType methods, 795, 800
system/userNodeForPackage methods, 794, 799
system/userRoot methods, 794, 799
preferences/PreferencesTest.java, 796
preferredLayoutSize method (LayoutManager), 728
previous method (ListIterator), 476, 483
previousIndex method
of LinkedList, 480
of ListIterator, 483
Prime numbers, 533
as method parameters, 165
comparing, 328
converting to objects, 252
final fields of, 157
not for type parameters, 430–431
transforming hash map values to, 911
values of, not object, 229
Princeton University, 5
print method (System.out), 46, 82
printf method (System.out), 82–86
conversion characters for, 82
parameters of, 256
println method (System.out), 45–46, 79, 319, 389
printStackTrace method (Throwable), 264–265, 377, 410
PrintStream class, 830
Priority queues, 495
PriorityBlockingQueue class, 899, 904
PriorityQueue class, 496
as a concrete collection type, 472
priorityQueue/PriorityQueueTest.java, 496
private access modifier, 150, 189–190, 333
checking, 265
for fields, in superclasses, 206
Procedures, 130
process method (SwingWorker), 944–946, 950
Processes, vs. threads, 840
Producer threads, 898
Profilers, 413
Programs. See Applications
Properties class, 528–531, 788–793
getProperty method, 531, 789, 792
load, store methods, 531, 788, 793
setProperty method, 792
properties/PropertiesTest.java, 790
Property maps, 530–531, 788–793
comments in, 599
names of, 788
reading/writing, 788
PropertyChangeListener interface, 758
protected access modifier, 227–228, 311
for fields, 283
purposes of, 351
get/isProxyClass methods, 355–356
newProxyInstance method, 350, 355–356
proxy/ProxyTest.java, 353
public access modifier, 42, 56, 147–150, 189–190, 290
checking, 265
for fields in interfaces, 296
for main method, 43
for only one class in source file, 147
not specified for interfaces, 289
publish method
Pure virtual functions (C++), 224
push method (Stack), 532
put method, 908
of BlockingQueue, 898–899, 904
putAll method (Map), 499
putDataType methods (Preferences), 795, 800
putFirst/Last methods (BlockingDeque), 904
putIfAbsent method (ConcurrentHashMap), 908
putValue method (Action), 608, 615
Queue interface, 460, 462, 494–495
methods of, 494
double-ended. See Deques
\r escape sequence, 50
and atomic operations, 887
radioButton/RadioButtonFrame.java, 662
Random class, 181
nextInt method, 181
thread-safe, 892
Random number generation, 181, 892
RandomAccess interface, 471, 520, 522
range method (EnumSet), 508
converting type parameters to, 441
type inquiring at runtime, 431
readConfiguration method (LogManager), 392
readLine/Password methods (Console), 81
Rectangle2D class, 560, 562–565
getWidth, setRect methods, 563
Rectangle2D.Double class, 562–563, 568
Rectangle2D.Float class, 562–563, 569
Rectangles, 560
comparing, 490
constructing, 564
drawing, 561
filling with color, 569
RectangularShape class, 563
getHeight/Width, getCenterX/Y methods, 563, 568
getX/Y, getMinX/Y, getMaxX/Y methods, 568
Recursive computations, 929
RecursiveAction class, 929
RecursiveTask class, 929
Red-black trees, 489
reduce, reduceXxx methods (ConcurrentHashMap), 910–911
Redundant keywords, 296
Reentrant locks, 870
ReentrantReadWriteLock class, 895–896
analyzing:
generics and, 276–279, 450–458
overusing, 286
reflection/ReflectionTest.java, 267
Relative resource names, 784
remove method
of JMenu, 681
of ListIterator, 478
of Map, 498
of Queue, 494
of ThreadLocal, 893
removeAll method
of LinkedList, 480
removeEldestEntry method (LinkedHashMap), 506, 508
removeFirst/Last methods
of Deque, 495
of LinkedList, 484
removeHandler method (Logger), 406
removeIf method
of ArrayList, 319
removeLayoutComponent method (LayoutManager), 728
removePropertyChangeListener method (Action), 608–609
removeXxx methods (JComboBox), 669, 671
repaint method
of Component, 556
replace method
of ConcurrentHashMap, 908
of String, 73
replaceAll method
of Collections, 523
of List, 524
of Map, 502
replaceRange method (JTextArea), 951
Reserved words, 43
forbidden for variable names, 53
not used, 56
resetChoosableFilters method (JFileChooser), 756, 763
resize method (Applet), 808
resource/ResourceTest.java, 786
ResourceBundle class, 394
closing, 373
exhaustion of, 360
localization of, 784
Restricted views, 514
resume method (Thread), 858
retain method (Collection), 467
retainAll method (Collection), 469
Retirement/Retirement.java, 97
Retirement2/Retirement2.java, 98
return statement
in finally blocks, 374
in lambda expressions, 316
Return types, 215
covariant, 429
documentation comments for, 196
for overridden methods, 427
Return values, 138
@return comment (javadoc), 196
revalidate method (JComponent), 649–650, 951
reverse method (Collections), 524
reversed, reverseOrder methods (Comparator), 329, 519, 521
RoadApplet/RoadApplet.html, 36
RoadApplet/RoadApplet.java, 38
methods of, 778
robot/RobotTest.java, 775
rotate method (Collections), 524
round method (Math), 60
Rounding mode, 111
RoundingMode class, 111
rt.jar file, 780
runAfterXxx methods (CompletableFuture), 934
runFinalizersOnExit method (System), 182
lambdas and, 318
Runtime
adding shutdown hooks at, 182
creating classes at, 350
setting the size of an array at, 244
type identification at, 220, 261, 431
RuntimeException, 360, 380, 383
@SafeVarargs annotation, 432
saveAsFileDialog method (FileSaveService), 837
saveFileDialog method (FileSaveService), 830, 837
Scala programming language, default methods in, 300
next, hasNext, hasNextType methods, 81
Scheduled execution, 926
ScheduledExecutorService class, methods of, 926
Sealing, 787
search, searchXxx methods (ConcurrentHashMap), 910–911
Secure certificates, 822
@see comment (javadoc), 197–198
Semantic events, 626
Semaphore class, 935
Semaphores, 935
SequentialGroup class, 714, 723
Serialization, 507
of applet objects, 809
ServiceLoader class, 801
iterator, load methods, 802
ServiceManager interface, 830
getServiceNames, lookup methods, 836
ServletException, 370
Servlets, 370
Set interface, methods of, 471
set method
of Array, 279
of BitSet, 533
of Field, 276
of List, 483
of ThreadLocal, 893
of Vector, 883
set/SetTest.java, 487
setAccelerator method (JMenuItem), 687–688
setAcceptAllFileFilterUsed method (JFileChooser), 756, 763
setAccessible method (AccessibleObject), 272, 275
setAccessory method (JFileChooser), 763
setAction method (AbstractButton), 681
setActionCommand method (AbstractButton), 663
setAutoCreateXxx methods (GroupLayout), 722
setBackground method (Component), 570, 573
setBoolean, setByte, setChar methods (Array), 279
setBorder method (JComponent), 664, 668
setBounds method (Component), 546, 552, 724
coordinates in, 548
setCharAt method (StringBuilder), 78
setClassAssertionStatus method (ClassLoader), 388
setColor method
of JColorChooser, 770
setColumns method
setComponentPopupMenu method (JComponent), 685–686
setCurrentDirectory method (JFileChooser), 754, 762
setCursor method (Component), 624
setDaemon method (Thread), 859–860
setDebugGraphicsOptions method (JComponent), 771
setDefaultAssertionStatus method (ClassLoader), 388
setDefaultButton method (JRootPane), 748, 752
setDefaultCloseOperation method (JDialog), 743, 807
setDefaultUncaughtExceptionHandler method (Thread), 411, 860–861
setDisplayedMnemonicIndex method (AbstractButton), 686, 688
setDouble method (Array), 279
setEchoChar method (JPasswordField), 653
setEditable method
of JTextComponent, 648
setEnabled method
setExtendedState method (Frame), 553
setFileFilter method (JFileChooser), 755, 763
setFileSelectionMode method (JFileChooser), 754, 763
setFileView method (JFileChooser), 756–757, 763
setFilter method
of Handler, 406
setFloat method (Array), 279
setFont method
of Graphics, 581
of JComponent, 650
setForeground method (Component), 570, 573
setFormatter method (Handler), 399, 406
setFrameFromCenter method (Ellipse2D), 565
setFrameFromDiagonal method (Ellipse2D), 564
setHonorsVisibility, setHorizontalGroup methods (GroupLayout), 722
setHorizontalTextPosition method (AbstractButton), 682–683
setIcon method
of JMenuItem, 682
setIconImage method (Frame), 546, 553
setInheritsPopupMenu method (JComponent), 685–686
setInt method (Array), 279
setInverted method (JSlider), 674, 678
setJMenuBar method (JFrame), 679, 682
setLabelTable method (JSlider), 429, 673, 678
setLayout method (Container), 641
setLevel method
of Handler, 406
setLineWrap method (JTextArea), 654, 656
setLocation method (Component), 546, 552
coordinates in, 548
setLocationByPlatform method (Window), 552
setLong method (Array), 279
setLookAndFeel method (UIManager), 599, 602
setMnemonic method (AbstractButton), 687–688
setModel method (JComboBox), 669
setMultiSelectionEnabled method (JFileChooser), 754, 763
setOut method (System), 159
setPackageAssertionStatus method (ClassLoader), 388
setPaint method (Graphics2D), 569, 573
setPaintLabels method (JSlider), 673, 678
setPaintTicks method (JSlider), 673–674, 678
setPaintTrack method (JSlider), 678
setParent method (Logger), 406
setPriority method (Thread), 859
setProperty method
of Properties, 792
of System, 392
setRect method (Rectangle2D), 563
setResizable method (Frame), 546, 553
setRows method (JTextArea), 654, 656
Sets, 487
intersecting, 525
mutating elements of, 487
subranges of, 511
thread-safe, 912
setSelected method
of AbstractButton, 684
setSelectedFile/Files methods (JFileChooser), 754, 763
setSelectionStart/End methods (JComponent), 952
setShort method (Array), 279
setSize method (Component), 552
setSnapToTicks method (JSlider), 673, 678
setTabSize method (JTextArea), 656
setText method
of JTextComponent, 648, 650, 951
setTime method (Calendar), 218
setTitle method (JFrame), 546, 553
setToolTipText method (JComponent), 699
setUncaughtExceptionHandler method (Thread), 861
setUndecorated method (Frame), 546, 553
setUseParentHandlers method (Logger), 406
setValue method (Map.Entry), 503
setVerticalGroup method (GroupLayout), 722
setVisible method
setWrapStyleWord method (JTextArea), 656
setXxxTickSpacing methods (JSlider), 678
severe method (Logger), 390, 404
Shell
redirection syntax of, 88
scripts in, 193
Shift operators, 63
short type, 47
Short class
converting from short, 252
hashCode method, 237
show method (JPopupMenu), 685
showConfirmDialog method (JOptionPane), 731–732, 739
showDialog method
of JColorChooser, 770
of JFileChooser, 747, 752, 754, 763
showDocument method
of BasicService, 836
showInputDialog method (JOptionPane), 731–732, 740
showInternalConfirmDialog, showInternalMessageDialog methods (JOptionPane), 739
showInternalInputDialog method (JOptionPane), 741
showInternalOptionDialog method (JOptionPane), 740
showMessageDialog method (JOptionPane), 304, 731–732, 739
showOptionDialog method (JOptionPane), 731–732, 739–740
showStatus method (Applet), 819–820
showXxxDialog methods (JFileChooser), 747, 752, 754, 763
shuffle method (Collections), 520–521
shuffle/ShuffleTest.java, 520
Shuffling, 520
Shutdown hooks, 182
shutdown method (ExecutorService), 922, 925
shutdownNow method (ExecutorService), 922, 927
Sieve of Eratosthenes benchmark, 533–536
sieve/sieve.cpp, 535
sieve/Sieve.java, 534
signal method (Condition), 875–877, 890
signalAll method (Condition), 874–877, 890
Signatures (of methods), 172, 215
simpleframe/SimpleFrameTest.java, 544
sin method (Math), 58
Single-thread rule (Swing), 939, 951–952
singleton, singletonCollection methods
size method
of concurrent collections, 905
sizedFrame/SizedFrameTest.java, 551
sleep method (Thread), 841, 846–847, 852
slider/SliderFrame.java, 674
vertical, 672
SoftBevelBorder class, 665, 667
Software Development Kit (SDK), 18
Solaris
Eclipse versions for, 27
executing JARs in, 783
JDK versions for, 18
sort method
of Arrays, 117–119, 290, 292, 294, 314, 318
of List, 521
SortedMap interface, 471
comparator, first/lastKey methods, 500
subMap, headMap, tailMap methods, 511, 516
comparator, first, last methods, 493
subSet, headSet, tailSet methods, 511, 516
assertions for, 387
in reverse order, 519
strings by length, 305–306, 314, 316
Source files, 192
editing in Eclipse, 29
Special characters, 50
Splash screen, 262
Spring layout, 700
sqrt method (Math), 57
src.zip file, 22
Stack interface, 460, 528, 531
peek, pop, push methods, 532
Stacks, 531
stackTrace/StackTraceTest.java, 378
StackTraceElement class
getLineNumber method, 380
getXxxName methods, 380
isNativeMethod method, 381
Standard Edition (Java SE), 11, 18
Standard Java library
companion classes in, 298
online API documentation for, 71, 74–77, 194, 199
packages in, 182
Standard Template Library (STL), 460, 465
start method
of Applet, 808
of Timer, 305
startsWith method (String), 72
stateChanged method (ChangeListener), 672–673
Statements, 45
compound. See Blocks
static access modifier, 158–164
for fields in interfaces, 296
Static binding, 215
Static constants, 159
documentation comments for, 196
accessing, in static methods, 160
importing, 185
initializing, 178
no type variables in, 436
static final access modifier, 55
Static imports, 185
Static inner classes, 331, 346–349
accessing static fields in, 160
adding to interfaces, 298
importing, 185
no type variables in, 436
Static variables, 159
staticInnerClass/StaticInnerClassTest.java, 348
StaticTest/StaticTest.java, 163
stop method
of Applet, 808
of Thread (deprecated), 851, 858, 896–897
of Timer, 305
store method (Properties), 531, 788, 793
Strategy design pattern, 631
Stream interface, toArray method, 321
StreamHandler class, 397
strictfp keyword, 57
codePointAt, codePoints methods, 72
compareTo method, 72
endsWith method, 72
equals, equalsIgnoreCase methods, 68, 72
format, formatTo methods, 83
join method, 73
lastIndexOf method, 73
offsetByCodePoints method, 70, 72
replace method, 73
startsWith method, 72
toLowerCase, toUpperCase methods, 73
appendCodePoint method, 78
delete method, 78
insert method, 78
length method, 78
setCharAt method, 78
code points/code units of, 70
with objects, 239
converting to numbers, 254
empty, 69
equality of, 68
immutability of, 67
null, 69
sorting by length, 305–306, 314, 316
substrings of, 66
using ". . ." for, 45
Strongly typed languages, 47, 291
adding fields/methods to, 207
anonymous, 344
cloning, 311
comparing objects from, 295
constructors for, 207
defining, 204
method visibility in, 217
no access to private fields of superclass, 227
overriding superclass methods in, 207
subList method (List), 510, 516
subMap method
of NavigableMap, 517
Submenus, 679
submit method
of ExecutorCompletionService, 925, 928
of ExecutorService, 921
subSet method (NavigableSet, SortedSet), 511, 516
Substitution principle, 213
substring method (String), 66, 73, 510
subtract method (BigDecimal, BigInteger), 110–111
Subtraction operator, 56
sum method (LongAdder), 888
Sun Microsystems, 2, 5–12, 14, 539
Java Plug-in, 803
capturing in method references, 320
Superclass wins rule, 300
accessing private fields of, 206
common fields and methods in, 223, 283
overriding methods of, 234
throws specifiers in, 364, 369
Supplementary characters, 52
Supplier interface, 326
@SuppressWarnings annotation, 105, 252, 430, 432, 437–439
Surrogates area (Unicode), 52
suspend method (Thread, deprecated), 858, 896–897
swap method (Collections), 524
advantages of, 539
double buffering in, 771
implementing applets with, 803–808
in full-screen, 550
model-view-controller analysis of, 636–638
starting, 545
single-thread rule, 939, 951–952
Swing graphics debugger, 771
swing/SwingThreadTest.java, 940
swing.properties file, 598
SwingConstants interface, 296, 651
SwingUtilities class
getAncestorOfClass method, 747, 752
updateComponentTreeUI method, 599
doInBackground method, 944–945, 950
getState method, 950
swingWorker/SwingWorkerTest.java, 947
enumerated constants in, 105
missing break statements in, 412
SWT toolkit, 543
synch/Bank.java, 875
synch2/Bank.java, 880
final variables, 886
in Vector, 484
lock testing and timeouts, 893–895
monitor concept, 884
read/write locks, 895
Synchronization primitives, 935
Synchronization wrappers, 914–915
synchronized keyword, 868, 878–882, 884
synchronizedCollection methods (Collections), 512–513, 515, 915
countdown latches, 936
exchangers, 937
semaphores, 935
synchronous queues, 937
SynchronousQueue class, 935–937
Synth look-and-feel, 542
System class
console method, 81
exit method, 45
getProperties method, 789, 793
getProperty method, 793
identityHashCode method, 507, 509
runFinalizersOnExit method, 182
setOut method, 159
setProperty method, 392
System of Patterns, A (Buschmann et al.), 632
System.err class, 411
System.in class, 79
System.out class, 45–46, 159, 411
print method, 82
systemNodeForPackage method (Preferences), 794, 799
systemRoot method (Preferences), 794, 799
T type variable, 419
\t escape sequence, 50
Tab key
escape sequence for, 50
navigating GUI controls with, 729
Tagging interfaces, 309, 426, 471
tailMap method
of NavigableMap, 517
tailSet method (NavigableSet, SortedSet), 511, 516
take method
of BlockingQueue, 898–899, 904
of ExecutorCompletionService, 928
takeFirst/Last methods (BlockingDeque), 904
tan method (Math), 58
tar command, 780
target attribute (HTML), 820
Tasks
controlling groups of, 927–928
decoupling from mechanism of running, 848
interrupting, 842
multiple, 839
running asynchronously, 915
scheduled, 926
work stealing for, 930
Template code bloat, 426
Terminal window, 25
Text
centering, 576
displaying, 557
typesetting properties of, 576
formatted text in, 654
preferred size of, 654
columns in, 649
creating blank, 650
preferred size of, 649
scroll panes, 654
text/TextComponentFrame.java, 655
thenAccept, thenApply, thenApplyAsync, thenRun methods (CompletableFuture), 933
thenAcceptBoth, thenCombine methods (CompletableFuture), 934
thenComparing method (Comparator), 328–329
thenCompose method (CompletableFuture), 932–933
capturing in method references, 320
in first statement of constructor, 176
in inner classes, 335
in lambda expressions, 324
Thread class
extending, 848
get/setUncaughtExceptionHandler methods, 861
getDefaultUncaughtExceptionHandler method, 861
getState method, 858
interrupt, isInterrupted methods, 851–854
methods with timeout, 856
resumes method, 858
setDefaultUncaughtExceptionHandler method, 411, 860–861
setPriority method, 859
sleep method, 841, 846–847, 852
stop method (deprecated), 851, 858, 896–897
suspend method (deprecated), 858, 896–897
yield method, 859
Thread dump, 889
Thread groups, 860
of fixed size, 921
Thread.UncaughtExceptionHandler interface, 860–862
ThreadDeath error, 857, 862, 896
ThreadGroup class, 861
uncaughtException method, 861–862
ThreadLocal class, methods of, 893
ThreadLocalRandom class, current method, 893
threadPool/ThreadPoolTest.java, 922
ThreadPoolExecutor class, 921–922
getLargestPoolSize method, 926
Threads
accessing collections from, 512–513, 905–915
condition objects for, 872–877
daemon, 859
executing code in, 325
handlers for uncaught exceptions in, 860–862
idle, 928
listing all, 889
new, 855
preemptive vs. cooperative scheduling for, 855
priorities of, 858
producer/customer, 898
synchronizing, 862–897, 934–937
thread-local variables in, 892–893
unblocking, 875
vs. processes, 840
work stealing for, 930
Thread-safe collections, 905–915
callables and futures, 915–920
copy on write arrays, 912
synchronization wrappers, 914–915
add/getSuppressed methods, 377, 380
get/initCause methods, 379
getMessage method, 366
getStackTrace method, 377, 379
printStackTrace method, 264–265, 377, 410
toString method, 366
throwing method (Logger), 392, 405
for main method, 88
@throws comment (javadoc), 196
Ticks, 673
icons for, 674
labeling, 673
snapping to, 673
Time measurement vs. calendars, 140
Timed waiting threads, 856–857
Timeless Way of Building, The (Alexander), 630
TimeoutException, 915
start, stop methods, 305
timer/TimerTest.java, 304
title element (HTML), 807
toArray method
of ArrayList, 435
of Stream, 321
toBack/Front methods (Window), 552
toLowerCase method (String), 73
toolBar/ToolBarFrame.java, 697
detaching, 695
dragging, 694
title of, 696
vertical, 696
Toolkit class
beep method, 305
createCustomCursor method, 618, 623
getDefaultToolkit method, 305, 549, 553
getScreenSize method, 549, 553
Toolkit-modal dialogs, 742
toString method
adding to all classes, 240
Formattable and, 83
of Date, 137
of Integer, 256
of proxy classes, 355
of StackTraceElement, 378, 381
of Throwable, 366
redeclaring, 318
working with any class, 272
Total ordering, 490
toUpperCase method (String), 73
TraceHandler class, 351
Tracing execution flow, 391
TransferQueue interface, 900
transfer, tryTransfer methods, 905
translatePoint method (MouseEvent), 627
Tree maps, 497
adding elements to, 490
red-black, 489
total ordering of, 490
vs. priority queues, 495
as a concrete collection type, 472
vs. HashMap, 497
as a concrete collection type, 472
treeSet/Item.java, 491
treeSet/TreeSetTest.java, 490
Trigonometric functions, 58
trimToSize method (ArrayList), 246–247
Troubleshooting. See Debugging
TrueType format, 575
Truncated computations, 56
try/catch statement, 264, 367–372
decoupling, 374
wrapping entire task in try block, 382
try/finally statement, 372–376
decoupling, 374
tryLock method (Lock), 856, 893–895
Try-with-resources statement, 376–377
no locks with, 869
Two-dimensional arrays, 120–125
Type interface, 453
Type parameters, 245
converting to raw types, 441
not instantiated with primitive types, 430–431
vs. inheritance, 416
in exceptions, 437
in static fields or methods, 436
matching in generic methods, 452
names of, 419
replacing with bound types, 425–426
Typesetting terms, 576
TypeVariable interface, 453
getBounds, getName methods, 457
UCSD Pascal system, 5
UIManager class
getInstalledLookAndFeels, setLookAndFeel methods, 602
setLookAndFeel method, 599
UML (Unified Modeling Language) notation, 134–135
UnaryOperator interface, 326
UnavailableServiceException, 830
uncaughtException method (ThreadGroup), 861–862
UncaughtExceptionHandler interface, 860–862
uncaughtException method, 861
Unchecked exceptions, 264, 361–363
applicability of, 383
Unequality operator, 62
Unicode standard, 6, 51–52, 65
in char type, 50
Unit testing, 162
University of Illinois, 10
UNIX
Eclipse versions for, 27
JNLP configuration in, 828
running applets in, 34
setting up JDK in, 20
system directories, 788
troubleshooting Java programs in, 26
unlock method (Lock), 869, 871
unmodifiableCollection methods (Collections), 511–512, 514
UnsupportedOperationException, 503, 510, 512, 514
unsynch/Bank.java, 865
unsynch/UnsynchBankTest.java, 864
updateAndGet method (AtomicType), 887
updateComponentTreeUI method (SwingUtilities), 599
User input, 650
errors of, 359
User Interface. See Graphical User Interface
userNodeForPackage method (Preferences), 794, 799
userRoot method (Preferences), 794, 799
“Uses–a” relationship, 133–135
UTC (Coordinated Universal Time), 139
UTF-8 standard, 87
V type variable, 419
validate method (Component), 651, 951
valueOf method
of BigDecimal, BigInteger, 108, 110–111
of Integer, 256
Values, captured by lambda expressions, 323
passing generic types to, 432–433
copying, 306
declarations of, 53
deprecated, 197
effectively final, 324
final, accessing from outer methods, 339–342
annotating, 430
mutating in lambda expressions, 323
package scope of, 189
printing/logging values of, 409
static, 159
Vector class, 460, 528, 883, 914–915
elements method, 530
for dynamic arrays, 245
get, set methods, 883
synchronization in, 484
@version comment (javadoc), 197, 199
bulk operations for, 525
checked, 513
restricted, 514
Visual Basic programming language
built-in date type in, 136
event handling in, 587
forms in, 638
syntax of, 3
Visual Studio, 23
von der Ahé, Peter, 422
wait method (Object), 856, 878, 882
Wait sets, 873
warning method (Logger), 390, 404
Warnings
fallthrough behavior, 105
generic types, 252, 430, 432, 437–439
Weak hash maps, 504
Weak references, 504
as a concrete collection type, 472
Weakly consistent iterators, 906
WeakReference object, 504
Web pages
dynamic, 9
reading from URL, 932
title of, 807
webstart/CalculatorFrame.java, 832
Welcome/Welcome.java, 25
whenComplete method (CompletableFuture), 933
Whitespace, irrelevant to Java compiler, 44
arrays of, 432
unbounded, 447
WildcardType interface, 453
getLowerBounds, getUpperBounds methods, 458
Window class, 628
is/setLocationByPlatform methods, 552
toBack/Front methods, 552
WindowAdapter class, 626
WindowClosing event, 688
WindowEvent class, 588, 603, 626
getNewState, getOldState methods, 607, 628
getWindow, getOppositeWindow, getScrollAmount methods, 628
WindowFocusListener interface, 626
windowGainedFocus, windowLostFocus methods, 628
WindowListener interface, 626
windowActivated/Deactivated methods, 603, 607, 628
windowClosing/Closed methods, 603–607, 628
windowIconified/Deiconified methods, 603, 607, 628
windowOpened method, 603, 606, 628
Windows. See Dialogs
Windows look-and-feel, 539–540
Windows operating system
Alt+F4 in, 688
debugging applets in, 807
default location in, 395
device context in, 556
Eclipse versions for, 27
executing JARs in, 783
file separators in, 785
fonts shipped with, 574
JDK versions for, 18
pop-up trigger in, 685
resources in, 783
setting paths in, 20, 191, 193
setting up JDK in, 20
thread priority levels in, 859
WindowStateListener interface, 603, 626
windowStateChanged method, 607, 628
withInitial method (ThreadLocal), 893
Work stealing, 930
equality testing for, 254
immutability of, 253
lightweight collection, 509–510
X11 programming, 556
XML (Extensible Markup Language), 12–13
xor method (BitSet), 533
yield method (Thread), 859