Symbols
- + or += (addition operator), 8, 98, 446, 469
- & (and operator), 5, 445
- ^ (and/or operator), 5, 445
- —> (arrow operator), 212, 235, 370–371, 454, 498, 507, 543
- = (assignment operator), 418–419, 431, 554–555, 558
- @ (at symbol), 5, 445
- (backslashes), 20, 378, 449, 545
- ? (bind variables), 351, 537
- ~ (bitwise complement operator), 5, 7, 14, 408, 445, 448, 552
- [ ] (brackets), 186, 197, 200, 434, 490, 494–495, 558
- {} (braces), 41–42, 150, 212, 451–452, 454–455, 482, 498
- : (colons), 340, 454, 536
- += or -= (compound assignment operators), 314–315, 529
- -- (decrement operator), 8, 446
- / (division operator), 8, 431, 446, 558
- :: (double colon operator), 222, 228, 503, 504
- $ (dollar sign), 102, 369, 384, 444, 470, 542, 547
- == (equality operator), 426–427, 431, 556, 558
- ++ (increment operator), 8, 408, 446
- /** **/ (Javadoc comments), 367, 542
- ! (logical complement operator), 8, 418, 446, 554
- | (logical operator), 20, 449, 454
- || (logical or operator), 5, 30, 418, 445, 452, 554
- % (modulus operator), 431, 558
- /* */ (multiline comments), 367, 542
- * (multiplication operator), 8, 431, 446, 558
- ! (not operator), 395, 549
- != (not equals operator), 8, 431, 446, 558
- ( ) (parentheses), 17, 150, 212, 448, 451, 482, 498
- . (period), 270, 292, 332, 517, 523, 534
- ++ (pre/post-increment operator), 299–300, 310, 525, 528
- + (plus sign), 5, 445
- -- (post-decrement operator), 3, 310, 444, 453, 528
- ++ (pre/post-increment operator), 418, 554
- ? (question mark), 182, 199, 201, 401, 489, 495, 550
- < or <= or >= (relational operator), 8, 431, 446, 558
- && (short-circuit logical operator), 8, 30, 431, 446, 452, 558
- / / (single-line comments), 367, 542
- ""+ (string concatenation), 140, 480
- ?: (ternary operator), 401–402, 418, 550, 554
- """ (triple quotes), 2, 4, 13, 19, 22, 430, 444–446, 447, 449–450, 557
- _ (underscore), 11, 102, 133, 163–164, 369, 384, 414, 437, 444, 447, 470, 478, 485, 542, 547, 554, 559
A
abs()
method, 386, 547
abstract
class
- abstract methods in, 138–139, 479
- access modifiers, 431, 557
- compared to interfaces, 431, 557
- constructors, 100, 470
- extending, 55, 131, 322, 457, 478, 531
- limitations, 85, 133, 459, 466, 478
abstract
methods
- access modifiers, 431, 458, 462, 557
- within functional interfaces, 63, 112–113, 121–122, 134, 459, 473, 475, 478
- implementing, 406, 552
- inheritance, 69, 461, 465
- limitations, 98–100, 110–111, 137–139, 381, 410–411, 439, 467, 469–470, 472, 479, 546, 552, 560
- overriding, 128, 131, 465, 477, 478
private
modifier, 47, 455, 458, 462
protected
modifier, 455
abstract
modifier, 110, 472
abstract read()
method, 108–109, 472
accept()
method, 213, 230–231, 499, 506
- access modifiers
- abstract methods, 431, 458, 462, 557
- for classes, 469
- commenting out, 135, 479
- leaving blank, 415, 554
- limitations of, 48, 78, 455, 464
- package, 119, 474
- private (See
private
modifier)
- protected (See
protected
modifier)
- public (See
public
modifier)
- accessor, defined, 81, 465
addFirst()
method, 206, 497
- addition operator (+ or +=), 8, 98, 446, 469
addLast()
method, 206, 497
addStationName()
method, 203, 496
allMatch()
method, 258, 420, 514, 555
- and operator (&), 5, 445
- and/or operator (^), 5, 445
- anonymous classes, 67–68, 108, 127, 136–139, 461, 472, 476, 479
another-Line
object, 6, 445
anyMatch()
method, 258, 420, 514, 555
apply()
method, 230–231, 506
args
variable, 456
ArrayIndexOutOfBoundsException
, 74, 152, 165, 174, 188, 203, 206, 376, 452, 454, 463, 482, 486, 488, 491, 496–497, 544
ArrayList
class, 34, 182, 405, 551
- arrays. See also collections
- adding elements, 182, 183, 203, 489, 490, 496
- array parameters, 62, 459
- brackets in, 197, 494
- comparing elements, 196–197, 437, 494, 559
- converting to
List
, 411, 552
- creating, 182, 190, 192, 194, 206, 370, 403, 489, 492, 493, 497, 543, 551
- declaring, 434, 558
- exceptions, 300, 452, 454, 525
- indexing, 204, 206, 496–497
int
in, 185–186, 490
- loops, 206, 376, 496–497, 544
- multidimensional, 183, 186, 188, 196, 200, 202, 490, 491, 494, 495, 496
- removing elements, 202, 496
- sorting elements, 185, 190, 191, 194, 195, 198, 199, 200, 202, 208–209, 412, 432–433, 490, 492, 493, 494, 495, 497, 552, 558
String
in, 184, 185–186, 199–200, 209, 224–225, 490, 495, 497, 504
- threads in, 315, 529
- two-dimensional, 183, 193–194, 195, 199–200, 209, 490, 493, 495, 498
- unsorted, 371, 543
Arrays.compare()
method, 196–197, 494
ArrayStoreException
, 199–200, 495
- arrow operator (—>), 212, 235, 370–371, 454, 498, 507, 543
- assignment operator (=), 418–419, 431, 554–555, 558
- at symbol (@), 5, 445
AutoCloseable
interface, 158, 160, 367, 377, 484, 542, 545
- autocommit mode, 351, 538
average()
method, 218, 226, 235, 501, 504, 507
B
- backslashes (), 20, 378, 449, 545
Bend
interface, 56–57, 458
BiConsumer
, 216, 500
BiFunction
interface, 212, 216, 242, 246, 498, 500, 509, 511
binarySearch()
method, 191, 198, 202, 492, 494, 495
- bind variables, 341–342, 347–348, 536, 537
BiPredicate
interface, 233, 506
- bitwise complement operator (~), 5, 7, 14, 408, 445, 448, 552
blocks
variable, 193–194, 493
boolean
expressions, 36, 38, 453
boolean/Boolean
data types
- class, 451
- default initialization, 65, 460
- operators, 5, 8, 9, 395, 431, 445–446, 448, 549, 558
- required conditions, 451
BooleanSupplier
interface, 243, 263–264, 509, 516
- bottom-up migration, 278, 286–287, 289, 411, 519, 522–523, 552
- braces ({}), 41–42, 150, 212, 451–452, 454–455, 482, 498
- brackets ([ ]), 186, 197, 200, 434, 490, 494–495, 558
break
statement, 31, 32, 35, 43, 452, 453, 455
BufferedReader
class, 334–335, 534
byte
variable, 26, 450–451
byteValue()
method, 21, 450
C
Callable
parameter, 296–297, 524
case
keyword, 452
case
statement, 39–40, 398, 452–455, 457, 550
- catch blocks, 150, 154, 160, 167–168, 170–171, 395, 482–487, 549
ceil()
method, 386, 547
- chaining, 448
char
arrays, 324, 531
char
type, 26, 449–451
Character
class, 450–451
charAt()
method, 7, 232, 446, 506
- checked exceptions
- handling, 156, 164–165, 301–302, 327–328, 410, 483, 485–486, 526, 532, 553
- method signatures, 170, 487
- overriding, 96, 119–120, 161–162, 171–172, 175–176, 366–367, 385–386, 441, 469, 475, 485, 487–488, 541, 547, 560
- try/catch/finally, 157, 483
ChronoUnit enum
parameter, 10, 447
ClassCastException
, 138–139, 164, 165, 179, 188, 441, 479, 485, 486, 489, 491, 560
- classes. See also subclasses
- accessibility, 68, 461
- anonymous, 67–68, 108, 127, 136–139, 461, 472, 476, 479
- assigning, 467
- concrete, 100, 121, 470, 475
- creating, 47, 455, 456
- declaring, 102, 117, 118, 182, 382–383, 427, 455, 456, 460, 469, 470, 474, 489, 546, 557
- defining as local types, 378, 545
- exception, 159, 484
- extending, 72, 100, 101, 116–117, 394, 462, 470, 474, 548
final
, 67, 100, 128, 461, 470, 477
- immutable, 6–7, 13, 17, 67, 87–88, 113, 122, 445, 447, 449, 459, 461, 467, 473, 475
- implementing, 46–47, 455, 456
- importing methods, 106, 471
- inheritance, 58–59, 88, 458, 467
- inner, 105, 126, 142, 373, 469, 471, 476, 480, 543
- instantiation, 101, 409–410, 470, 552
- interfaces, compared to, 146–147, 431, 481, 557
- interfaces, multiple, 95, 120–121, 468, 475
- interfaces and, 48, 55, 146–147, 456, 457, 481
- local, 64, 460
- member variables, 115, 473
- modifiers, 100, 470
- mutable, 446
- nested, 59–60, 64–65, 108, 411–412, 459, 460, 472, 552
- overriding methods, 128, 457, 477
- polymorphism, 456
- sealed, 72, 107, 129–130, 462, 472, 477
static
, 59–60, 64–65, 140, 459, 460, 480
- time zone, concept of, 2, 444
- top-level, 469
- wrapper, 1, 12, 17, 26, 447, 449, 450–451
- classpath
- accessing from module path, 287
- long forms, 422, 555
- migration, 286, 289, 520, 523
- modules on, 268, 279, 281, 291, 442, 517, 519–523, 560
climb()
method, 178–179, 489
close()
method, 158, 160, 166, 170, 176, 377, 484, 486, 487, 488, 545
Closeable
interface, 160, 176, 367, 484, 488, 542
collect()
method, 220, 242, 427, 502, 509, 557
Collection
interface, 203, 256, 260, 405, 496, 514, 515, 551
- collections. See also arrays;
List
collections; Map
collections
- concurrent, 306, 312, 526–527, 528–529
Deque
, 189, 196, 206, 409, 491, 494, 497, 552
- immutable, 195, 197, 493–494
null
values in, 200, 495
- parallel streams with, 236, 256, 310–311, 507, 514, 528
Set
, 188, 189, 190, 195, 200, 491, 493, 495
- sorting elements, 198, 494
- wildcards, 401, 550
Collector
argument, 220, 264, 502, 516
Collectors
, 427, 557
- colons (:), 340, 454, 536
- command-line arguments, 199, 495
- commas, 454
- comments, 135, 367, 462, 479, 542
CompactNumberFormat
, 359, 392, 540, 548
Comparable
interface, 205, 496
Comparator
, 184–185, 254, 257, 421, 490, 513, 514, 555
compare()
method, 421, 437, 555, 559
compareTo()
method, 192, 421, 492, 555
- compound assignment operators (+= or -=), 314–315, 529
-
compute()
method, 169, 486
concat()
method, 214, 449, 499
- concrete classes, 100, 121, 470, 475
- concurrency, 300, 306, 308–310, 312, 314–315, 395, 404, 525–529, 549, 551
Concurrent
class, 300, 404, 525, 551
Connection
interface, 340, 351, 536, 538
conn.rollback()
method, 343–344, 346, 536, 537
- constructors
- calling, 71, 82–83, 111, 157–158, 462, 465, 473, 484
- compact, 76, 123–124, 145–146, 378, 396, 463, 476, 481, 545, 549
- compared to methods, 68, 461
- cyclic dependency, 134–135, 479
- deferred execution, 216, 500
- exceptions, 153, 157–158, 173, 176, 482, 484, 487–488
- ignoring input to, 447
- implementing, 110, 141, 464, 472, 480
- lambda expressions, 217, 501
- missing, 390, 548
- multiple, 460
- no-argument, 68, 73, 111, 118, 126, 130, 153, 366–367, 379, 431–432, 461, 463, 473, 474, 476, 477, 482, 541, 545, 558
- overloaded, 76, 145–146, 463, 481
- values in, 124, 476
Consumer
interface, 227, 504
- consumers
- creating, 284, 521
- defined, 270, 517
- dependencies, 274, 291–292, 518, 523
- recompiling, 420, 555
count(*)
function, 349, 537
count()
method, 218, 501
- country codes, 360, 411, 540, 552
-cp
option, 422, 555
createStatement()
method, 352, 538
- currency, formatting, 356–357, 361, 392, 539, 540, 548
- currency symbols, 102, 133, 444, 470, 478
- cyclic dependencies
- breaking, 375, 544
- constructors, 134–135, 479
- JARs, 271, 274, 518
- modules, 272–273, 285, 293, 375, 518, 521, 524, 544
D
-d
option, 285, 521
- dashes (-), 269–270, 517
- databases, 340, 341, 347–352, 424–425, 536–538, 556
- dates
- adding, 5, 14, 16–17, 20, 445, 448–449
- formatting, 354–357, 359–361, 363–364, 372, 538–541, 543
- subtracting, 5–6, 11–12, 20, 445, 447, 449
- types, 448
DateTimeException
, 12, 447
DateTimeFormatter
, 355, 357, 359–360, 538–540
- daylight savings time, 2–4, 6–7, 10–11, 13, 22, 385, 425, 444–445, 447–448, 450, 547, 556
- deadlock, 312, 376–377, 528, 544
- decrement operator (--), 8, 446
default
interface, 380, 546
default
keyword, 129, 455, 477
default
method
- inheritance, 69, 457, 462, 465
- overriding, 48, 380, 456, 546
- using, 101, 470
default
modifier
- functional interfaces, 467
- incorrect usage, 71, 462
- methods within an interface, 75–76, 89, 463, 467
default
statements, 26, 28, 418, 451, 554
- defensive copies, 67, 461
Deque
collections, 189, 196, 206, 409, 491, 494, 497, 552
- deserialization, 323–324, 336, 438, 531, 534, 559
- diamond operator (<>), 196, 198, 395, 494–495, 549
- direct types, 205, 496
distinct()
method, 246, 510
- division operator (/), 8, 431, 446, 558
- dollar sign ($), 102, 369, 384, 444, 470, 542, 547
- dot notation, 465
Double
, 182, 212, 216, 489, 498, 500
- double colon operator (::), 222, 228, 503, 504
double
type, 5, 6, 26, 216, 226–227, 445, 450–451, 500, 504
DoubleBinaryOperator
interface, 371–372, 543
DoublePredicate
interface, 253, 513
DoubleStream
, 218, 501
DoubleSupplier
interface, 215, 499
DoubleUnaryOperator
interface, 246, 511
do/while
loop, 36, 40, 373–374, 453, 454, 543
DriverManager
, 341, 536
Duration
class, 2, 5–6, 444, 445
E
else
statement, 34, 36–37, 452, 453
- encapsulation
- broad access, 458
- poor/improper, 70–71, 91–92, 462, 468
- proper, 64, 73–74, 86–87, 130, 145, 460, 463, 466, 477, 481
- using, 460
enum
, 3, 26, 78, 444, 451, 457, 464
- enums
- changing value of, 88–89, 467
- constructors, 98–99, 398, 469, 550
- defined, 59–60, 459
- properties, 465
- punctuation, 132, 423–424, 478, 556
- valid, 423–424, 556
- equality operator (==), 426–427, 431, 556, 558
equals()
method, 401, 550
Error
case, 154, 173–174, 177, 483, 488
- escaping text, 364, 436–437, 541, 559
- essential whitespace, 4, 445
Exception
, 153, 167–168, 210, 482, 486, 498
Exception
constructor, 153, 482
- exception handling
- catch blocks, 150, 154, 160, 167–168, 170–171, 395, 482–487, 549
- custom, 155, 176, 483, 488
- lambda expressions, 327–328, 532
- method overrides, 119–120, 161–163, 166, 171–172, 175, 475, 485, 486, 487, 488
- by methods, 164–165, 170, 410–411, 485–487, 552
- multi-catch blocks, 160, 167–168, 170–171, 395, 484, 486–487, 549
- passing to methods, 176–177, 488
- try/catch/finally, 151–154, 156–157, 161, 163–168, 170, 172–175, 178–179, 241, 321, 413–414, 423, 428, 482–483, 485–489, 509, 530, 553, 556–557
- try-with-resources, 150, 152–154, 156, 162, 166, 177, 321, 326, 333–334, 367, 377, 388–389, 438, 482–483, 485–486, 488, 530–532, 534, 542, 545, 547, 559
- exceptions
- checked (See checked exceptions)
- constructors in, 153, 157–158, 173, 176, 482, 484, 487–488
- inheritance, 156, 167–169, 175, 179, 410, 483, 486, 488, 489, 552
- naming, 163–164, 485
- unchecked, 86, 155, 162–163, 171, 172, 190, 466, 483, 485, 487, 492
execute()
method, 311, 341, 345, 407, 528, 536, 537, 552
executeQuery()
method, 341, 347–348, 536, 537
executeUpdate()
method, 341, 536
Executors
class, 302, 526
ExecutorService
, 297, 302–303, 314, 392, 524, 526, 529, 548
exports
directive, 269, 276, 279–280, 517, 519–520
F
FileAlreadyExistsException
, 531
FileNotFoundException
, 119–120, 170–171, 413–414, 475, 487, 553
Files
class, 321–322, 530
Files
methods, 330–331, 533
Files.find()
method, 330, 533
Files.isSameFile()
method, 330, 533
Files.lines()
method, 333, 337, 534
Files.list()
method, 337, 534
Files.readAllLines()
method, 333, 534
Files.walk()
method, 330–331, 533
filter()
method, 202, 237, 246, 408–409, 496, 507, 510, 552
final
modifier
- classes, 67, 100, 122, 128, 461, 470, 475, 477
- implementing, 84, 379, 466, 545
- implicit application of, 53, 77, 457, 464
- limitations, 46, 53, 98–99, 101, 139, 394, 455, 457, 458, 462, 465, 469, 470, 479, 548
- try-with-resources statements, 154, 388–389, 483, 547
findAny()
method, 218, 231, 378, 501, 506, 545
findFast()
method, 378, 545
findFirst()
method, 248, 378, 511, 545
findSlow()
method, 378, 545
flatMap()
method, 219, 260, 261, 434–436, 501, 515, 559
float
parameter, 6, 98, 445, 469
float
type, 26, 451, 467
- floating-point types, 26, 451
floor()
method, 23, 450
- flow scoping, 401, 452, 550
for
loops
- commas, 454
- compared to for-each, 29, 452
- creating, 376, 544
- executing, 38, 425, 438–439, 454, 556, 560
- for-each loops, 29, 31–32, 36, 451–453
forEach()
method, 203, 221–222, 228, 260, 264, 331, 402, 496, 502, 504, 515–516, 533, 551
forEachOrdered()
method, 239, 316, 508, 530
- formal types, 191, 193, 205, 369–370, 492, 493, 496, 542
for-reversed
loops, 31–32, 452
Function
, 232, 421–422, 506, 555
- functional interfaces
BooleanSupplier
, 243, 509
- creating, 56–57, 69, 224, 458, 461, 503
default
modifier, 467
- defined, 112–113, 473
- generic arguments, 219–220, 242, 502, 509
- input arguments, 252–253, 255, 513, 514
- in
java.util.function
package, 218, 253, 501, 513
- lambda expressions in, 210–213, 215–218, 223, 225–226, 228–229, 236, 239, 244–245, 246, 250, 254, 263, 402, 439, 498–501, 503–505, 507–508, 510–513, 516, 551, 560
- limitations, 69, 82, 100, 461, 465, 470
- methods in, 63, 110–113, 121–122, 134, 232, 246, 459, 472–473, 475, 478, 506, 511
- parameters, 226–227, 258, 371–372, 504, 514, 543
- primitive values, 221, 502
private
modifier, 467
- requirements, 121–122, 134, 475, 478
- return types, 227, 504
Supplier
, 225–226, 254, 263–264, 504, 513, 516
- valid, 63, 127, 397, 459, 477, 549
G
- garbage collection
- eligible objects, 92, 140–141, 400, 407, 434, 468, 469, 480, 550, 552, 558
- forcing, 466
- generic types
- changing, 246, 510
extends
keyword, 369–370, 542
- functional interfaces, 219–220, 242, 502, 509
- instantiating, 395, 549
- limitations, 205, 419, 496, 555
- missing, 220–221, 502
- reference, 193, 493
- unspecified, 219, 502
get()
method, 232, 262, 263–264, 307, 506, 516, 527
get
prefix, 81, 465
getAsDouble()
method, 226, 504
getBundle()
method, 358, 539
getColor()
method, 237, 507
getName()
method, 332–333, 386–387, 406, 534, 547, 552
getNumRakes()
method, 60, 459
getOrDefault()
method, 209–210, 498
getSeconds()
method, 2, 444
GetSet
instance, 139–140, 479
getTime()
method, 382–383, 546
getYear()
method, 446
getYears()
method, 446
groupingbyConcurrent()
method, 227–228, 504
I
- idempotent, 158, 484
- identifier names, 163–164, 374, 485, 544. See also variables
if
statement
boolean
expressions in, 38, 453
- compared to
switch
statements, 39–40, 454
- executing, 33, 114–115, 452, 473
- loops, 38–39, 454
- variables declared in, 70, 418, 462, 554
if-else
statement, 34, 401–402, 452, 453, 550
ifPresent()
method, 221–222, 502
if-then
statement, 21, 450
IllegalArgumentException
, 74, 86, 172, 175, 179, 241, 332–333, 395, 463, 466, 487–489, 509, 534, 549
- immutability
- classes, 6–7, 13, 17, 67, 87–88, 113, 122, 445, 447, 449, 459, 461, 467, 473, 475
- collections, 195, 197, 493, 494
- defined, 67, 73–74, 458, 461, 463
- implementing, 87–88, 122, 467, 475
Path
instances, 534, 558
import
statement, 229, 455, 505
IN
parameters, 426, 556
IncidentReportException
case, 173, 487
- increment operator (++), 8, 408, 446
incrementBy10()
method, 307, 527
- indentation, 449
- indexing, 204, 206, 344–345, 447, 453, 496–497, 536–537
- inheritance
- abstract, 69, 461, 465
- classes and subclasses, 58–59, 88, 458, 467
default
methods, 69, 457, 462, 465
- exceptions, 156, 167–169, 175, 179, 410, 483, 486, 488, 489, 552
- methods, 58, 128, 458, 465, 477
- models, 158–159, 484
- multiple, 457, 461
- no-argument constructors, 111, 473
- overriding signatures, 380, 546
init()
method, 127–128, 136–137, 367–368, 477, 479, 542
- initializers
- instance, 116, 455, 467, 474
static
, 80, 107–108, 115–116, 409–410, 455–456, 465, 472, 474, 552
- input parameters, 349, 537
InputStream.
See I/O Streams
insert()
method, 7, 446, 448
- instance initializers, 116, 455, 467, 474
- instance keywords, 54, 457
- instance methods, 117–118, 138, 373, 460–461, 474, 479, 543
- instance variables
- calling based on reference, 58–59, 458
- changing, 459
- defined, 460
- initializing, 171–172, 487
- limitations, 60, 79, 437, 458, 459, 464, 467, 559
instanceof
operators, 109, 405, 472, 551
Instant
class, 14, 21, 448, 450
int
types
- compatible values, 143, 480
- primitive, 442, 560
- variables, 3, 5, 26, 89–90, 226–227, 444–445, 450–451, 467, 504
Integer
class, 77, 204, 238, 260, 450–451, 464, 496, 508, 515
- interfaces
- abstract, 133, 458, 478
- access levels, 62, 75–76, 459, 463
- built-in, 340, 535
- classes and, 48, 55, 146–147, 431, 456, 457, 481, 557
- declaring, 69, 462
- extending, 55, 457, 461
- implementing, 158, 460, 484
- implementing multiple, 95, 97–98, 120–121, 411–412, 468, 469, 475, 552
- inheritance, 128, 465, 477
- JDBC, 340, 535
- limitations, 100, 470
- methods within, 75–76, 89, 93, 100, 392, 441, 463, 467, 468, 470, 548, 560
- methods without bodies, 121, 475
- modifiers, 110, 472
private
modifier, 110, 472
- static, 51–52, 456
static
methods, 89, 100, 110, 119, 381, 467, 470, 472, 474, 546
- sub-interfaces, 370, 542
- using, 79, 464
- variables within, 123, 475
- interfaces, functional
BooleanSupplier
, 243, 509
- creating, 56–57, 69, 224, 458, 461, 503
default
modifier, 467
- defined, 112–113, 473
- generic arguments, 219–220, 242, 502, 509
- input arguments, 252–253, 255, 513, 514
- in
java.util.function
package, 218, 253, 501, 513
- lambda expressions in, 210–213, 215–218, 223, 225–226, 228–229, 236, 239, 244–245, 246, 250, 254, 263, 402, 439, 498–501, 503–505, 507–508, 510–513, 516, 551, 560
- limitations, 69, 82, 100, 461, 465, 470
- methods in, 63, 110–113, 121–122, 134, 232, 246, 459, 472–473, 475, 478, 506, 511
- parameters, 226–227, 258, 371–372, 504, 514, 543
- primitive values, 221, 502
private
modifier, 467
- requirements, 121–122, 134, 475, 478
- return types, 227, 504
Supplier
, 225–226, 254, 263–264, 504, 513, 516
- valid, 63, 127, 397, 459, 477, 549
- interfaces, service provider, 270–271, 277, 282–283, 291, 371, 517, 519, 521, 523, 543
InterruptedException
, 301–302, 526
IntFunction
interface, 227, 260–261, 504, 515
IntStream
interface, 252, 400, 512, 550
IntSummaryStatistics
class, 239–240, 255, 508, 513
IntSupplier
functional interface, 236, 371–372, 507, 543
IntUnaryOperator
, 219–220, 368, 502, 542
invokeAll()
method, 305–306, 526
invokeAny()
method, 305–306, 526
I/O Streams
, 324–326, 328–329, 331, 334–335, 336, 531, 532, 533, 534
IOException
, 170–171, 173, 176, 327–328, 487, 488, 532
isBlank()
method, 16, 448
isEmpty()
method, 16
isNotNull()
method, 221–222, 502
isPresent()
method, 221–222, 502
- iterations, 28, 37–38, 451, 453
J
- JARs
- cyclic dependencies, 271, 274, 518
- modular, 287, 291, 522, 523
- non-modular, 274, 518
- using internal APIs in, 404, 551
java
command, 270, 517
- Java runtime images, 276, 519
javac
command, 273, 285–286, 412, 422, 518, 521, 552, 555
- Javadoc comments (/** **/), 367, 462, 542
java.lang.Error
, 177, 488
- JDBC interfaces, built-in, 340, 535
jdbc
protocol, 340, 536
- JDBC URL, 340, 536
jdeps
command, 275, 280, 282, 284, 293, 404, 519–521, 524, 551
jdeps
output, 286, 522
- JDK, 340, 535
jlink
command, 276, 282, 397, 519, 521, 549
jmod
command, 275, 286, 519, 522
L
LackOfInformationException
, 366–367, 541
- lambda expressions
- accumulators, 221, 502
- asynchronous task definition, 298, 525
- compared to method references, 240, 508
- deferred execution, 216, 246, 500, 511
- defining local variables within, 145, 481
- exception handling, 327–328, 532
- functional interface implementation, 210–213, 215–218, 223, 225–226, 228–229, 236, 239, 244–245, 246, 250, 254, 263, 402, 439, 498–501, 503–505, 507–508, 510–513, 516, 551, 560
- in methods, 223–224, 375–376, 380, 503, 544, 546
- parameters, 143, 249, 380, 480, 512, 546
- passing to methods, 243, 368, 509, 542
- replacing with method references, 233, 245, 248–249, 252, 258, 506, 510–512, 514
- stateful, 245, 312, 395, 510, 528–529, 549
- in streams, 202, 234, 496, 506
- syntax, 234, 235, 370–371, 507, 543
- using method references, 222, 503
- using with
list
, 260, 515
- valid, 212, 214, 253, 256, 262–263, 415, 498, 499, 513, 514, 516, 554
- variables, 220–221, 250, 467, 502, 512
- language codes, 360, 411, 540, 552
- lazy evaluation, 245, 249, 510, 512
length()
method, 7, 26, 238, 446, 450, 508
limit()
method, 214, 499
- line breaks, 378, 430, 545, 557
lines()
method, 333, 534
LinkedList
data structure, 183, 406, 490, 552
List
collections
- changing elements, 206–207, 497
- converting arrays to, 411, 552
- creating, 182–183, 186–187, 193, 201, 208, 210, 403, 489, 491, 492–493, 495, 497, 498, 551
- immutable, 197, 494
- lambda expressions with, 260, 515
null
values in, 200, 495
- removing elements, 202, 208, 496, 497
- semicolons in, 78, 464
- sorting elements, 194, 197, 207, 412, 432–433, 493, 494, 497, 552, 558
- updating elements, 193, 492–493
List.of()
method, 197, 494
- livelock, 301, 525
load()
method, 268, 271–272, 278, 289, 292, 371, 516, 518, 520, 523, 543
loadPod()
method, 361–362, 540
LocalDate
class, 3, 5–6, 8, 355, 444, 445, 446, 539
LocalDateTime
class, 2, 21, 444, 450
Locale
class, 411, 552
- locales
- defining, 354, 358, 538, 540
- formats, 356, 360, 392, 411, 539, 540, 548, 552
- properties files, 356, 357–358, 359, 361–363, 440, 539, 540, 560
- localization
- currency formatting, 356–357, 361, 392, 539, 540, 548
- date formatting, 354–357, 359–361, 363–364, 372, 538–541
- number formatting, 354–355, 359–360, 538, 540
- resource bundles, 359, 361–363, 540
- time formatting, 355, 360–361, 372, 396, 539–540, 543, 549
- using resource bundles, 354, 538
LocalTime
class, 2, 8–9, 444, 446, 448
lock()
method, 298–299, 313, 379–380, 525, 529, 545
lockUp()
method, 298–299, 525
- logical complement operator (!), 8, 418, 446, 554
- logical operator ( | ), 20, 418, 449, 454, 554
- logical or operator ( || ), 5, 30, 445, 452
- logical or operator/disjunctive short-circuit operator ( || ), 418, 554
Long
wrapper class, 12, 447
LongConsumer
interface, 213, 499
LongFunction
interface, 213, 499
LongPredicate
interface, 213, 499
LongSupplier
interface, 213, 227, 499, 504
LongToIntFunction
interface, 371–372, 543
LongUnaryOperator
interface, 253, 513
- loops
- arrays, 206, 376, 496–497, 544
- breaking, 31, 32, 452
- commas, 454
do/while
, 36, 40, 373–374, 453, 454, 543
for
(See for
loops)
- for-each, 28, 29, 31–32, 36, 451–453
for-reversed
loops, 31–32, 452
if
statement, 38–39, 454
- infinite, 36, 313–314, 451, 453, 529
- initialization types, 454
- inner/outer, 373–374, 453, 455, 543
- iterations, 37–38, 453
- ordering elements, 31–32, 452
- requirements of, 40, 454
while
, 29, 36, 40, 373–374, 398, 451, 453–454, 543, 550
M
m()
method, 36–37, 453
-m
option, 288, 522
Magazine
class, 188, 491
magic()
method, 34–35, 243, 509
main()
method
- accessing variables, 456
- creating threads, 376–377, 544
- defining, 59–60, 459
- defining classes with, 94, 136, 468, 479
- exception handling, 164–165, 170, 485–486, 487
- instantiating objects, 93, 107–108, 468, 472
- limitations, 67–68, 79–80, 137–138, 143, 155, 457, 461, 465, 479–480, 483
- passing changes, 103–104, 471
MajorProblemException
, 157–158, 484
Map
collections
- converting streams to, 235, 507
- creating, 183, 187, 195–196, 203, 204, 439–440, 490, 491, 493, 496, 560
- sorting elements, 190, 204, 491, 496
- working with streams, 218, 434–436, 501, 559
map()
method, 234, 434–436, 506, 559
Matrix.
prefix, 84, 466
max()
method, 5, 218, 445, 501
- member variables, 115, 473
- method chaining, 448
- method references
- compared to lambda expressions, 240, 508
- lambda expression utilization, 222, 503
- replacing lambda expressions, 233, 245, 248–249, 252, 258, 506, 510–512, 514
- method signatures
- checked exceptions, 170, 487
- completing, 201, 495
- incorrect, 184–185, 490
- multiple same, 75, 97–98, 133, 143–144, 420–421, 429–430, 463, 469, 478, 481, 555, 557
- overloading, 384–385, 547
- parameters, 226–227, 371–372, 504, 543
- signature matching, 457
- methods. See also specific methods
- abstract (See
abstract
method)
- accessing, 136–137, 367–368, 479, 542
- calling, 177, 388, 390, 488, 547, 548
- case sensitive, 387, 547
- compared to constructors, 68, 461
- declaring, 150, 201, 482, 495
- encapsulation, 458
- exception handling by, 164–165, 170, 410–411, 485–487, 552
- in functional interfaces, 110–113, 121–122, 134, 232, 246, 459, 472–473, 475, 478, 506, 511
- inheritance, 58, 128, 458, 465, 477
- instance, 117–118, 138, 373, 460–461, 474, 479, 543
- within interfaces, 75–76, 89, 93, 100, 392, 441, 463, 467, 468, 470, 548, 560
- lambda expressions in, 223–224, 375–376, 380, 503, 544, 546
- naming, 133, 369, 478, 542
- overloading, 341, 457, 536
- passed to lambda expressions, 243, 368, 509, 542
- passing exceptions to, 176–177, 488
private
interface, 75–76, 147, 463, 481
- side effects, 230, 505
- static, 48, 448, 456, 457
static
(See static methods)
- synchronous operation, 305–306, 526
- virtual invocation, 58–59, 458
- without bodies, 121, 475
- methods, overriding
abstract
methods, 128, 131, 465, 477, 478
- checked exceptions, 96, 119–120, 171–172, 175, 385–386, 441, 469, 475, 487–488, 547, 560
- with classes, 128, 457, 477
- covariant return types, 85, 463, 466
- with covariant return types, 124, 131, 476, 477
- declaring exceptions, 162–163, 485
default
methods, 48, 69, 97–98, 456, 462, 469
- implementing multiple interfaces, 120–121, 475
- inherited
default
methods, 79–80, 106, 465, 471
- instance methods, 460
- limitations, 119–120, 162–163, 166, 171–172, 175, 386–387, 429–430, 475, 485–488, 547, 557
static
and non-static
methods, 99, 470
- throwing exceptions, 161–162, 485
- migration
- automatic modules, 278–279, 411, 519–520, 552
- bottom-up, 278, 286–287, 289, 411, 519, 522–523, 552
- named, 287, 522
- top-down, 274, 289, 411, 518, 523, 552
- unnamed modules, 279, 287, 289, 411, 520, 522–523, 552
min()
method, 23, 450
minus()
method, 5–6, 445
mismatch()
method, 329, 532
MissedCallException
case, 174, 488
MissingResourceException
case, 539
- modifiers. See specific types.
- module path option, 412, 422, 552, 555
module-info
file, 268–270, 272–273, 275–276, 279–280, 291, 442, 517–520, 523, 560
- modules
- automatic, 269, 278–279, 281, 291, 411, 442, 517, 519–521, 523, 552, 560
- built-in, 273, 277, 291, 518, 519, 523
- cyclic dependencies, 272–273, 285, 293, 375, 518, 521, 524, 544
- declaring, 268, 277, 278, 369, 374, 516, 519, 520, 542, 544
- default, 269, 517
- defined, 269, 288, 517, 522
- dependencies, 271, 274, 275, 281–282, 284, 290–292, 517, 518, 519, 521, 523
- directives (See specific directives)
- exposing content, 277, 282, 519, 521
- file formats, 292, 523
jlink
command, 276, 397, 519, 549
- listing, 270, 284, 517, 521
- migration implementation, 274, 278–279, 286–287, 289, 411, 518–520, 522–523, 552
- named, 268, 275, 276, 281, 517, 519, 521
- naming, 270, 275, 292, 517, 519, 523
- recompiling, 420, 555
- service locators (See service locators)
- shared, 281–282, 521
- unnamed, 269, 276, 279, 281, 287, 289, 291, 411, 442, 517, 519–520, 522–523, 552, 560
- modulus operator (%), 431, 558
- multi-catch blocks, 160, 167–168, 170–171, 395, 484, 486–487, 549
- multiline comments (/* */), 367, 462, 542
- multiplication operator (*), 8, 431, 446, 558
- mutability, 458
N
n()
method, 36–37, 453
name
parameter, 457
- nanoseconds, 446
- nested classes, 59–60, 64–65, 108, 411–412, 459, 460, 472, 552
nested()
method, 143, 480
new
keyword, 82–83, 140–141, 150–151, 459, 465, 480, 482
- newline, 449
newValue
variable, 250, 512
- NIO.2 attribute interfaces, 330–331, 533
- no-argument constructors
- assigning value, 379, 545
- default automatically inserted, 68, 118, 130, 366–367, 431–432, 461, 474, 477, 541, 558
Exception
class, 153, 482
- inheritance, 111, 473
- limitations, 73, 126, 431–432, 463, 476, 558
noneMatch()
method, 258, 514
non-sealed
modifier, 46, 58–59, 72, 84, 100, 455, 458, 462, 466, 470
non-static
methods, 99, 470
NoSuchElementException
, 409, 552
NoSuchFileException
, 329–330, 533
- not equals operator (!=), 8, 431, 446, 558
- not operator (!), 395, 549
NotSerializableException
, 335–336, 438, 534, 559
null
- in collections, 200, 495
- initializing to, 403–404, 551
- limitations, 18, 449, 468
- passing, 137–138, 479
- using with
instanceof
, 109, 405, 472, 551
NullPointerException
, 151, 165–166, 169, 175, 179, 200, 214, 328, 333–334, 374–375, 403–404, 441, 482, 486, 488, 489, 495, 499, 532, 534, 544, 551, 560
num
variable, 262–263, 516
- numbers. See also dates
- in class declarations, 102, 470
- currency, 356–357, 361, 392, 539, 540, 548
- formatting, 354–355, 359–360, 538, 540
- in identifier names, 163–164, 485
- rounding, 359, 386, 540, 547
- in variable names, 444
O
o()
method, 36–37, 453
Object
class, 26, 451
- objects. See also
Path
objects; specific objects
- casting, 141–142, 480
- chaining, 448
- declaring, 46, 455
- deserialization, 323–324, 336, 438, 531, 534, 559
- eligible for garbage collection, 92, 140–141, 400, 407, 434, 468, 469, 480, 550, 552, 558
- initialization, 101, 470
- manipulating, 1
- overriding, 72, 462
- polymorphism, 102–103, 107, 141–142, 470, 471, 480
- references to, 125, 476
- serialization, 326, 335–336, 438, 531–532, 534, 559
ObjLongConsumer
interface, 371–372, 543
ofDays()
method, 5–6, 445
offer()
method, 183, 189, 490, 491
- offset changes, 2–3, 444
ofNullable()
method, 389–390, 547
opens
directive, 519
operate()
method, 161–162, 485
- operators. See specific operators
- operators, levels of precedence, 8, 446
Optional
, 262, 389–390, 516, 547
OptionalDouble
, 218, 226, 501, 504
order()
method, 176–177, 488
ordinal()
method, 89–90, 467
OutputStream.
See I/O Streams
- overloading
- compared to overriding, 457
- constructors, 76, 145–146, 463, 481
LocalTime
class, 8, 446
- method signatures, 384–385, 547
- methods, 341, 457, 536
- valid forms, 133, 478
@Override
annotation, 81, 465
- overriding. See also methods, overriding
- access levels, 58, 458
- checked exceptions, 119–120, 171–172, 175–176, 366–367, 385–386, 441, 475, 487–488, 541, 547, 560
- compared to overloading, 457
- including in records, 105, 471
- instance variables, 79, 464
- interface signatures, 380, 546
- limitations, 98–99, 102–103, 107, 469, 471
- objects, 72, 462
- scope, 130–131, 477
- unchecked exceptions, 86, 466
P
p()
method, 36–37, 453
-p
option, 412, 422, 552, 555
- package access
- on module paths, 287, 522
private
, 48, 455
protected
, 119, 132, 367–368, 388, 474, 478, 542, 547
public
, 48, 455
- restricting, 415, 554
- package sharing, 279–280, 520
package
statement, 455
parallel()
method, 229, 232, 256, 505, 506, 514
- parallel streams
- forcing to behave as serial, 243, 312, 510, 528–529
- limitations, 261, 301, 515, 525
- methods executed on, 218, 232, 239, 317, 501, 506, 508, 530
- obtaining equivalent of existing, 214, 217, 229, 252, 256, 499, 501, 505, 512, 514
- reduction, 395, 549
- working with collections, 236, 256, 310–311, 507, 514, 528
- parentheses, 17, 150, 212, 448, 451, 482, 498
parse()
method, 355, 538
parseLong()
method, 12, 447
- pass-by-value, 103–104, 405–406, 471, 551
Path
objects
- creating, 381, 546
- immutable instances, 534, 558
- normalizing, 329, 432, 532, 558
- reading, 327, 330–331, 332, 333–334, 335–336, 532, 533, 534
- traversing, 330, 331, 408–409, 533, 534, 552
- writing, 321–322, 334–335, 337, 530–531, 534
Path.of()
method, 320, 323, 530, 531
Paths.get()
method, 320, 530
- pattern matching, 450, 452
peek()
method, 183, 225, 230–231, 246, 389, 409, 490, 504–506, 510, 547, 552
perform()
method, 31–32, 452
- period (.), 270, 292, 332, 517, 523, 534
Period
class, 2, 16–17, 444–446, 448
permits
clause, 58–59, 72, 116–117, 147, 370, 456, 458, 462, 474, 481, 542
play()
method, 78, 85, 99, 134, 161, 464, 466, 470, 479, 485
- plus sign (+), 5, 445
plusMonths()
method, 448
- polymorphism, 79, 102–103, 107, 141–142, 456, 464, 470, 471, 480
- post-decrement operator (--), 3, 310, 444, 453, 528
- pound (#), 133, 478
- Practice Exam 1
- answers and explanations, 541–548
- questions, 365–390
- Practice Exam 2
- answers and explanations, 548–554
- questions, 391–415
- Practice Exam 3
- answers and explanations, 554–560
- questions, 417–442
Predicate
interface, 241, 254, 258, 259, 509, 513, 515
PreparedStatement
class, 340, 341–342, 348, 351, 536, 537
- pre/post-increment operator (++), 299–300, 310, 418, 525, 528, 554
- primitive types, 221, 383–384, 419, 449, 502, 546, 555. See also specific types
print()
, 95–96, 469
println()
method, 17, 35, 448, 453
private
interface method, 75–76, 147, 463, 481
private
modifier
- abstract methods, 47, 455, 458, 462
- cannot be overridden, 386–387, 547
- compared to
protected
, 86–87, 466
- enum constructors, 98–99, 469
- functional interfaces, 467
- in immutable classes, 67, 461
- implementation, 64, 73–74, 320, 460, 463, 530
- incorrect usage, 71, 462
- inheritance, 465
- instance-based methods, 117–118, 474
- interfaces, 110, 472
- limitations, 48, 114, 455, 459, 473
- methods within an interface, 89, 100, 467, 470
- static methods, 130, 477
- using, 101, 470
private static
modifier, 86, 459, 466, 467
ProblemException
, 157–158, 484
protected
modifier
abstract
methods, 455
- calling methods with, 112, 132–133, 388, 473, 478, 547
- compared to package, 132, 478
- compared to
private
, 86–87, 466
- defined, 461
- implied visibility, 441, 560
- limitations, 458
- subclass access, 459
- using, 48, 99, 455, 468, 470
provides
directives, 280, 283, 519, 520, 521
provides
statement, 275, 519
public
modifier
- abstract interface methods, 458
abstract
methods, 455
- immutable objects, 67, 461
- implicit application of, 62, 77, 459, 464
- interface methods, 110, 472
- limitations, 398, 550
- unsafe implementation, 70–71, 462
- using, 48, 64, 79, 83, 437, 455, 460, 464, 466, 559
Q
q()
method, 36–37, 453
- queries, 347, 424–425, 537, 556
- question mark (?), 182, 199, 201, 401, 489, 495, 550
- queues, 183, 196–197, 206, 409, 490, 494, 497, 552
R
r()
method, 36–37, 453
- race conditions, 309, 421, 525, 527, 555
r.apply()
method, 458
read()
method, 332, 534
readAllLines()
method, 333, 534
Reader
class, 327, 332, 532, 534
- records
- declaring, 46, 455, 460
- defining as local types, 378, 545
equals()
, 401, 550
- including overrides in, 105, 471
- limitations, 467
- unable to extend, 457
reduce()
method, 223–224, 503
- reference types. See specific types
- reference types, implementing, 81, 465
registerOutParameter()
method, 345, 537
- relational operator (< or <= or >=), 8, 431, 446, 558
relativize()
method, 332, 534
remove()
method, 208, 497
RemoveMe
, 383–384, 546
requires
directive, 283, 290–291, 371, 375, 406, 519, 521, 523, 543–544, 552
requires mandated java.base
output, 293, 524
requires
statement, 274, 275, 276, 518, 519
requires transitive
directive, 519
- resource bundles, 354, 359, 361–363, 538, 540
- resource leaks, 331, 533
- resource starvation, 301, 525
ResultSet
interface, 393, 548
return
statement, 40, 398–399, 454, 550
reverse()
method, 3, 194, 432–433, 444, 493, 558
round()
method, 23, 386, 450, 547
run()
method, 60, 459
Runnable
expression, 298, 306, 419, 525, 527, 555
Runnable
functional interface, 415, 554
RuntimeException
, 153–154, 156, 164, 167–169, 174–175, 179, 190, 482–483, 485–486, 488–489, 492
S
-s
option, 288, 522
Sand()
method, 60, 459
sb.length()
method, 448
ScheduledExecutorService
, 308, 311, 527, 528
sealed
modifier
- classes, 72, 100, 107, 129–130, 462, 470, 472, 477
- subclasses, 46, 58–59, 84, 455, 458, 466
SELECT
statement, 351, 538
sell()
method, 457
- semicolons (;)
- enums, 132, 423–424, 478, 556
- in lambda expressions, 214, 499
- in
List
, 78, 464
- optional, 166, 486
- use of, 28, 451
sendHome()
method, 456
sequential()
method, 214, 499
- serial streams
- grouping, 227–228, 504
- infinite sources, 225, 504
- limitations, 261, 515
- methods executed on, 218, 501
- ordered, 250, 512
- reduction, 317, 530
Serializable
, 73–74, 145, 322, 329, 331–332, 463, 481, 530, 533
- serialization, 322, 326, 335–336, 438, 530, 531–532, 534, 559
- service locators
- combining with service provider interface, 270, 517
- creating, 283–284, 521
- defined, 268, 516
- directives, 289, 371, 522–523, 543
- methods on, 278, 371, 520, 543
- module dependencies, 271, 517
ServiceLoader
call, 281, 520
- valid, 418, 554
- service provider interface, 270–271, 277, 282–283, 291, 371, 517, 519, 521, 523, 543
- service providers
- adding, 288, 522
- calling, 292–293, 524
- creating, 275, 282–283, 519, 521
- dependencies, 291–292, 523
ServiceLoader
class, 271–272, 278, 281, 289, 292, 418, 428–429, 518, 520, 523, 554, 557
ServiceLocator
class, 371, 543
- services
- calling, 271–272, 289, 518, 523
- defined, 281, 288, 520, 522
- parts of, 268, 516
setContents()
method, 101, 470
setNull()
method, 340, 535
setObject()
method, 344–345, 536–537
Short
class, 450–451
short
variable, 26, 450–451
- short-circuit logical operator (&&), 8, 30, 431, 446, 452, 558
shutdown()
method, 314, 529
- signature matching, 457
- single-line comments (/ /), 367, 462, 542
sorted()
method, 243–244, 246, 510, 511
speak()
method, 114, 473
Spliterator
, 247, 412–413, 511, 552
- SQL statements, 341, 349, 351, 536, 537, 538
SQLException
, 372–373, 543
- stack traces, 153–154, 168, 241, 482, 486, 509
StackOverflowError
, 488
- statements
static
classes, 59–60, 64–65, 108, 140, 459, 460, 472, 480
static
imports, 106, 147–148, 471, 481
static
initializers, 80, 107–108, 115–116, 409–410, 455–456, 465, 472, 474, 552
static
methods
- hiding, 460
- immutable classes, 449
- interface methods, 89, 100, 110, 119, 381, 467, 470, 472, 474, 546
- keywords in, 54, 457
- limitations, 57, 60, 138, 458, 459, 462, 479
- marking
private
, 130, 477
- in nested classes, 411–412, 552
- overriding, 99, 470
- threads, 302–303, 526
- using, 80, 101, 465, 470
static
modifier, 77, 122, 437, 464, 465, 467, 475, 559
static
variable, 47, 60, 77, 108, 139–140, 455, 459, 464, 472, 479
- stored procedures, 345, 537
Stream
interface
- changing generic types, 246, 510
- creating, 419, 555
- filtering data, 215, 237, 242, 324–325, 389–390, 500, 507, 509, 531, 547
- mapping data, 217, 233, 238–239, 243–244, 366, 400, 500, 506, 508, 510, 541, 550
- sorting data, 242, 246, 509, 511
- source operation, 229, 505
- supplying data, 230, 236, 237, 247, 413, 505, 507, 511, 553
- working with data, 231, 259, 506, 515
- stream pipelines
- avoiding multiple trips through, 239–240, 508
- creating, 212–213, 242, 262, 420, 499, 509, 516, 555
- intermediate operations, 222, 240, 257, 503, 509, 514
- lazy evaluation, 245, 249, 510, 512
- methods, 263, 516
- multiple, 393–394, 548
- order of operations, 212, 498
- terminal operations, 218, 406, 433, 442, 501, 552, 558, 560
- streams. See also parallel streams; serial streams
- concatenation, 214, 265, 499, 516
- decomposition, 261, 515
- empty, 235, 507
- grouping, 235, 250–251, 507, 512
- infinite, 237, 507
- lambda expressions in, 202, 234, 496, 506
- limitations, 219, 240, 502, 508
- mapping data, 229, 366, 393–394, 434–436, 439–440, 505, 541, 548, 559, 560
- ordered, 378, 545
- partitioning, 235, 238, 250–251, 507, 508, 512
- primitive, 226, 442, 504, 560
- reduction, 216, 220–221, 224, 234, 238, 242, 246, 256–257, 395, 500, 502–503, 507–510, 514, 549
- sorting data, 225, 243–244, 247, 413, 439–440, 504, 510, 511, 533, 560
- supplying data, 257, 514
- valid, 222, 228, 503, 504
String
class
- in arrays, 199–200, 209, 224–225, 495, 497, 504
- comparing with method, 414, 554
- errors, 41, 454
- immutable, 6, 13, 445, 447, 449
- modifying data in, 405–406, 551
- supported in
switch
statements, 26, 450–451
- string concatenation (""+), 140, 480
String
data type, 7, 73, 153, 446–447, 463, 482
StringBuilder
class, 3–4, 22, 444, 446, 450
StringBuilder
data type, 7, 446
StringIndexOutOfBoundsException
, 13, 447
strip()
method, 10, 16, 430, 447, 448, 557
stripIndent()
method, 10, 447
stripTrailing()
method, 10, 447
stroke()
method, 57, 458
- subclasses
- non-sealed, 58–59, 458
permits
clause, 147, 481
- sealed, 46, 58–59, 84, 455, 458, 466
substring()
method, 13, 447
sum
, 23, 450
sum
() method, 218, 501
Super
class, 139, 479
super .getWeight()
method, 79, 464
super
keyword, 54, 71, 73, 106, 457, 462–463, 471
super()
method, 95, 111, 141, 464, 468, 473, 480
- superclass constructors, 157–158, 484
- superclasses, 88, 467
Supplier
functional interface, 225–226, 254, 263–264, 504, 513, 516
Supplier<Double>
, 215, 499–500
switch
expressions
- compared to
switch
statements, 39, 398–399, 452, 454, 550
- compiling, 28, 382, 451, 546
default
statements in, 26, 28, 451
- variables in, 89–90, 467
switch
statements
- braces, 454
case
keyword, 452
- compared to
switch
expressions, 39, 398–399, 452, 454, 550
default
statements in, 28, 418, 451, 554
- enum types, 457
- fall through, 39–40, 454
- limitations, 129–130, 418, 477, 554
- supported types, 26, 450–451, 453
var
type in, 26, 451, 453
synchronized
method, 307–309, 527
System.console()
method, 328, 532
T
- tables, 343–344, 346, 350–351, 372–373, 536–537, 543
teams
variable, 449
teeing()
collector, 427, 557
- ternary expressions, 3, 418, 444, 448, 554
- ternary operator (?:), 401–402, 418, 550, 554
- text, escaping, 364, 436–437, 541, 559
think()
method, 150–151, 482
this()
constructors, 95, 111, 117, 145–146, 464, 468, 473, 474, 481
this
keyword, 54, 71, 73–74, 457, 462, 463
Thread.run()
method, 296, 524
- threads
- concurrency, 308–310, 312, 314–315, 404, 527–529, 551
- cyclic barriers, 302–303, 311–312, 376–377, 526, 528, 544
- multithreaded programs, 315, 529
- order of operations, 303–304, 526
- race conditions, 309, 421, 525, 527, 555
- stop running tasks, 314, 529
- worker, 296–297, 302–303, 305–306, 307, 524, 526, 527
- thread-safe code, 297–300, 304–305, 307–310, 312, 314–317, 395, 404, 524–530, 549, 551
throw
keyword, 150–151, 482
Throwable
case, 154, 156, 165, 173–174, 483, 486, 488
throws
keyword, 150, 482
- time
- daylight savings time, 2–4, 6–7, 10–11, 13, 22, 385, 425, 444–445, 447–448, 450, 547, 556
- formatting, 355, 360–361, 372, 396, 538–540, 543, 549
- time zones, 2, 16, 396, 425, 444, 450, 549, 556
TimeException
, 170, 487
ToDoubleBiFunction
interface, 217, 500–501
ToIntBiFunction
interface, 253, 513
ToIntFunction
interface, 215, 500
ToLongBiFunction
interface, 371–372, 543
- top-down migration, 274, 289, 411, 518, 523, 552
toString()
method, 105, 426–427, 457, 471, 556
transform()
declaration, 137–138, 479
transformation()
method, 407, 552
transitive
directive, 290, 523
travel()
method, 42, 454
trim()
method, 16, 447
- triple quotes ("""), 2, 4, 8, 13, 19, 22, 430, 444–446, 447, 449–450, 557
- try/catch/finally, 151–154, 156–157, 161, 163–168, 170, 172–175, 178–179, 241, 321, 413–414, 423, 428, 482–483, 485–489, 509, 530, 553, 556–557
tryLock()
method, 298–299, 379–380, 525, 545
- try-with-resources, 150, 152–154, 156, 162, 166, 177, 321, 326, 333–334, 367, 377, 388–389, 438, 482–483, 485–486, 488, 530–532, 534, 542, 545, 547, 559
turnOn()
method, 461
- two-dimensional arrays, 183, 490
- type casting, 141–142, 480
- type parameters, 191, 492
- types. See specific types
U
UnaryOperator
, 212, 498
- unchecked exceptions, 86, 155, 162–163, 171, 172, 190, 466, 483, 485, 487, 492
- underscore (_), 11, 102, 133, 163–164, 369, 384, 414, 437, 444, 447, 470, 478, 485, 542, 547, 554, 559
UnsupportedOperationException
, 169, 486
UnsupportedTemporalTypeException
, 5–6, 445
uses
directive, 277, 519
V
valueOf()
method, 12, 447
var
type
- inserting without a value, 74, 463
- limitations, 140, 414, 480, 554
- in
switch
statements, 26, 451, 453
- as variable name, 82–83, 465
- variables with, 468
- varargs parameter, 84, 187, 466, 491
- variable type inference, 422–423, 467, 556
- variables
- accessing, 437, 456, 559
- bind, 341–342, 536
- declaring multiple, 61, 459
- effectively final, 53, 457
- encapsulation, 458
- initializing, 384, 403–404, 547, 551
- instance, 60, 455, 459
- within interfaces, 123, 475
- lambda expressions, 220–221, 250, 467, 502, 512
- local, 145, 481
- naming, 2, 77, 155, 384, 414, 444, 464, 483, 547, 554
- nested classes, 411–412, 552
- replacing in a subclass, 425–426, 556
- scope, 77, 95–96, 111, 130–131, 418, 428, 434, 464, 469, 473, 477, 554, 557, 558
- static, 60, 459
- synchronized access, 303–304, 526
- virtual method invocation, 58–59, 458
void
type, 127, 143, 227, 477, 480, 504
volatile
attribute, 316–317, 530
W
walk()
method, 330–331, 533
while
loops, 29, 36, 40, 373–374, 398, 451, 453–454, 543, 550
- whitespace, 4, 22, 378, 430, 445, 447–448, 450, 545, 557
- wildcards, 182, 190, 199, 201, 203, 210, 401, 489, 492, 495, 496, 498, 550
woof()
method, 457
- wrapper classes, 1, 12, 17, 26, 447, 449, 450–451
Writer
class, 321–322, 530–531
..................Content has been hidden....................
You can't read the all page of ebook, please click
here login for view all page.