K
Kernighan, Brian, 4
Keyboard events, handling, 790–794
KeyCombination class, 1171
keyCombination( ), 1171
KeyEvent class, 773, 775, 776, 778, 1068, 1069
KeyListener interface, 783, 784–785, 790–794, 795
keyPressed( ), 784–785, 790, 792
keySet( ), 561, 563, 602, 660, 763
KeyStroke class, 1069
keytool command-line tool, 1237, 1240, 1241
keyTyped( ), 784–785, 790, 792
Keywords
restricted, 410
table of Java, 35
L
Label
AWT standard control, 830, 831–832
used with break statement, 106–108
used with continue statement, 109
Label class
Label, JavaFX, 1102–1104
adding an image to a, 1118–1120
Lambda expression(s), 17, 379–396, 406–407, 556
as arguments, passing, 389–391
definition of, 379
and generics, 387
to handle action events, 836–837, 1023–1024, 1040, 1061, 1105, 1109, 1162, 1169
parameters, 380–381, 382, 383–385, 393
and the stream API, 955
target type, 380, 381, 382, 387, 389, 391, 393
and variable capture, 393–394
Lambda arrow operator (–>), 17, 63, 81, 380
lastIndexOf( ), 450, 451–452, 464–465, 533, 534, 594, 595
lastKey( ), 565
Late binding, 186
Layered pane, 1015–1016
Layout managers, AWT, 805, 829, 832, 854–869
default, 855
Layout panes, JavaFX, 1097, 1100, 1101, 1108–1109, 1168, 1177, 1186
LayoutManager interface, 855
Lazy behavior (stream API stream), 958
length instance variable of arrays, 149–151
length( ), 155, 442, 459, 522, 612
Lexer (lexical analyzer), 609
Library, compact profiles of the API, 334
Lindholm, Tim, 6
LineNumberInputStream deprecated class, 670
LineNumberReader class, 308
LinkedBlockingDeque class, 933
LinkedBlockingQueue class, 933
LinkedHashMap class, 568, 571–572
LinkedHashSet class, 541, 547–548
LinkedList class, 541, 545–546
example program using the, 559–560
from a stream API stream, obtaining a, 975
LinkedTransferQueue class, 933
List
event source, as an, 773, 777, 782, 845, 1104
pop-up, 841
List class (java.awt), 803, 844, 845
List interface (java.util), 530, 533–535, 541, 545, 546, 553, 554, 587, 593, 594, 1103, 1136, 1140, 1141, 1163
from a stream API stream, obtaining an instance of the, 972–974
methods, table of, 534
List, Swing, 1046–1049
List view, 1136–1141
change events, handling, 1137
multiple selections in a, enabling, 1140–1141
scroll bars, 1139–1140
list( ), ThreadGroup, 513, 515
listFiles( ), 675–676
ListIterator interface, 530, 551, 553–555, 556
methods, table of, 553
ListModel interface, 1047
ListResourceBundle class, 660–662
ListSelectionEvent class, 1047, 1048, 1055
ListSelectionListener interface, 1047, 1048
ListSelectionModel interface, 1047, 1055
ListView class, 1136–1141
class, 288
regular expression, 983
load( ), 424–425, 429–430, 489, 496, 604, 606–608
LocalDate class, 1002, 1003, 1006, 1007
LocalDateTime class, 1002, 1003, 1006, 1007
Locale class, 456, 625–626, 998
Locale Data Markup Language (LDML), 626
Locale.Builder class, 626
Locale.IsoCountryCode, 626
LocalTime class, 1002, 1003, 1006, 1007
Lock interface, 907, 934, 935, 936
methods, table of, 934
Locks, 934–936
Log, program, 499
log( )
math method, 506
Logical operators
bitwise, 69–71
Boolean, 77–79
and automatic type conversion, 50
and automatic type promotion, 52
literal, 44
Long class, 277, 278. 467, 473, 480, 481
methods, table of, 478–480
LongAccumulator class, 937
LongAdder class, 937
LongBuffer class, 719
longs( ), 628
LongStream interface, 958, 959
longValue( ), 278, 468, 470, 472, 474, 475, 476, 479
Look and feels, 1012–1013
lookup( ), 995
Loop(s), 83
Boolean object to control, using a, 283
continue statement and, 108–109
do-while, 92–95
for. See for loop
while, 81–92
Low surrogate char, 485
M
main (default name of main thread), 242
main( ), 27–28, 111, 112, 114, 144, 147
and applets, 1256
and the java application launcher, 27
and a JavaFX application, 1100
and command-line arguments, 27, 156–157
and Swing programs, 1020
major( ), 492
makeGUI( ), 1262
MalformedURLException, 757
Map interface, 561–564, 565, 568, 572, 599, 600, 602
methods, table of, 562–564
map( ), 615, 616, 721, 732, 733, 736
and stream API streams, 957, 968–972
classes, 568–572
collection-view of a, obtaining a, 529, 560, 561
flat, 972
interfaces, 561–567
and stream API streams, 968–972
submaps of, 564–565
Map.Entry interface, 561, 565, 569
methods, table of non-static, 567
MapMode.READ_WRITE, 732, 733, 736
MappedByteBuffer class, 719, 733
mark( ), 679, 680, 685, 689, 692, 699, 705, 719
markSupported( ), 679, 680, 689, 692, 699, 705
Matcher class, 981, 982–983, 984, 985, 988, 989
matcher( ), 982
matches( ), 457, 982, 986, 989
exponential functions, methods for, 506
miscellaneous methods, table of, 508
rounding methods, table of, 506–507
and static import example, 329–331
trigonometric functions, methods, for, 505
max( ), 400–402, 470, 472, 476, 479, 507, 957, 962, 963
algorithm defined by Collections, 583, 586
MAX_EXPONENT, 469
MAX_RADIX, 482
MediaTracker class, 803
access and inheritance, 165–166
access, table of, 193
controlling access to a, 143–146, 192–196
static, 147–148
Memory
allocation using new, 54, 55, 115–116
deallocation, 127
and the Runtime class, 487–488, 490
MemoryImageSource class, 885–887, 890
Menu bars and AWT menus, 829, 869–874
action command string of, 870
and events, 870
Menu, Choice control as a form of, 841
Menu class
JavaFX, 1164, 1163, 1164, 1165, 1169, 1171
Menu item as an event source, AWT, 773, 777, 782, 870
Menu(s), JavaFX, 1161–1186
accelerator keys, 1161, 1170–1171
check menu items, 1162, 1173–1175
classes, table of core, 1162
context, 1161, 1162–1163, 1175–1178
demonstration program, 1181–1186
events, handling, 1162, 1165, 1169–1170
main, creating a, 1162, 1163–1164, 1165–1170
menu bar, 1161, 1163–1164, 1165, 1168, 1169
radio menu items, 1162, 1173–1175
and separators, 1162, 1164, 1169
standard, 1161
and submenus, 1161, 1162, 1164, 1169
and toolbars, 1161, 1163, 1179–1180
and tooltips, 1179
Menu(s), Swing, 1059–1091
accelerator keys, 1059, 1068, 1069–1070, 1083
action command string, 1060–1061, 1068
action to manage multiple components of a, using an, 1059, 1079–1084
and check boxes, 1071, 1072–1073
classes, interaction of core, 1060–1061
demonstration program, 1085–1091
events, 1060–1061, 1063, 1064, 1067–1068, 1071, 1072, 1074, 1075–1076
and images, 1070–1071
item as an event source, 772, 777, 782
main, creating a, 1064–1068
menu bar, 1059, 1061–1062, 1064, 1067, 1075, 1077
mnemonics, 1059, 1063, 1068, 1069–1070, 1083–1084
and radio buttons, 1071, 1072–1073
and submenus, 1060, 1062, 1063, 1064
and toolbars, 1059, 1060, 1077–1079
and tooltips, 1071, 1077, 1078, 1079
MenuBar class
MenuDragMouseEvent, 1061
MenuEvent, 1061
MenuItem class
JavaFX, 1162, 1163, 1164–1165, 1169, 1170, 1171, 1173, 1176
MenuKeyEvent, 1061
MenuListener, 1061
Metadata, 279, 284. See also Annotation(s)
Metal look and feel, 1013
Method class, 287, 290, 291, 526, 990, 992, 1196
Method reference(s), 379, 394–402
and the Collections Framework, 400–402
and generics, 399–402
to instance methods, 395–399
to static methods, 394–395
to a superclass version of a method, 399
abstract. See Abstract method(s)
and autoboxing/unboxing, 280–281
bridge, 372–373
collector, 972
default interface, 17, 18, 199, 209–213, 379, 381
dispatch, dynamic, 180–183
and the dot (.) operator, 113, 119
general form, 117–118
generic, 336, 348, 354–357, 375
getter, 1190–1191
hidden, using super to access, 172–173, 178
inlining, 186
interface. See Interface methods
and Java Bean introspection, 1192
and JShell, 1248–1249
lookup, dynamic, 201
native, 326
overloading, 131–136, 160–162, 179, 373–374
overriding. See Overriding, method
passing an object to, 139–140
recursive, 141–143
reference. See Method reference(s)
resolution, dynamic, 198, 201, 202, 206
returning an object from, 140–141
returning a value from, 118, 120–121
scope defined by, 48–50
setter, 1190–1191
static, 147–148, 213–214, 329–331, 394–395
subclasser responsibility, 184
synchronized, 240, 251–253, 907, 954
synthetic, 1246
type inference and, 356, 370–371
varargs. See Varargs
variable-arity, 157
MethodDescriptor class, 1192, 1195, 1196
MethodHandle class, 525
methodModifiers( ), 993
MethodType class, 525
Microsoft, 8
MIME (Multipurpose Internet Mail Extensions) type, 1201, 1205
min( ), 470, 472, 476, 479, 507, 958, 961, 962, 963
algorithm defined by Collections, 583, 586
minimumLayoutSize( ), 855
minor( ), 492
MIN_EXPONENT, 469
MIN_NORMAL, 469
MIN_RADIX, 482
mismatch( ), 591
mkdir( ), 676
mkdirs( ), 676
Model-Delegate component architecture, 1014
Model-View-Controller (MVC) component architecture, 1013–1014, 1096
“is” methods, table of, 992
Module class, 518–519
module statement, 410, 416, 433
and access control, 144, 409, 410, 416, 418–419, 433
automatic, 436
and compact profiles, 334
compiling and running code based on, 414–415
creating code based on, 410–414
declaration, 409–410
definition of the term, 409
description, 410
graph, 432–433
Java API library packages and, 18, 409, 417
layers, 436
and legacy code, 417–418
and multi-module compilation mode, 419, 423
naming conventions, 411
open, 433
and packages, 191
and services and service providers, example application demonstrating, 425–432
unnamed, 417
module-info.java file, 410, 414, 415, 416
and javadoc, 1228
ModuleDescriptor class, 519, 525
ModuleFinder interface, 525
ModuleLayer class, 519
ModuleLayer.Controller class, 519
ModuleReader interface, 525
ModuleReference class, 525
Monitor, 240, 251, 254, 255, 261
Mouse events, handling, 787–790
MouseAdapter class, 794, 795, 799, 1074, 1075–1076, 1197
mouseClicked( ), 785, 794, 1074
mouseDragged( ), 785, 794, 884
MouseEvent class, 773, 775, 776, 779–780, 1074
MouseListener interface, 783, 785, 787–790, 795, 796, 1074, 1075–1076
MouseMotionAdapter class, 794, 795
MouseMotionListener interface, 771, 783, 785, 787–790, 794, 795, 796
mousePressed( ), 785, 797, 1074, 1076, 1197
mouseReleased( ), 785, 1074, 1076
MouseWheelEvent class, 773, 780–781
MouseWheelListener interface, 783, 785, 787, 795, 796
mouseWheelMoved( ), 785
Multicore systems, 16–17, 238, 266, 905, 906, 938, 942, 945, 965
MultipleSelectionModel class, 1137, 1139
Multitasking, 237
preemptive, 239
process-based versus thread-based, 237
Multithreaded programming, 8, 13, 237–266, 509
and context switching. See Context switching
effectively using, 266
and multicore versus single-core systems, 238
and spurious wakeup, 256
and StringBuilder class, 465
and synchronization. See Synchronization
and threads. See Thread(s)
versus the concurrency utilities, traditional, 905, 954
and parallel programming, 938
versus single-threaded system, 238
MutableComboBoxModel, 1050
MutableTreeNode interface, 1052
MVC (Model-View-Controller) component architecture, 1013–1014, 1096
N
Namespace collisions
between instance variables and local variables, 127
and static import, 331
@Native built-in annotation, 295
native modifier, 326
naturalOrder( ), 573
Naughton, Patrick, 6
NavigableMap interface, 561, 565, 570
methods, table of, 566–567
NavigableSet interface, 530, 537–538, 548, 549
methods, table of, 537
Negative numbers in Java, representation of, 68–69
NEGATIVE_INFINITY, 469
NegativeArraySizeException, 230, 588
.NET Framework, 8
Networking, 749–767
basics, 749–750
classes and interfaces, list of, 750–751
new, 54, 55, 115–116, 123, 125, 127, 141, 184, 226, 227
constructor reference and, 402, 406
and type inference, 370–371
NEW, 264
New I/O. See NIO
newByteChannel( ), 721, 724, 729, 731, 732, 733, 734, 736
newCachedThreadPool( ), 927
newDirectoryStream( ), 724, 742, 744–745
newFileSystem( ), 728
newFixedThreadPool( ), 927–928
newInputStream( ), 725, 738–739
Newline, inserting a, 639
newOutputStream( ), 725, 738, 739–740
newScheduledThreadPool( ), 927, 928
next( ), 552, 553, 556, 650, 862, 976, 977
nextDouble( ), 208, 626, 627, 650, 652, 655
nextGaussian( ), 626–628
nextInt( ), 626, 627, 650, 655
nextToken( ), 610
nextX( ) Scanner methods, 648, 650–651, 652, 655
table of, 650
buffers, 718–720
charsets, 722
and directories, 742–748
packages, list of, 717
for path and file system operations, using, 740–748
selectors, 722
and the stream API, 725
for stream-based I/O, using, 728, 738–740
NIO and channel-based I/O
copying a file using, 737–738
reading a file using, 729–733
writing to a file using, 733–737
Node class, 1097, 1101, 1105, 1109, 1116, 1118, 1150, 1155, 1156, 1160, 1162, 1163, 1177
Node(s), JavaFX, 1097, 1100, 1101, 1103, 1108, 1109, 1113
disabling, 1160
effects and transforms to alter the look of, using, 1154–1160. See also Effects; Transforms
hierarchy, 1097
root, 1097, 1100, 1101, 1103, 1105, 1108, 1177, 1178
scrolling capabilities to, adding, 1147–1149
text, 1160
noneMatch( ), 980
NoSuchElementException, 536, 538, 540, 564, 593, 615, 651, 657
NoSuchMethodException, 231, 287
NOT operator
bitwise unary (~), 68, 69, 70–71
Boolean logical unary (!), 77, 78
NotDirectoryException, 742
notify( ), 187, 188, 255–256, 258–259, 262–264, 499, 905, 935, 954
notifyAll( ), 187, 188, 255–256, 499
NotSerializableException, 715
now( ), 1002–1003
alternative to using, 614
Null statement, 92
NullPointerException, 227, 230, 532, 533, 536, 538, 540, 551, 561, 564, 565, 588, 600, 658, 693
using Optional to prevent a, 614, 616
nullsFirst( ), 573–574
nullsLast( ), 573–574
Number class, 278, 345, 467, 468
NumberFormatException, 230, 278
Numbers
pseudorandom, 626
O
Oak, 6
Object class, 187–188, 255, 336, 338, 371, 499–501
as a data type, problems with using the, 340–342
Object class methods
and functional interfaces, 380
Object reference variables
and abstract classes, 184–185, 186
and argument passing, 138, 139–140
assigning, 116–117
declaring, 115
and cloning, 500
and dynamic method dispatch, 180–183
to superclass reference variable, assigning subclass, 168, 172, 180
OBJECT tag, HTML, 1256
Object-oriented programming (OOP), 5, 6, 19–25, 111
model in Java, 12
creating/declaring, 113, 115–116
exact copy (clone) of, 499–500
initialization with a constructor, 123–126
to a method, passing, 139–140
as parameters, 136–138
returning, 140–141
serialization of. See Serialization
type at run time, determining, 323–325
Object.notify( ). See notify( )
Object.wait( ). See wait( )
ObjectInput interface, 713
methods defined by, table of, 713
ObjectInputFilter, 714
ObjectInputFilter.Config, 714
ObjectInputFilter.FilterInfo, 714
ObjectInputFilter.Status, 714
ObjectInputStream class, 307, 713–714
methods defined by, table of, 714
ObjectOutput interface, 711–712
methods defined by, table of, 711
ObjectOutputStream class, 307, 712–713
methods defined by, table of, 712
Objects class, 662
Observable class, 609
observableArrayList( ), 1136, 1139, 1141
ObservableList, 1103, 1104, 1136, 1139, 1140, 1141, 1163
ObservableValue, 1129
Observer interface, 609
Octals, 43
as character values, 45
and string literals, 46
of( ), 533, 534, 535–536, 551, 552, 561, 563, 564, 615, 616, 933, 980
offsetByCodePoints( ), 457, 464
ofLocalizedDate( ), 1003, 1004
ofLocalizedDateTime( ), 1003
ofLocalizedTime( ), 1003
ofPattern( ), 1004–1006
pattern letters, 1005
open
modifier, 433
open( ), 721
openConnection( ), 758, 760–761
OpenOption interface, 725
opens
statement, 433
Operator(s)
arithmetic, 63–68
assignment. See Assignment operator(s)
bitwise, 68–76
Boolean logical, 77–79
conditional-and, 79
conditional-or, 79
diamond (<>), 370–371
precedence, table of, 81
ternary if-then-else (?:), 78, 80
Optional class, 614–616, 961, 962, 963
methods, table of, 614–615
optional( ), 492
OptionalDouble class, 614, 616
OR operator
bitwise exclusive (^), 68, 69, 70–71
Boolean logical exclusive (^), 77, 78
OR operator, short-circuit (||) Boolean logical, 77, 79
Ordinal value, enumeration constant’s, 273, 274
orElse( ), 615
Orientation, 1179
out output stream, 28, 36, 308, 309, 312, 313, 492, 495. See also System.out
OutputStream class, 306, 307, 312, 678, 679, 682, 688, 690, 694, 696, 708, 712, 716, 739, 1210
methods, table of, 681
OutputStreamWriter class, 308
Overloading methods, 131–136, 160–162, 179, 373–374
@Override, built-in annotation, 295, 297
Overriding, method, 177–183
and abstract classes, 183–186
and bridge methods, 372–373
and dynamic method dispatch, 180–183
final to prevent, using, 186
in a generic class, 369–370
and run-time polymorphism, 180, 181, 183
P
access to classes contained in, 192–196, 197
built-in standard Java classes and, 196, 197
defining, 190
finding, 190–191
importing, 196–198
and JShell, 1252–1253
and modules, 191
Swing, 1016
methods, table of, 517–518
Paint class, 1111
Paint mode, setting the, 818–819
paint( ), 787, 790, 807, 808, 810, 884, 1024–1025, 1198, 1258, 1259, 1260
lightweight AWT components and overriding, 878
Paintable area, computing, 1025–1026
paintBorder( ), 1024–1025
paintChildren( ), 1024–1025
paintComponent( ), 1024–1025, 1028, 1260
Painting in Swing, 1024–1028
Panel class, 803, 804, 805, 861, 1257
Panes, Swing container, 1015–1016. See also Content pane
Parallel processing, 17, 379, 556, 558
of a stream API stream, 955, 958, 959, 965–967, 974, 977, 979
Parallel programming. See Programming, parallel
parallelPrefix( ), 590
parallelSetAll( ), 590
parallelSort( ), 589–590
parallelStream( ), 531, 533, 959, 965, 966
Parameter(s), 27, 118, 121–123
and constructors, 125–126
final, 149
and lambda expressions, 380–381, 382, 383–385, 393
names and instance variable names, 127
objects as, 136–138
and overloaded constructors, 134–135
and overloaded methods, 131, 179
and the scope of a method, 48
servlet, reading, 1210–1212
type. See Type parameter(s)
variable-length (varargs), 159, 535
parameterModifiers( ), 993
Parent class, 1097, 1101, 1105
parseDouble( ), 472
parseFloat( ), 470
Parsing, definition of, 609
Pascal, 4
PasswordField class, 1146
Passwords, reading, 710
Path interface, 671, 673, 722–723, 729, 740, 741, 742–743, 746
converting a File object into an instance of the, 673, 722, 740
instance for stream-based I/O, using a, 738–740
methods, table of a sampling of, 723
obtaining an instance of the, 725–726, 729, 731, 732, 733, 734, 736
Paths class, 725–726, 729, 731
Pattern class, 981, 982, 985, 988, 989
Pattern matching, regular expressions, 983–989
PatternSyntaxException, 983
Payne, Jonathan, 6
Period class, 1007
Persistence (Java Beans), 1193
Phaser class, 906, 908, 920–927
compatability with fork/join, 954
PI (Math constant), 505
PIPE, 494
Pipeline for actions on stream API streams, 17, 379, 958, 970–971
PipedInputStream class, 307
PipedOutputStream class, 307
PipedReader class, 308
PipedWriter class, 308
PixelGrabber class, 887–890
Platform class, 1170
Platform.exit( ), 1170
Pluggable look and feel (PLAF), 1012–1013, 1014
Plug-in and pluggable application architecture, 424, 426
PNG file format, 880
and dynamic method dispatch, 180–183, 184
and overloaded methods, 131, 133, 134
PopupControl class, 1163, 1175
PopupMenuEvent, 1061
Portable Operating System Interface (POSIX), 727
Portability problem, 6–7, 8, 9–10, 11, 12, 13, 18
and data types, 38
and thread context switching, 239
Pos enumeration, 1109
POSITIVE_INFINITY, 469
PosixFileAttributes class, 726, 727, 742
PosixFileAttributeView interface, 728
Possessive behavior (regular expression pattern matching), 987
postVisitDirectory( ), 746
pre( ), 492
Predicate<T> predefined functional interface, 407, 666, 962
preferredLayoutSize( ), 855
preVisitDirectory( ), 746
PrimitiveIterator interface, 529, 976
PrimitiveIterator.OfDouble interface, 529, 976
PrimitiveIterator.OfInt interface, 976
PrimitiveIterator.OfLong interface, 976
print( ), 29, 36, 312, 313, 444, 694, 708, 1210
printf( )
method, Java, 157, 647, 694–696, 708, 709
println( ), 28, 29, 36, 188, 312, 313, 444–445, 635, 694, 708, 1210
and Boolean output, 43
and String objects, 61
PrintStream class, 307, 309, 312, 647, 693–696
PrintWriter class, 308, 312–313, 647, 707–708, 1205
PriorityBlockingQueue class, 933
PriorityQueue class, 541, 549–550
private access modifier, 27, 144–146, 192–193
and inheritance, 165–166
Process class, 485–486, 491, 492
methods, table of, 488
Process, definition of, 237, 485
Process-based versus thread-based multitasking, 237
ProcessBuilder class, 485, 492–495
methods, table of, 493–494
ProcessBuilder.Redirect class, 494
ProcessBuilder.Redirect.Type enumeration, 494
ProcessHandle class, 485–486
ProcessHandle.Info, 485
Program log, 499
Programming
multithreaded. See Multithreaded programming
object-oriented. See Object-oriented programming
Programming, parallel, 16–17, 239, 556, 906, 907, 938, 965
and the level of parallelism, 941
and specifying the level of parallelism, 941, 945–948, 954
Project Coin, 16
Properties class, 528, 592, 603–608
methods, table of, 604
Properties, environment, 498
Property, Java Bean, 1190, 1198
boolean, 1191
bound and constrained, 1193, 1196
design patterns for, 1190–1191, 1193
PropertyChangeEvent, 1193
PropertyChangeListener interface, 1193, 1194
PropertyDescriptor class, 1192, 1195, 1196, 1198
PropertyPermission class, 662
PropertyResourceBundle class, 660
PropertyVetoException, 1193
protected access modifier, 144, 192–193
Protocols, overview of networking, 749–750
provides
Pseudorandom numbers, 626
public access modifier, 27, 144–146, 192–193
Push buttons, AWT, 830, 833–837
action command string of, 833, 835, 836, 1033–1044
Push buttons, JavaFX, 1105–1109
adding an image to, 1120–1123
Push buttons, Swing, 1021–1024, 1033–1035
action command string of, 1033–1034
Pushback, 690–692
PushbackInputStream, 307, 688, 690–692
PushbackReader class, 308, 706–707
put( ), 561, 563, 568, 570, 572, 599, 600, 601
PutField inner class, 712–713
Q
Query string, 1218
Queue, double-ended, 539–540
Queue interface, 530, 538, 539, 545, 549, 550
methods, table of, 538
quietlyInvoke( ), 953
quietlyJoin( ), 953
R
Race condition, 253
Radio buttons, 839
Swing, 1039–1041
and Swing menus, 1072–1073
RadioButton class, 1125, 1126, 1132
RadioMenuItem class, 1162, 1173
Radix, 473
radix( ), 657
methods, table of core, 627
RandomAccess interface, 530, 560
RandomAccessFile class, 698, 721
Raw types, 360–362
READ, 494
read( ), 95, 307, 308, 309–310, 314–315, 524, 680, 689, 691, 699, 707, 713, 714, 721, 730, 731, 738, 880–881
Readable interface, 524, 647, 653, 699
ReadableByteChannel interface, 647
readAttributes( ), 725, 727, 741–742
Reader class, 307–308, 309, 678, 679, 699, 700, 702, 711
methods defined by, table of, 699
readExternal( ), 711
readLine( ), 310–312, 480, 709, 1210, 1257
ReadWriteLock interface, 936
Real numbers, 40
rebind( ), 994–995
receive( ), 765
Recursion, 141–143
and the Fork/Join Framework divide-and-conquer strategy, 942
RecursiveAction class, 907, 938, 940, 942, 943, 944, 948
RecursiveTask class, 907, 938, 940, 942
example program using, 948–951
Redirect class, 494
reduce( ), 958, 963–965, 966–967, 968–969
Reduction operations, 963–965
mutable, 975
ReentrantLock, 935
ReentrantReadWriteLock, 936
Reflection, 286, 433, 525–526, 981, 990–993
and annotations, 286–291
regionMatches( ), 447–448
register( ), 920
Regular expressions, 458, 609, 647, 655, 667, 981–989
definition of the term, 981
syntax, 983
wildcards and quantifiers, 981, 983, 985–987
reinitialize( ), 952
Relational operators, 30, 42, 43, 76–77
Relative index, 645–646
release( ), 908–911
Reluctant behavior (regular expression pattern matching), 986–987
Remote interface, 994
Remote method invocation (RMI), 14, 710, 981, 994–997
RemoteException, 994
remove( ), 531, 532, 534, 538, 546, 551, 552, 553, 563, 599, 600, 601, 830, 1020, 1061, 1063, 1104, 1156, 1163, 1164
removeActionListener( ), 1023
removeAttribute( ), 1215, 1222
removeEldestEntry( ), 572
removeKeyListener( ), 771
removeTListener( ), 1192
removeTypeListener( ), 771
renameTo( ), 672
repaint( ), 787, 790, 795, 796, 797, 808–809, 1025, 1109, 1198, 1259
@Repeatable annotation, 295, 302, 303
REPL (read-evaluate-print loop) execution, 1245
replaceAll( ), 457, 533, 534, 563, 983, 988
replaceRange( ), 853
ReplicateScaleFilter class, 890
requires statement, 410, 416, 417
using transitive with a, 420–424
reset( ), 657, 679, 680, 685, 687, 689–690, 692, 699, 705, 719
Resource bundles, 657–662
ResourceBundle class, 657–660
methods, table of, 658–660
and modules, 660
ResourceBundle.Control class, 658
@Retention built-in annotation, 286, 295
RetentionPolicy enumeration, 286, 525
return statement, 109–110, 118
in a lambda expression, 386
reverse( )
algorithm defined by Collections, 583
StrinBuffer method, 462
reverseOrder( )
collection algorithm, 583, 585–586
Comparator method, 573
RGB (red-green-blue) color model, 815
default, 885
RGBImageFilter class, 890, 892–893
example program demonstrating the, 893–904
RGBtoHSB( ), 816
Richards, Martin, 4
rmi protocol, 995
RMI (Remote Method Invocation), 14, 710, 981, 994–997, 1202
rmic compiler, 996
rmiregistry (RMI registry), 996, 997
Rotate class, 1156–1157
program demonstrating, 1157–1160
Run-time
system, Java,10. See also Java Virtual Machine (JVM)
type information, 14, 323, 366–368, 504
run( ), 240, 243, 244, 380, 509, 511, 629, 952, 1020
using a flag variable with, 262–264
RUNNABLE, 264
Runnable interface, 240, 242, 380, 509, 628, 629, 905, 951, 952, 1020
implementing the, 243–244, 246
Runtime class, 485, 486–492, 948
executing other programs and, 491–492
memory management and, 487–488, 490
methods, table of some, 489
RUNTIME retention policy, 285–286, 287, 290
Runtime.exec( ), 485, 489, 491–492
Runtime.Version class, 492
RuntimeException class, 218, 219, 227, 230, 234
RuntimePermission class, 519
S
@SafeVarargs built-in annotation, 295, 297
SAM (Single Abstract Method) type, 380
save( ), 603
program demonstrating, 1157–1160
Scanner, 609
Scanner class, 647–657
closing an instance of the, 653
demonstration programs, 651–655
hasNextX( ) methods, table of, 649
methods, miscellaneous, 656–657
nextX( ) methods, table of, 650
Scene class, 1096, 1097, 1100, 1101
ScheduledExecutorService interface, 927
ScheduledThreadPoolExecutor class, 907, 927
Scientific notation, 44, 635–636
Scopes in Java, 47–50
Scroll bars, 830, 847–850, 1044, 1045, 1139–1140, 1147–1149, 1150
as an event source, 774, 782, 848
Scroll pane, 1044–1046, 1147–1149
ScrollPane class, 803, 1147–1149
Security manager, 314, 495, 519, 677, 694, 997, 1202
Security problem, 8, 9, 10, 12, 18
and servlets, 1202
security( ), 492
SecurityException, 230, 314, 487, 495, 677, 694, 742, 746
SecurityManager class, 519
seek( ), 698
SeekableByteChannel interface, 721, 729, 732, 734
select( ), 842, 845, 850–851, 853
selectedItemProperty( ), 1137, 1139, 1150
selectedToggleProperty( ), 1129
Selection statements, 83–91
SelectionMode, 1140
SelectionModel class, 1137
Selectors, 722
Semaphore, 905, 906, 908–913, 954
and setting initial synchronization state, 913
send( ), 765
Separable Model architecture, 1014
Separator class, 1132
SeparatorMenuItem class, 1162, 1164
Separators, 35
SequenceInputStream class, 307, 692–693
Serializable interface, 711, 715, 953, 1193
Serialization, 710–716
example program, 715–716
and Java Beans, 1193
and static variables, 711
and transient variables, 711, 715
serialVersionUID constant, 716
ServerSocket class, 721, 753, 763–764
service( ), 1202, 1205, 1207, 1211, 1217
Services and service providers, 424–432
definition of the terms, 424
module-based example application demonstrating, 425–432
and modules, 425
Servlet interface, 1206, 1207, 1210
methods, table of, 1207
advantages of, 1202
API, 1206
development options, 1202–1204
example program for a simple, 1204–1206
life cycle of, 1202
parameters, reading, 1210–1212
and portability, 11
and security, 1202
and session tracking, 1222–1223
using Tomcat to develop, 1202, 1203–1206
ServletConfig interface, 1206, 1208, 1210
ServletContext interface, 1206, 1208
methods, table of various, 1208
ServletException class, 1207, 1210
ServletInputStream class, 1207, 1210
ServletOutputStream class, 1207, 1210
ServletRequest interface, 1205, 1206, 1208, 1210
methods, table of various, 1209
ServletResponse interface, 1205, 1206, 1208
methods, table of various, 1209
Session tracking, HTTP, 1222, 1223
Set interface, 530, 535–536, 546, 551, 561, 565
from a stream API stream, obtaining an instance of the, 972–974
set( ), 533, 534, 546, 553, 612, 619, 937
setActionCommand( ), 836, 870, 1033–1034, 1040
setAlignment( ), 831, 1108–1109
setAll( ), 590
setAllowIndeterminate( ), 1135
setAngle( ), 1156–1157
setAttribute( ), 1208, 1215, 1222
setBlockIncrement( ), 848
setBorder( ), 1028
setCharAt( ), 460
setColor( ), 816
setConstraints( ), 864
setContent( ), 1147
setContentDisplay( ), 1119–1120, 1122–1123, 1180
setContextMenu( ), 1176
setDefaultCloseOperation( ), 1018–1019
setDisabledIcon( ), 1033, 1071
setDisplayedMnemonicIndex( ), 1068
setEchoChar( ), 851
setEditable( ), 851, 853, 1143–1144
setEffect( ), 1155
setEnabled( ), 869, 1063, 1081
setFill( ), 1110–1111
setForkJoinTaskTag( ), 953
setGraphic( ), 1120, 1164, 1173
setHorizontalTextPosition( ), 1071
setHvalue( ), 1147–1148
setLabel( ), 833, 837, 869–870
setLastModified( ), 673
setLevel( ), 1155
setLocation( ), 805
setMnemonic( ), 1068
setMnemonicParsing( ), 1171
setN( ) setter method design pattern, 1190, 1191
setObjectInputFiller( ), 714
setOnAction( ), 1106, 1108, 1109, 1165
setOnContextMenuRequested( ), 1177–1178
setOrientation( ), 1179
setPaintMode( ), 818
setPannable( ), 1147
setPivotX( ), 1156–1157
setPivotY( ), 1156–1157
setPrefColumnCount( ), 1144
setPrefHeight( ), 1137
setPrefSize( ), 1137
setPrefViewportHeight( ), 1147
setPrefViewportWidth( ), 1147
setPressedIcon( ), 1033
setPromptText( ), 1144
setReadOnly( ), 673
setRolloverIcon( ), 1033
setRotate( ), 1156
setScaleX( ), 1156
setScaleY( ), 1156
setScene( ), 1101
setSelected( ), 1126, 1129, 1173
setSelectedCheckbox( ), 840
setSelectedIcon( ), 1033
setSelectionMode( ), 1047, 1140
setSize( ), 595, 805, 806, 810, 1018
setStroke( ), 1110–1111
setText( ), 831, 850, 853, 1030, 1033, 1108, 1144, 1164
setToggleGroup( ), 1126
setToolTipText( ), 1071
setTranslateX( ), 1156
setTranslateY( ), 1156
setUnitIncrement( ), 848
setValue( ), 567, 847–848, 1142, 1216
setValues( ), 847
setVvalue( ), 1147–1148
setVisible( ), 806, 809, 810, 1020
setX( ), 1157
setXORMode( ), 818–819
setY, 1157
Shear class, 1156
Sheridan, Mike, 6
Shift operators, bitwise, 68, 71–75
Short class, 277, 278, 467, 473, 480, 481
methods defined by, table of, 475
short data type, 37, 38, 39, 43
and automatic type conversion, 50
and automatic type promotion, 52, 71
ShortBuffer class, 719
shortValue( ), 278, 468, 470, 472, 474, 475, 477, 479
show( ), 862, 1074, 1075, 1076, 1101, 1178
shuffle( ) algorithm defined by Collections, 583, 584, 586
shutdown( ), 927, 929, 942, 953–954
shutdownNow( ), 953–954
Sign extension, 71, 73–74, 74–75
signal( ), 935
SimpleBeanInfo class, 1193, 1198, 1199
SimpleDateFormat class, 626, 999–1001, 1005
formatting string symbols, table of, 1000
SimpleFileVisitor class, 747, 748
SimpleTimeZone class, 624–625
SingleSelectionModel, 1042
size( ), 531, 532, 546, 564, 595, 599, 600, 601, 612, 725, 727, 733, 1163, 1164
skip( ), 657, 680–682, 689, 699, 713
SKIP_SIBLINGS, 746
sleep( ), 240, 241–242, 247, 512, 933
slice( ), 720
Slider box, 847
Snippet, code, 1245, 1247, 1248, 1250, 1253
Socket class, 721, 753–756, 763, 764
Socket(s)
overview, 749–750
and servlets, 1202
TCP/IP client, 753–756
SocketAddress class, 765
SocketChannel class, 721
SocketException, 765
algorithm defined by Collections, 584
SortedMap interface, 561, 564–565
methods, table of, 565
SortedSet interface, 530, 536, 537
methods, table of, 536
Source code file, naming a, 25
SOURCE retention policy, 285–286
Spliterator, 523, 529, 533, 556–558
and arrays, 590
characteristics, 558
Spliterator interface, 523, 529, 530, 551, 556–558
methods declared by, table of, 557
and streamAPI streams, 976, 977–979
spliterator( ), 523, 531, 533, 590, 956
Spliterator.OfDouble interface, 558
Spliterator.OfInt interface, 558
Spliterator.OfLong interface, 558
Spliterator.OfPrimitive interface, 558
Stack
frame, 520
walking, 521
ways to implement a, 203
Stack class, 528, 541, 592, 597–599
methods, table of, 598
StackTraceElement class, 232, 520
methods, table of, 520
StackWalker class, 521
StackWalker.StackFrame interface, 521
Stage class, 1096, 1097, 1100, 1101
StampedLock interface, 936
StandardCopyOption values, partial list of, 737
StandardOpenOption class, 725, 738, 739
enumeration, table of values for the, 726
StandardOpenOption.CREATE, 726, 734, 739
StandardOpenOption.READ, 726, 736, 738
StandardOpenOption.TRUNCATE_EXISTING, 726, 739
StandardOpenOption.WRITE, 726, 734, 739
Standard Template Library (STL), 529
start( ), 240, 243, 244, 245, 485, 494–495, 512, 982–983, 985
and applets, 1235, 1257, 1259, 1260, 1262
and JavaFX, 1097, 1098, 1100, 1101, 1102
State enumeration, 264
Statements, 28
null, 92
selection, 83–91
member restrictions, 375
used in a requires statement, 434
and applets, 1235, 1257, 1259, 1260
and JavaFX, 1097, 1098, 1100, 1101, 1102, 1170
str( ), 285
and collections, 608, 955, 956, 959, 961, 974
interfaces, 956–959
and lambda expressions, 955
and NIO, 725
Stream interface, 533, 590, 705, 725, 957–958, 979, 980
methods, table of some, 957–958
Stream, intermediate operations on a stream API, 958
to create a pipeline of actions, 958, 970–971
lazy behavior of, 958
stateless versus stateful, 958
Stream, stream API
and accumulator operations, 963, 964, 966–967, 975
collection from a, obtaining a, 972–975
and combiner operations, 966–967, 969, 975
definition of the term, 955–956
iterators and a, 976–979
mapping a, 968–972
obtaining a, 959
operations on a, terminal versus intermediate, 958
ordered versus unordered, 967
parallel processing of a, 955, 958, 959, 965–967, 974, 977, 979
parallel, using a, 965–967, 979
reduction operations, 963–965
stream( ), 532, 533, 590, 612, 615, 959, 961, 966, 971
Stream(s), byte, 306–307, 309, 313, 679–698
buffered, 688–692
classes in java.io, table of, 307
filtered, 688
Stream(s), character, 306, 307–308, 309, 313, 679, 699–708
classes in java.io, table of, 308
Stream(s), I/O
benefits, 716
classes, top-level, 678–679
closing, 677–678
concatenating input to, 692–693
definition of the term, 306, 699
flushing, 676
predefined, 308–309
reactive, 907
variables, predefined, 308–309
versus stream API streams, 956
strictfp, 325
StrictMath class, 509
String class, 27, 60–61, 154–156, 439, 458, 522, 647, 982
constructors, 440–442
methods, table of some, 457–458
String(s)
changing case of characters in, 455–456, 482–484
concatenating, 29, 154–155, 443–444, 453, 456–457, 461
converting data into a, 444–445, 454–455
extracting characters from, 445–446
formatted, creating a, 633–635
immutability of, 154, 439, 452, 458
joining, 456–457
length of a, obtaining the, 155, 442
modifiable, creating and working with, 458–465
modifying, 452–454
numbers to and from, converting, 480–482
parsing a formatted input, 609–611
reading, 310–312
searching, 450–452
StringBuffer class, 154, 439, 441, 452, 458–465, 522
methods, table of some, 464
StringBufferInputStream deprecated class, 670
StringBuilder class, 154, 439, 441, 452, 465, 522, 632, 633
and synchronization, 465
StringJoiner class, 662
StringReader class, 308
StringTokenizer class, 609–611
methods, table of, 610
StringWriter class, 308
strokeLine( ), 1110
strokeOval( ), 1110
strokeRect( ), 1110
strokeText( ), 1110
Stroustrup, Bjarne, 6
Stubs (RMI), 996
generic, 362–366
submit( ), 930
Sun Microsystems, 6, 14, 15, 16
and bounded wildcard arguments, 354
and interface default methods, 213
and method references, 399
and methods or instance variables, 172–173, 178
super( ), 333
and superclass constructors, 169–172, 176, 246
Superclass, 22, 163–166, 181, 189
abstract, 183–186
generic, 362–364
Supplemental character, definition of, 484
Supplier<T> predefined functional interface, 407, 666, 975
@SuppressWarnings built-in annotation, 295, 297
Swing, 14, 17, 305, 786–787, 829, 1011–1057, 1095
applet, 1016
application, example of a simple, 1016–1021
and the AWT, 801, 829, 1011–1012
component classes, list of, 1014–1015
components. See Components, Swing
containers. See Container(s), Swing
event handling, 1020–1024
history of, 1011–1012
and Java Web Start, 1235–1236, 1239
menus. See Menu(s), Swing
and MVC architecture, 1013–1014
packages, list of, 1016
and painting, 1024–1028
Swing: A Beginner’s Guide (Schildt), 1011
SwingConstants interface, 1030
SwingUtilities class, 1020
and auto-unboxing, 282
nested, 90
using enumeration constants to control a, 87, 268–270
using a String to control a, 16, 87, 89–90
versus the if statement, 90–91
Synchronization, 13, 239–240, 251–255
and atomic operations, 936–937
and collections, 540, 585, 592
and deadlock, 260–261
and interprocess communication, 255–260
objects, using, 908–927
race condition and, 253
and StringBuilder class, 465
via synchronized block, 253–255, 585
via synchronized method, 240, 251–252
versus concurrency utilities, traditional, 905, 954
synchronized modifier, 251, 905, 934, 954
used with a method, 251–253
used with an object, 253–255
SynchronousQueue class, 933
System class, 28, 36, 308, 495–498
methods, table of, 495–496
System.err standard error stream, 308, 309, 495
System.exit( ), 495, 787, 790, 807, 809, 1068, 1170
System.getProperties( ), 496, 603
System.getProperty( ), 496, 498
System.in standard input stream, 308, 309, 492, 495, 647, 708
System.in.read( ), 95
System.Logger interface, 499
System.LoggerFinder class, 499
System.nanoTime( ), 496, 497, 946
System.out standard output stream, 28, 36, 308, 309, 312, 313, 492, 495, 647, 693, 695, 708
and static import, 331
T
Tabbed panes, 1042–1044
Table, Swing, 1055–1057
TableColumnModel, 1055
TableModel, 1055
TableModelEvent class, 1055
@Target built-in annotation, 295, 296, 298
client sockets, 753–756
disadvantages of, 764
See also Transmission Control Protocol (TCP)
TemporalAccessor, 637
TERMINATED, 264
Ternary if-then-else operator (?:), 78, 80
test( ), 407, 664, 665, 666, 962–963
Text
components as an event source, 781, 782
editing controls, 830, 850–854
formatting using java.text classes, 981, 997–1002
output using font metrics, managing, 825–828
Text class, 1160
Text fields, 781
AWT, 850–852
Swing, 1031–1033
TextArea class
JavaFX, 1146
TextComponent class, 804, 850, 853
TextEvent class, 773, 781, 853
TextField class
JavaFX, 1144–1146
TexInputControl, 1144
TextInputDialog, 1146
TextListener interface, 783, 785
textValueChanged( ), 785
thenComparing( ), 574, 579–580
thenComparingDouble( ), 574
thenComparingInt( ), 574
thenComparingLong( ), 574
and lambda expressions, 393
and type annotations, 297, 298, 301
this( ), 331–333
Thompson, Ken, 4
Thread class, 14, 240, 241, 246, 262, 264, 509, 510–512, 628, 905, 938
extending, 245–246
methods, table of, 510–512
Thread pool, 905, 927–239, 939, 940–942, 945, 948, 953–954
common, 939, 940, 941, 942, 945, 948, 954
Thread(s)
communication among, 255–260
creating, 242–247
creating and starting a, 265–266
and deadlock, 260–261, 512, 1020
definition of the term, 237
executors to manage, using, 907, 927–929
JavaFX, 1102
local variables, 517
main, 240–242, 244, 246, 247, 248, 1020
messaging, 240
race condition of, 253
resuming, 262–264, 512, 514–516
return a value, that, 929–932
and spurious wakeup, 256
states of, possible, 239, 264–265
stopping, 262
suspending, 240, 242, 262–264, 512, 514–516
and Swing, event dispatching, 1020, 1024, 1260
synchronization. See Synchronization
Thread.UncaughtExceptionHandler interface, 524
ThreadGroup class, 509, 512–516, 524
methods, table of, 513–514
ThreadLocal class, 517
ThreadPoolExecutor class, 907, 927
Throwable class, 218, 219, 222, 226, 227, 231, 234, 322, 377, 519, 520
methods defined by, table of, 232
obtaining an object of the, 226–227
Thumb, 847
time Calendar class instance variable, 618
Time and date
formatting, 637–638, 981, 997–1001, 1003–1006
java.util classes that deal with, 616–626
strings, parsing, 1006–1007
Time and Date API, 618, 981, 997, 1001–1007
packages, list of, 1001
timedJoin( ), 933
timedWait( ), 933
TIMED_WAITING, 264
Timer class, 628–630
methods, table of, 630
TimerTask class, 628–630
methods, table of, 629
Timestamp, event, 773
TimeUnit enumeration, 907, 914, 930, 932–933
TimeZone class, 623–624
methods defined by, table of some, 623–624
to
to( ), 494
toBinaryString( ), 477, 479, 480, 481–482
toCharArray( ), 446
toChronoUnit( ), 933
toDays( ), 933
ToDoubleFunction functional interface, 666, 971
toFile( ), 722
Toggle button, JavaFX, 1123–1125
adding an image to a, 1123
Toggle button, Swing, 1035–1037
Toggle interface, 1123, 1125, 1132
Toggle group, 1125, 1126, 1128
handling change events in a, 1128–1129
and RadioMenuItems, 1173
ToggleButton class, 1123–1125, 1126
ToggleGroup class, 1126, 1128, 1132
toHexString( ), 471, 472, 477, 480, 481–482
toHours( ), 933
tokens( ), 657
toLanguageTag( ), 626
toLocalDate( ), 1003
toLocalTime( ), 1003
toLowerCase( ), 455–456, 483, 485
toMicros( ), 933
toMillis( ), 933
toMinutes( ), 933
toNanos( ), 933
toOctalString( ), 477, 480, 481–482
Toolbars, 1059, 1060, 1077–1079, 1161, 1163, 1179–1180
undocked, 1077
Tooltips, 1071, 1077, 1078, 1079, 1115, 1160, 1179–1180
TooManyListenersException, 1192
toSeconds( ), 933
toString( ), 187, 188, 222, 231, 232, 278, 285, 291, 313, 444, 455, 471, 472, 474, 475, 477, 480, 481, 487, 499, 503, 512, 514, 518, 519, 520, 521, 522, 543, 590, 595, 601, 612, 613, 615, 617, 631, 633, 635, 694, 708, 722, 723, 753, 772, 820, 826, 953, 990, 1052
advantages to overriding, 188, 444–445
totalCPUDuration( ), 485
toZonedDateTime( ), 622
Transform class, 1156
Transforms, 1156–1157
program demonstrating, 1157–1160
transient modifier, 322–323, 1193
transitive keyword, 35, 410, 420–424
Translate class, 1156
translatePoint( ), 779
Transmission Control Protocol (TCP)
definition of, 749
and stream-based I/O, 750
See also TCP/IP
TreeExpansionEvent class, 1052
TreeExpansionListener interface, 1052
TreeItem class, 1150, 1151, 1154
TreeMap class, 568, 570–571, 572, 608
example using a comparator, 577–580
TreeModel, 1052
TreeModelEvent class, 1052
TreeModelListener interface, 1052
TreeNode interface, 1052
TreePath class, 1052
Trees
JavaFX, 1150–1154
Swing, 1051–1054
TreeSelectionEvent class, 1052
TreeSelectionListener interface, 1052, 1053
TreeSelectionModel, 1052
TreeSet class, 541, 547, 548–549, 572, 608
example using a comparator for sorting an instance of the, 575–577
TreeView class, 1150–1154
trim( ), 454
true, 36, 42, 43, 45, 77, 78, 79
TRUE, 485
True and false in Java, 45, 77
Truncation, 51–52
try block(s), 217, 218, 220–226, 227–229, 236
nested, 224–226
try-with-resources statement, 16, 218, 235, 314, 319–322, 524, 646, 653, 676, 677–678, 684, 720, 722, 729, 743, 754, 756, 765, 956
advantages to using, 319, 321, 678
trySplit( ), 978–979
tryUnfork( ), 953
Two’s complement, 68–69
Type argument(s), 338, 340, 344
and bounded types, 345–347
and generic class hierarchies, 362
and generic interface implementation, 360
and type inference, 356, 370–371
Type conversion
narrowing, 50
widening, 50
Type enumeration, 494
Type interface, 526
Type parameter(s)
and bounded types, 344–347, 359–360
cannot create an instance of a, 375
and class hierarchies, 363–366
and primitive types, 340
and static members, 375
and type safety, 340
used with a class, 338, 343–345 347
used with a method, 338, 354–357
and wildcard arguments, 347–356
Type safety
and collections, 585
and generic methods, 357
and generics, 335, 336, 339, 340–342
and raw types, 360–362
and wildcard arguments, 347–350, 351
type( ), 494
Type(s), 29
bounded, 345–347
casting, 50–52
checking, 13, 16, 37, 339, 340, 361, 377
class as a data, 111, 113, 115, 116, 117, 128
inference, 356, 370–371, 381, 384, 387, 393
non-reifiable, 297
raw, 360–362
SAM (Single Abstract Method), 380
simple, 37
Types, primitive (simple), 37–38, 116, 138, 276, 340, 468
autoboxing/unboxing and, 279–282, 284, 544
and collections, 544
iterators for, 529
to a string representation, converting, 443, 444, 454–455
to or from a sequence of bytes, converting, 696–698
wrappers for, 276–279, 284, 340, 468–485
Typesafe view of a collection, obtaining a dynamically, 585
U
UI delegate, 1014
UnaryOperator<T> functional interface, 407, 666
UnavailableException, 1207, 1210
Unboxing, 279
UncaughtExceptionHandler interface, 524
method uncaughtException( ), 524
Unchecked warnings and raw types, 362
UnicastRemoteObject, 994
Unicode, 41, 42, 45, 306, 307, 441, 442, 446, 484, 699
code points, table of some Character methods providing support for, 486
support for 32-bit, 484–485
Unicode Technical Standard (UTS) 35, 626
Uniform Resource Identifier (URI), 763
Uniform Resource Locator (URL). See URL (Uniform Resource Locator)
UnknownHostException, 752
unmodifiable… collections methods, 584–585
UnsupportedOperationException, 212, 230, 530, 532, 533, 551, 561, 585, 727
URI (Uniform Resource Identifier), 763
URI class, 763
URL (Uniform Resource Locator), 757, 763, 1201, 1202
query string, 1218
specification format, 757
URLConnection class, 758–761, 763
methods, list of some, 759
useDelimiter( ), 655–656
User Datagram Protocol (UDP), 750, 764
useRadix( ), 657
uses
UTS 35, 626
UUID class, 662
V
val( ), 285
value (annotation member name), 294, 295
valueChanged( ), 1047, 1048, 1052, 1053
valueOf( ), 270–271, 277, 278, 444, 454–455, 469, 471, 472, 473, 474, 475, 478, 480, 482, 485, 487, 521, 612
van Hoff, Arthur, 6
and ambiguity, 161–162
methods, overloading, 160–161
and Java’s printf( ), 157
Variable(s), 46–50
capture, 393–394
declaration, 29, 31, 46–47, 48–50
definition of the term, 28, 46
dynamic initialization of, 47
effectively final, 393–394
enumeration, 268
instance. See Instance variables
interface reference, 200–202, 206
and JShell, 1246–1247
loop control, 95, 96, 97, 98, 99
member, 21
object reference. See Object reference variables
scope and lifetime of, 47–50
temporary, 1252
volatile, 323
Vector class, 528, 541, 560, 592, 593–597
legacy methods, table of, 594–595
Version information, obtaining, 492
VetoableChangeListener interface, 1193, 1194
Viewport, scroll pane, 1044, 1045, 1147
Void class, 485
W
wait( ), 187, 188, 255–256, 258–259, 262–264, 499, 905, 933, 935, 954
WAITING, 264
WALL_TIME, 625
walk( ), 725
walkFileTree( ), 746–748
Warth, Chris, 6
Watchable interface, 722
WeakHashMap class, 568
Web. See World Wide Web
Web browser, 757, 1201, 1202, 1205, 1206
Web server and servlets, 1202
Web Start. See Java Web Start
WebView class, 1186
weightx constraint field, 865, 866
weighty constraint field, 865, 866
while loop, 91–92
and break, 105
characters, 609
from a string, removing, 454
Wildcard arguments, 347–354, 368
bounded, 350–354
used in creating an array, 377
Window, AWT-based
class hierarchy, 804–805
close event, 787, 790, 795, 807
frame. See Frame window
and graphics, 810
paint mode, setting the, 818–819
top-level, 805
Window class, 782, 804, 805, 807, 874
Window, Swing JFrame, 1018
windowActivated( ), 786
windowClosed( ), 786
windowClosing( ), 786, 790, 794, 807, 809
WindowConstants interface, 1019
windowDeactivated( ), 786
windowDeiconified( ), 786
WindowEvent class, 773, 775, 781–782
WindowFocusListener interface, 783, 785, 795
windowGainedFocus( ), 785
windowIconified( ), 786
WindowListener interface, 783, 786, 790, 794, 795, 807, 809
windowLostFocus( ), 785
windowOpened( ), 786
Windows look and feel, 1013
WindowStateListener interface, 795
World Wide Web (WWW), 6, 7, 12, 18, 757
wrap( ), 720
Wrappers, primitive type, 276–279, 284, 340, 468–485
WRITE, 494
write( ), 307, 308, 312, 318–319, 681, 700, 711, 712, 721, 734, 735, 739
Writer class, 307–308, 678, 679, 700, 701, 711
methods defined by, table of, 700
writeExternal( ), 711
writeTo( ), 688
X
XOR (exclusive OR) operator (^)
XOR paint mode, 818–819
Y
Yellin, Frank, 6
Z
Zero crossing, 69
ZIP file format, 667
18.119.235.79