ENGLISH

Java Notes for Professionals

Book information

Year
2018
Language
english
Format
PDF
Filesize
7 MB (7386481 bytes)
Pages
982\982
Time added
2019-01-09 23:47:11

Description

Content list......Page 2 About......Page 25 Section 1.1: Creating Your First Java Program......Page 26 Section 2.3: Non-numeric primitive casting......Page 32 Section 2.5: Testing if an object can be cast using instanceof......Page 33 Section 3.2: Why Use Getters and Setters?......Page 34 Section 3.3: Adding Getters and Setters......Page 35 Section 4.2: Instantiating a reference type......Page 37 Section 5.1: The 'javac' command - getting started......Page 38 Section 5.2: Compiling for a dierent version of Java......Page 40 Section 6.2: Class Documentation......Page 42 Section 6.3: Method Documentation......Page 43 Section 6.5: Links......Page 44 Section 6.6: Code snippets inside documentation......Page 45 Section 6.8: Inline Code Documentation......Page 46 Section 7.2: Processing arguments by hand......Page 48 Section 8.2: Troubleshooting the 'java' command......Page 51 Section 8.3: Running a Java application with library dependencies......Page 53 Section 8.4: Java Options......Page 54 Section 8.5: Spaces and other special characters in arguments......Page 55 Section 8.7: Running a Java applications via a "main" class......Page 57 Section 9.2: Hexadecimal, Octal and Binary literals......Page 59 Section 9.4: String literals......Page 60 Section 9.6: Escape sequences in literals......Page 61 Section 9.8: Decimal Integer literals......Page 62 Section 9.9: Floating-point literals......Page 63 Section 10.2: Primitive Types Cheatsheet......Page 66 Section 10.3: The float primitive......Page 67 Section 10.4: The int primitive......Page 68 Section 10.6: Memory consumption of primitives vs. boxed primitives......Page 69 Section 10.7: The double primitive......Page 70 Section 10.8: The long primitive......Page 71 Section 10.10: The byte primitive......Page 72 Section 10.11: Negative value representation......Page 73 Section 10.12: The short primitive......Page 74 Section 11.1: Comparing Strings......Page 75 Section 11.2: Changing the case of characters within a String......Page 77 Section 11.3: Finding a String Within Another String......Page 79 Section 11.4: String pool and heap storage......Page 80 Section 11.5: Splitting Strings......Page 81 Section 11.6: Joining Strings with a delimiter......Page 83 Section 11.7: String concatenation and StringBuilders......Page 84 Section 11.8: Substrings......Page 85 Section 11.10: Reversing Strings......Page 86 Section 11.11: Adding toString() method for custom objects......Page 87 Section 11.13: Case insensitive switch......Page 88 Section 11.14: Replacing parts of Strings......Page 89 Section 11.17: Counting occurrences of a substring or character in a string......Page 90 Section 12.1: String Buer class......Page 92 Section 13.1: Comparing StringBuer, StringBuilder, Formatter and StringJoiner......Page 93 Section 13.2: Repeat a String n times......Page 94 Section 14.2: StringTokenizer Split by comma ','......Page 95 Section 15.2: Break a string up into substrings all of variable length......Page 96 Section 16.2: A basic date output......Page 97 Section 16.3: Java 8 LocalDate and LocalDateTime objects......Page 98 Section 16.5: Converting Date to a certain String format......Page 99 Section 16.7: Convert formatted string representation of date to Date object......Page 100 Section 16.9: Comparing Date objects......Page 101 Section 16.11: Time Zones and java.util.Date......Page 104 Section 17.4: Instant......Page 106 Section 17.5: Usage of various classes of Date Time API......Page 107 Section 17.7: Simple Date Manipulations......Page 109 Section 18.1: Amount of time between two LocalTime......Page 111 Section 18.4: Time Zones and their time dierence......Page 112 Section 19.2: Using BigDecimal instead of float......Page 114 Section 19.4: Mathematical operations with BigDecimal......Page 115 Section 19.6: BigDecimal objects are immutable......Page 118 Section 20.1: Initialization......Page 120 Section 20.2: BigInteger Mathematical Operations Examples......Page 121 Section 20.3: Comparing BigIntegers......Page 123 Section 20.4: Binary Logic Operations on BigInteger......Page 124 Section 20.5: Generating random BigIntegers......Page 125 Section 21.1: NumberFormat......Page 127 Section 22.2: java.util.BitSet class......Page 128 Section 22.3: Checking if a number is a power of 2......Page 129 Section 22.5: Expressing the power of 2......Page 131 Section 22.6: Packing / unpacking values as bit fragments......Page 132 Section 23.1: Creating and Initializing Arrays......Page 133 Section 23.2: Creating a List from an Array......Page 139 Section 23.4: Multidimensional and Jagged Arrays......Page 141 Section 23.5: ArrayIndexOutOfBoundsException......Page 143 Section 23.6: Array Covariance......Page 144 Section 23.8: Iterating over arrays......Page 145 Section 23.9: Arrays to a String......Page 147 Section 23.10: Sorting arrays......Page 148 Section 23.12: Finding an element in an array......Page 150 Section 23.13: How do you change the size of an array?......Page 151 Section 23.14: Converting arrays between primitives and boxed types......Page 152 Section 23.15: Remove an element from an array......Page 153 Section 23.17: Copying arrays......Page 154 Section 23.18: Casting Arrays......Page 155 Section 24.1: Removing items from a List within a loop......Page 157 Section 24.2: Constructing collections from existing data......Page 159 Section 24.4: Iterating over Collections......Page 161 Section 24.6: Sub Collections......Page 163 Section 24.7: Unmodifiable Collection......Page 164 Section 24.9: Removing matching items from Lists using Iterator......Page 165 Section 24.11: Creating your own Iterable structure for use with Iterator or for-each loop......Page 166 Section 24.12: Collections and Primitive Values......Page 168 Section 25.1: Sorting a generic list......Page 170 Section 25.3: Classes implementing List - Pros and Cons......Page 171 Section 25.5: In-place replacement of a List element......Page 174 Section 25.7: Moving objects around in the list......Page 175 Section 25.9: Creating a List......Page 176 Section 25.10: Positional Access Operations......Page 177 Section 25.12: Removing elements from list B that are present in the list A......Page 179 Section 26.2: Basics of Set......Page 181 Section 26.3: Types and Usage of Sets......Page 182 Section 26.5: Eliminating duplicates using Set......Page 183 Section 26.6: Declaring a HashSet with values......Page 184 Section 27.1: List vs Set......Page 185 Section 28.1: Iterating Map Entries Eciently......Page 186 Section 28.2: Usage of HashMap......Page 188 Section 28.3: Using Default Methods of Map from Java 8......Page 189 Section 28.4: Iterating through the contents of a Map......Page 191 Section 28.5: Merging, combine and composing Maps......Page 192 Section 28.6: Add multiple items......Page 193 Section 28.7: Creating and Initializing Maps......Page 195 Section 28.9: Add an element......Page 196 Section 28.11: Use custom object as key......Page 197 Section 29.1: Java LinkedHashMap class......Page 199 Section 30.1: Concepts of WeakHashmap......Page 200 Section 31.1: Introduction to sorted Map......Page 201 Section 32.2: TreeSet of a simple Java Type......Page 202 Section 32.3: TreeMap/TreeSet of a custom Java type......Page 203 Section 32.4: TreeMap and TreeSet Thread Safety......Page 204 Section 33.2: Deque......Page 206 Section 33.3: Stacks......Page 207 Section 33.4: BlockingQueue......Page 208 Section 33.5: LinkedList as a FIFO Queue......Page 209 Section 33.6: Queue Interface......Page 210 Section 34.4: Iterating through Deque......Page 211 Section 35.1: Declaring and using a basic enum......Page 213 Section 35.2: Enums with constructors......Page 216 Section 35.3: Enums with Abstract Methods......Page 217 Section 35.4: Implements Interface......Page 218 Section 35.5: Implement Singleton pattern with a single-element enum......Page 219 Section 35.7: Zero instance enum......Page 220 Section 35.9: Documenting enums......Page 221 Section 35.10: Enum constant specific body......Page 222 Section 35.11: Getting the values of an enum......Page 223 Section 35.12: Enum Polymorphism Pattern......Page 224 Section 35.14: Get enum constant by name......Page 225 Section 35.15: Enum with properties (fields)......Page 226 Section 35.17: Enums with static fields......Page 227 Section 36.1: Enum Map Book Example......Page 229 Section 37.1: Enum Set Example......Page 230 Section 38.1: Enum with name at beginning......Page 231 Section 39.1: Hashtable......Page 232 Section 40.2: The Conditional Operator (? :)......Page 233 Section 40.3: The Bitwise and Logical Operators (~, &, |, ^)......Page 235 Section 40.4: The String Concatenation Operator (+)......Page 236 Section 40.5: The Arithmetic Operators (+, -, *, /, %)......Page 238 Section 40.6: The Shift Operators ( and >>>)......Page 240 Section 40.7: The Instanceof Operator......Page 241 Section 40.8: The Assignment Operators (=, +=, -=, *=, /=, %=, = , >>>=, &=, |= and ^=)......Page 242 Section 40.9: The conditional-and and conditional-or Operators ( && and || )......Page 244 Section 40.10: The Relational Operators (=)......Page 245 Section 40.11: The Equality Operators (==, !=)......Page 246 Section 40.12: The Lambda operator ( -> )......Page 248 Section 41.1: Default Constructor......Page 249 Section 41.2: Call parent constructor......Page 250 Section 41.3: Constructor with Arguments......Page 251 Section 42.1: hashCode() method......Page 253 Section 42.2: toString() method......Page 255 Section 42.3: equals() method......Page 256 Section 42.4: wait() and notify() methods......Page 258 Section 42.5: getClass() method......Page 260 Section 42.6: clone() method......Page 261 Section 42.7: Object constructor......Page 262 Section 42.8: finalize() method......Page 263 Section 43.2: Defining annotation types......Page 265 Section 43.4: Built-in annotations......Page 267 Section 43.5: Compile time processing using annotation processor......Page 270 Section 43.6: Repeating Annotations......Page 274 Section 43.7: Inherited Annotations......Page 275 Section 43.8: Getting Annotation values at run-time......Page 276 Section 43.9: Annotations for 'this' and receiver parameters......Page 277 Section 43.10: Add multiple annotation values......Page 278 Section 44.3: Rules to define immutable classes......Page 279 Section 44.4: Example with mutable refs......Page 280 Section 45.2: The recipe for an immutable class......Page 281 Section 45.3: Typical design flaws which prevent a class from being immutable......Page 282 Section 46.2: Public Visibility......Page 286 Section 46.4: Protected Visibility......Page 287 Section 46.6: Interface members......Page 288 Section 47.1: Creating a Generic Class......Page 289 Section 47.2: Deciding between `T`, `? super T`, and `? extends T`......Page 291 Section 47.4: Declaring a Generic Method......Page 293 Section 47.6: Obtain class that satisfies generic parameter at runtime......Page 294 Section 47.7: Benefits of Generic class and interface......Page 295 Section 47.9: Creating a Bounded Generic Class......Page 296 Section 47.10: Referring to the declared generic type within its own declaration......Page 298 Section 47.11: Binding generic parameter to more than 1 type......Page 299 Section 47.13: Use of instanceof with Generics......Page 300 Section 47.14: Dierent ways for implementing a Generic Interface (or extending a Generic Class)......Page 302 Section 48.1: Overloading Methods......Page 304 Section 48.2: Explaining what is method overloading and overriding......Page 305 Section 48.3: Constructors......Page 307 Section 48.4: Initializing static final fields using a static initializer......Page 308 Section 48.5: Basic Object Construction and Use......Page 309 Section 48.7: Object Member vs Static Member......Page 311 Section 49.1: Local Inner Class......Page 313 Section 50.2: Static vs Non Static Nested Classes......Page 314 Section 50.3: Access Modifiers for Inner Classes......Page 316 Section 50.4: Anonymous Inner Classes......Page 317 Section 50.5: Create instance of non-static inner class from outside......Page 318 Section 50.7: Accessing the outer class from a non-static inner class......Page 319 Section 51.2: Objects.nonNull() method reference use in stream api......Page 321 Section 52.2: Accessing overridden default methods from implementing class......Page 322 Section 52.4: Accessing other interface methods within default method......Page 323 Section 52.5: Default method multiple inheritance collision......Page 324 Section 52.6: Class, Abstract class and Interface method precedence......Page 325 Section 53.2: Using Package Protected Scope......Page 327 Section 54.1: Inheritance......Page 329 Section 54.2: Abstract Classes......Page 330 Section 54.3: Using 'final' to restrict inheritance and overriding......Page 332 Section 54.4: The Liskov Substitution Principle......Page 333 Section 54.5: Abstract class and Interface usage: "Is-a" relation vs "Has-a" capability......Page 334 Section 54.6: Static Inheritance......Page 337 Section 54.7: Programming to an interface......Page 338 Section 54.8: Overriding in Inheritance......Page 340 Section 54.10: Narrowing and Widening of object references......Page 341 Section 54.11: Inheritance and Static Methods......Page 342 Section 55.1: Dierent Reference Types......Page 344 Section 56.1: Reading user input from the console......Page 346 Section 56.2: Aligning strings in console......Page 347 Section 56.3: Implementing Basic Command-Line Behavior......Page 348 Section 57.1: Using Streams......Page 350 Section 57.2: Consuming Streams......Page 352 Section 57.4: Infinite Streams......Page 354 Section 57.5: Collect Elements of a Stream into a Collection......Page 355 Section 57.7: Flatten Streams with flatMap()......Page 358 Section 57.8: Parallel Stream......Page 359 Section 57.9: Creating a Stream......Page 360 Section 57.12: Using IntStream to iterate over indexes......Page 361 Section 57.14: Reduction with Streams......Page 362 Section 57.17: Finding the First Element that Matches a Predicate......Page 365 Section 57.18: Using Streams and Method References to Write Self-Documenting Processes......Page 366 Section 57.21: Create a Map based on a Stream......Page 367 Section 57.22: Joining a stream to a single String......Page 368 Section 57.23: Sort Using Stream......Page 369 Section 57.25: Stream operations categories......Page 370 Section 57.27: Generating random Strings using Streams......Page 371 Section 58.2: Reading InputStream into a String......Page 373 Section 58.3: Wrapping Input/Output Streams......Page 374 Section 58.6: Copying Input Stream to Output Stream......Page 375 Section 59.1: BueredReader......Page 377 Section 59.2: StringWriter Example......Page 378 Section 60.2: Adding event listeners......Page 379 Section 60.3: Getting sub-nodes of Preferences......Page 380 Section 60.5: Exporting preferences......Page 381 Section 60.6: Importing preferences......Page 382 Section 60.7: Removing event listeners......Page 383 Section 60.9: Setting preferences values......Page 384 Section 61.3: Map Factory Method Examples......Page 385 Section 62.1: Multimap in Guava, Apache and Eclipse Collections......Page 386 Section 62.2: Apache HashBag, Guava HashMultiset and Eclipse HashBag......Page 388 Section 62.3: Compare operation with collections - Create collections......Page 390 Section 63.2: Insertion into ConcurrentHashMap......Page 395 Section 63.3: Concurrent Collections......Page 396 Section 64.1: Java Collections Flowchart......Page 398 Section 65.1: Super keyword use with examples......Page 399 Section 66.1: Basic Serialization in Java......Page 402 Section 66.2: Custom Serialization......Page 403 Section 66.3: Versioning and serialVersionUID......Page 406 Section 66.4: Serialization with Gson......Page 407 Section 66.5: Custom JSON Deserialization with Jackson......Page 408 Section 67.1: Map......Page 411 Section 67.4: Lazily provide a default value using a Supplier......Page 412 Section 67.6: Using Optional containers for primitive number types......Page 413 Section 67.8: FlatMap......Page 414 Section 68.1: Object References as method parameters......Page 415 Section 69.1: Catching an exception with try-catch......Page 418 Section 69.2: The try-with-resources statement......Page 419 Section 69.3: Custom Exceptions......Page 422 Section 69.4: Handling InterruptedException......Page 424 Section 69.5: Return statements in try catch block......Page 425 Section 69.6: Introduction......Page 426 Section 69.7: The Java Exception Hierarchy - Unchecked and Checked Exceptions......Page 427 Section 69.8: Creating and reading stacktraces......Page 430 Section 69.9: Throwing an exception......Page 433 Section 69.10: Advanced features of Exceptions......Page 435 Section 69.11: The try-finally and try-catch-finally statements......Page 436 Section 69.12: The 'throws' clause in a method declaration......Page 438 Section 70.4: Finding AM/PM......Page 440 Section 71.2: Using static to declare constants......Page 442 Section 72.2: Saving Properties as XML......Page 444 Section 72.3: Property files caveat: trailing whitespace......Page 445 Section 73.1: Introduction to Java lambdas......Page 448 Section 73.2: Using Lambda Expressions to Sort a Collection......Page 451 Section 73.3: Method References......Page 452 Section 73.5: Lambda - Listener Example......Page 454 Section 73.6: Java Closures with lambda expressions......Page 455 Section 73.7: Lambdas and memory utilization......Page 456 Section 73.9: Traditional style to Lambda style......Page 457 Section 73.10: `return` only returns from the lambda, not the outer method......Page 458 Section 73.12: Using lambda expressions & predicates to get a certain value(s) from a list......Page 460 Section 74.1: Switch statement......Page 462 Section 74.2: do...while Loop......Page 463 Section 74.3: For Each......Page 464 Section 74.6: For Loops......Page 465 Section 74.7: Ternary Operator......Page 466 Section 74.9: Break......Page 467 Section 74.12: Nested break / continue......Page 468 Section 75.1: Write a line of text to File......Page 470 Section 76.3: Retrieving information about a path......Page 471 Section 76.4: Retrieving information using the filesystem......Page 472 Section 76.6: Writing files......Page 473 Section 77.1: Migrating from java.io.File to Java 7 NIO (java.nio.file.Path)......Page 474 Section 77.3: File Read/Write Using FileInputStream/FileOutputStream......Page 476 Section 77.4: Reading all bytes to a byte[]......Page 477 Section 77.6: Writing a byte[] to a file......Page 478 Section 77.7: Stream vs Writer/Reader API......Page 479 Section 77.8: Reading a file with a Scanner......Page 480 Section 77.11: Reading a file using Channel and Buer......Page 481 Section 77.12: Adding Directories......Page 482 Section 77.13: Blocking or redirecting standard output / error......Page 483 Section 77.16: Reading a file using BueredInputStream......Page 484 Section 77.18: Writing a file using Channel and Buer......Page 485 Section 77.20: Iterating over a directory and filter by file extension......Page 486 Section 77.21: Accessing the contents of a ZIP file......Page 487 Section 78.1: General Pattern that does most commonly asked about tasks......Page 488 Section 78.4: Reading file input using Scanner......Page 490 Section 78.6: Carefully Closing a Scanner......Page 491 Section 78.7: Read an int from the command line......Page 492 Section 79.1: Implementing multiple interfaces......Page 493 Section 79.3: Extending an interface......Page 494 Section 79.4: Usefulness of interfaces......Page 495 Section 79.5: Default methods......Page 497 Section 79.7: Using Interfaces with Generics......Page 499 Section 79.9: Implementing interfaces in an abstract class......Page 502 Section 80.1: Using capture groups......Page 504 Section 80.3: Escape Characters......Page 505 Section 80.6: Matching a backslash......Page 506 Section 81.1: Sorting a List using Comparable or a Comparator......Page 508 Section 81.2: The compareTo and compare Methods......Page 511 Section 81.3: Natural (comparable) vs explicit (comparator) sorting......Page 512 Section 81.5: Sorting Map entries......Page 513 Section 82.1: Comparing floating point values......Page 515 Section 82.2: OverFlow and UnderFlow......Page 517 Section 82.4: Strict Adherence to the IEEE Specification......Page 518 Section 83.1: Add custom currency......Page 520 Section 84.1: Cloning performing a deep copy......Page 521 Section 84.4: Cloning by implementing Clonable interface......Page 522 Section 84.5: Cloning performing a shallow copy......Page 523 Section 85.2: Deep recursion is problematic in Java......Page 525 Section 85.4: Computing the Nth Fibonacci Number......Page 527 Section 85.5: StackOverflowError & recursion to loop......Page 528 Section 85.7: Traversing a Tree data structure with recursion......Page 530 Section 85.9: Computing the sum of integers from 1 to N......Page 531 Section 86.1: Converting String to other datatypes......Page 532 Section 86.3: Base64 Encoding / Decoding......Page 533 Section 86.4: Converting other datatypes to String......Page 534 Section 86.5: Getting a `String` from an `InputStream`......Page 535 Section 87.2: Pseudo Random Numbers in Specific Range......Page 536 Section 87.4: Generating Random Numbers with a Specified Seed......Page 537 Section 87.5: Select random numbers without duplicates......Page 538 Section 87.6: Generating Random number using apache-common lang3......Page 539 Section 88.2: Singleton without use of Enum (eager initialization)......Page 540 Section 88.4: Thread safe Singleton with double checked locking......Page 541 Section 88.5: Extending singleton (singleton inheritance)......Page 542 Section 89.1: Using int and Integer interchangeably......Page 545 Section 89.4: Dierent Cases When Integer and int can be used interchangeably......Page 546 Section 89.5: Memory and Computational Overhead of Autoboxing......Page 548 Section 90.1: Example 1: Draw and Fill a Rectangle Using Java......Page 549 Section 90.2: Example 2: Drawing and Filling Oval......Page 551 Section 91.2: Writing an XML file (marshalling an object)......Page 552 Section 91.3: Manual field/property XML mapping configuration......Page 553 Section 91.5: Using XmlAdapter to generate desired xml format......Page 554 Section 91.7: Automatic field/property XML mapping configuration (@XmlAccessorType)......Page 556 Section 91.8: Specifying a XmlAdapter instance to (re)use existing data......Page 558 Section 92.1: getClass() method of Object class......Page 561 Section 93.1: Basic Client and Server Communication using a Socket......Page 562 Section 93.2: Basic Client/Server Communication using UDP (Datagram)......Page 564 Section 93.3: Loading TrustStore and KeyStore from InputStream......Page 565 Section 93.4: Socket example - reading a web page using a simple socket......Page 566 Section 93.6: Downloading a file using Channel......Page 567 Section 93.7: Multicasting......Page 568 Section 94.1: Using Selector to wait for events (example with OP_CONNECT)......Page 571 Section 95.1: Get response body from a URL as a String......Page 573 Section 95.3: Delete resource......Page 574 Section 95.4: Check if resource exists......Page 575 Section 96.1: Basic Authentication......Page 577 Section 97.2: Intercept script output......Page 578 Section 97.5: Set global variables......Page 579 Section 97.7: Usage of Java objects in JavaScript in Nashorn......Page 580 Section 97.8: Implementing an interface from script......Page 581 Section 98.1: Calling C++ methods from Java......Page 582 Section 98.2: Calling Java methods from C++ (callback)......Page 583 Section 98.3: Loading native libraries......Page 585 Section 99.1: List of standard Java Runtime Library functional interfaces by signature......Page 587 Section 100.1: Fluent programming style......Page 589 Section 100.2: Truth - Fluent Testing Framework......Page 590 Section 101.1: Callback: invoking methods on a "client"......Page 591 Section 101.2: Simple RMI example with Client and Server implementation......Page 595 Section 101.3: Client-Server: invoking methods in one JVM from another......Page 597 Section 102.2: Creating your own Iterable......Page 600 Section 102.3: Using Iterable in for loop......Page 601 Section 102.4: Using the raw iterator......Page 602 Section 103.1: Dynamic Proxies......Page 603 Section 103.2: Introduction......Page 604 Section 103.3: Evil Java hacks with Reflection......Page 605 Section 103.4: Misuse of Reflection API to change private and final variables......Page 607 Section 103.5: Getting and Setting fields......Page 608 Section 103.6: Call constructor......Page 609 Section 103.8: Invoking a method......Page 610 Section 103.10: Getting the Constants of an Enumeration......Page 611 Section 103.11: Call overloaded constructors using reflection......Page 612 Section 104.2: Basic Usage - Creating a ByteBuer......Page 614 Section 104.3: Basic Usage - Write Data to the Buer......Page 615 Section 105.1: Minimal Applet......Page 616 Section 105.3: Open links from within the applet......Page 617 Section 105.4: Loading images, audio and other resources......Page 618 Section 106.1: Operator Precedence......Page 620 Section 106.2: Expression Basics......Page 621 Section 106.3: Expression evaluation order......Page 622 Section 106.4: Constant Expressions......Page 623 Section 107.1: Using Jackson Object Mapper......Page 625 Section 107.3: JSONObject.NULL......Page 626 Section 107.6: JSON Iteration......Page 627 Section 107.9: JsonArray to Java List (Gson Library)......Page 628 Section 107.11: Decoding JSON data......Page 629 Section 108.1: Parsing a document using the StAX API......Page 631 Section 108.2: Parsing and navigating a document using the DOM API......Page 632 Section 109.2: Parsing single XPath Expression multiple times in an XML......Page 634 Section 109.3: Evaluating a NodeList in an XML document......Page 635 Section 110.1: Reading a XML file......Page 636 Section 110.2: Writing to a XML File......Page 638 Section 111.1: Method Overriding......Page 641 Section 111.2: Method Overloading......Page 642 Section 111.3: Polymorphism and dierent types of overriding......Page 643 Section 111.4: Virtual functions......Page 646 Section 111.5: Adding behaviour by adding classes without touching existing code......Page 647 Section 112.1: Encapsulation to maintain invariants......Page 649 Section 112.2: Encapsulation to reduce coupling......Page 650 Section 113.2: Adding an agent at runtime......Page 651 Section 113.3: Setting up a basic agent......Page 652 Section 114.2: Specifying a varargs parameter......Page 653 Section 115.1: Logging complex messages (eciently)......Page 654 Section 115.2: Using the default logger......Page 655 Section 115.3: Logging levels......Page 656 Section 116.2: How to get Log4j......Page 658 Section 116.3: Setting up property file......Page 659 Section 116.5: How to use Log4j in Java code......Page 660 Section 116.6: Migrating from log4j 1.x to 2.x......Page 661 Section 116.7: Filter Logoutput by level (log4j 1.x)......Page 662 Section 117.1: Naming Conventions......Page 663 Section 117.2: Class Structure......Page 664 Section 117.4: Import statements......Page 665 Section 117.5: Braces......Page 666 Section 117.7: Modifiers......Page 667 Section 117.11: Lambda Expressions......Page 668 Section 117.13: Wrapping statements......Page 669 Section 117.15: Wrapping Expressions......Page 670 Section 117.17: Special Characters......Page 671 Section 117.18: Variable Declarations......Page 672 Section 118.2: Writing text to a file in UTF-8......Page 673 Section 118.3: Getting byte representation of a string in UTF-8......Page 674 Section 119.2: Implement hashCode() method......Page 675 Section 119.3: Implement toString() method......Page 676 Section 120.1: Locale......Page 678 Section 120.3: String Comparison......Page 679 Section 121.1: Fork/Join Tasks in Java......Page 680 Section 122.1: final......Page 682 Section 122.2: static......Page 683 Section 122.3: abstract......Page 684 Section 122.5: volatile......Page 685 Section 122.6: synchronized......Page 686 Section 122.7: transient......Page 687 Section 123.1: Pitfall: Runtime.exec, Process and ProcessBuilder don't understand shell syntax......Page 688 Section 123.2: Simple example (Java version < 1.5)......Page 690 Section 124.1: Introduction to JNA......Page 691 Section 125.1: Defining a basic module......Page 692 Section 126.1: Callable and Future......Page 693 Section 126.2: CountDownLatch......Page 694 Section 126.3: Basic Multithreading......Page 696 Section 126.4: Locks as Synchronisation aids......Page 697 Section 126.5: Semaphore......Page 698 Section 126.6: Synchronization......Page 699 Section 126.7: Runnable Object......Page 700 Section 126.8: Creating basic deadlocked system......Page 701 Section 126.9: Creating a java.lang.Thread instance......Page 703 Section 126.10: Atomic operations......Page 704 Section 126.11: Exclusive write / Concurrent read access......Page 705 Section 126.12: Producer-Consumer......Page 706 Section 126.13: Visualizing read/write barriers while using synchronized / volatile......Page 708 Section 126.14: Get status of all threads started by your program excluding system threads......Page 709 Section 126.15: Using ThreadLocal......Page 710 Section 126.16: Multiple producer/consumer example with shared global queue......Page 711 Section 126.17: Add two `int` arrays using a Threadpool......Page 712 Section 126.18: Pausing Execution......Page 713 Section 126.19: Thread Interruption / Stopping Threads......Page 714 Section 127.1: ThreadPoolExecutor......Page 717 Section 127.2: Retrieving value from computation - Callable......Page 718 Section 127.3: submit() vs execute() exception handling dierences......Page 719 Section 127.5: Fire and Forget - Runnable Tasks......Page 721 Section 127.6: Use cases for dierent types of concurrency constructs......Page 722 Section 127.7: Wait for completion of all tasks in ExecutorService......Page 723 Section 127.8: Use cases for dierent types of ExecutorService......Page 725 Section 127.9: Scheduling tasks to run at a fixed time, after a delay or repeatedly......Page 727 Section 127.10: Using Thread Pools......Page 728 Section 128.1: Basic ThreadLocal usage......Page 729 Section 128.2: ThreadLocal Java 8 functional initialization......Page 730 Section 128.3: Multiple threads with one shared object......Page 731 Section 129.1: Performing Asynchronous Tasks Where No Return Value Is Needed Using a Runnable Class Instance......Page 733 Section 129.2: Performing Asynchronous Tasks Where a Return Value Is Needed Using a Callable Class Instance......Page 734 Section 129.3: Defining Asynchronous Tasks Inline using Lambdas......Page 737 Section 130.2: Pitfall: using == to compare strings......Page 739 Section 130.3: Pitfall: forgetting to free resources......Page 741 Section 130.4: Pitfall: testing a file before attempting to open it......Page 742 Section 130.5: Pitfall: thinking of variables as objects......Page 743 Section 130.6: Pitfall: memory leaks......Page 746 Section 130.7: Pitfall: Not understanding that String is an immutable class......Page 747 Section 130.8: Pitfall: combining assignment and side-eects......Page 748 Section 131.1: Pitfall - Catching Throwable, Exception, Error or RuntimeException......Page 749 Section 131.2: Pitfall - Ignoring or squashing exceptions......Page 750 Section 131.3: Pitfall - Throwing Throwable, Exception, Error or RuntimeException......Page 751 Section 131.4: Pitfall - Using exceptions for normal flowcontrol......Page 752 Section 131.6: Pitfall - Catching InterruptedException......Page 753 Section 131.7: Pitfall - Excessive or inappropriate stacktraces......Page 755 Section 132.2: Pitfall - Declaring classes with the same names as standard classes......Page 756 Section 132.3: Pitfall - Leaving out braces: the "dangling if" and "dangling else" problems......Page 757 Section 132.5: Pitfall - Using '==' to test a boolean......Page 759 Section 132.7: Pitfall: Using 'assert' for argument or user input validation......Page 760 Section 132.8: Pitfall - Wildcard imports can make your code fragile......Page 761 Section 132.9: Pitfall - Misplaced semicolons and missing braces......Page 762 Section 132.10: Pitfall - Overloading instead of overriding......Page 763 Section 132.11: Pitfall of Auto-Unboxing Null Objects into Primitives......Page 764 Section 133.1: Pitfall - Extending 'java.lang.Thread'......Page 765 Section 133.2: Pitfall - Too many threads makes an application slower......Page 766 Section 133.4: Pitfall: Shared variables require proper synchronization......Page 767 Section 133.5: Pitfall - Thread creation is relatively expensive......Page 770 Section 134.1: Pitfall - "Making good" unexpected nulls......Page 773 Section 134.2: Pitfall - Using null to represent an empty array or collection......Page 774 Section 134.4: Pitfall - Returning null instead of throwing an exception......Page 775 Section 134.5: Pitfall - Unnecessary use of Primitive Wrappers can lead to NullPointerExceptions......Page 776 Section 134.6: Pitfall - Using "Yoda notation" to avoid NullPointerException......Page 777 Section 135.1: Pitfall - String concatenation in a loop does not scale......Page 778 Section 135.3: Pitfall - Interning strings so that you can use == is a bad idea......Page 779 Section 135.5: Pitfall - Eciency concerns with regular expressions......Page 781 Section 135.6: Pitfall - Small reads / writes on unbuered streams are inecient......Page 784 Section 135.7: Pitfall - Over-use of primitive wrapper types is inecient......Page 786 Section 135.8: Pitfall - The overheads of creating log messages......Page 787 Section 135.10: Pitfall - Calling System.gc() is inecient......Page 788 Section 135.11: Pitfall - Calling 'new String(String)' is inecient......Page 789 Section 136.1: Simple ServiceLoader Example......Page 790 Section 136.2: Logger Service......Page 791 Section 137.2: Loading an external .class file......Page 793 Section 137.3: Instantiating and using a classloader......Page 794 Section 138.1: Creating a simple image programmatically and displaying it......Page 796 Section 138.3: Setting individual pixel's color in BueredImage......Page 797 Section 138.4: Specifying image rendering quality......Page 798 Section 138.5: Creating an image with BueredImage class......Page 800 Section 138.6: Editing and re-using image with BueredImage......Page 801 Section 138.7: How to scale a BueredImage......Page 802 Section 139.2: Motivation for Atomic Types......Page 803 Section 140.1: An example using a hybrid cryptosystem consisting of OAEP and GCM......Page 807 Section 141.2: SignedObject (java.security.SignedObject)......Page 812 Section 142.2: Encrypt and Decrypt Data with Public / Private Keys......Page 814 Section 142.4: Generate Public / Private Key Pairs......Page 815 Section 142.5: Compute and Verify Digital Signatures......Page 816 Section 143.6: Hashing and Validation......Page 817 Section 144.1: Sandboxing classes loaded by a ClassLoader......Page 819 Section 144.3: Implementing policy deny rules......Page 820 Section 145.1: RMI through JNDI......Page 828 Section 146.3: Getting Instance of Unsafe......Page 832 Section 146.4: Uses of Unsafe......Page 833 Section 147.1: Motivation for the Memory Model......Page 834 Section 147.2: Happens-before relationships......Page 836 Section 147.3: How to avoid needing to understand the Memory Model......Page 837 Section 147.4: Happens-before reasoning applied to some examples......Page 838 Section 148.1: Making an executable JAR from the command line......Page 841 Section 148.2: Creating an UberJAR for an application and its dependencies......Page 842 Section 148.3: Creating JAR, WAR and EAR files......Page 843 Section 148.4: Introduction to Java Web Start......Page 844 Section 149.1: Using URLClassLoader......Page 847 Section 150.1: Basic Java Bean......Page 851 Section 151.3: The try-with-resources statement......Page 852 Section 151.6: Strings in switch Statements......Page 853 Section 152.1: New Java SE 8 programming language features......Page 855 Section 153.1: Dynamic Method Dispatch - Example Code......Page 856 Section 154.1: Generate POJO From JSON......Page 859 Section 155.1: Editting Snippets......Page 860 Section 155.3: Expressions......Page 861 Section 155.5: Variables......Page 862 Section 156.1: Print all stack frames of the current thread......Page 863 Section 156.3: Showing reflection and other hidden frames......Page 864 Section 157.1: Read from socket......Page 866 Section 158.1: A simple TCP echo back server......Page 867 Section 159.1: Connecting and Logging Into a FTP Server......Page 870 Section 160.1: Evaluating A JavaScript file in -scripting mode of nashorn......Page 875 Section 161.2: Classes Defined within Other Constructs......Page 878 Section 161.3: Pass-by-value & Pass-by-reference......Page 880 Section 161.6: Abstract Methods & Classes......Page 881 Section 162.1: Play a MIDI file......Page 883 Section 162.3: Basic audio output......Page 884 Section 162.4: Bare metal sound......Page 885 Section 163.2: Discovering the available print services......Page 887 Section 163.4: Listening print job request status change......Page 888 Section 163.6: Creating a print job from a print service......Page 890 Section 164.1: Simple Example of CompletableFuture......Page 892 Section 165.1: Adding shutdown hooks......Page 893 Section 166.1: What is Unit Testing?......Page 894 Section 167.1: Checking arithmetic with assert......Page 897 Section 168.2: Creating a multi-release Jar using the jar tool......Page 898 Section 168.3: URL of a loaded class inside a multi-release Jar......Page 899 Section 169.1: Overview......Page 901 Section 170.1: What is Bytecode?......Page 903 Section 170.2: How to edit jar files with ASM......Page 904 Section 170.3: How to load a ClassNode as a Class......Page 906 Section 170.5: Javassist Basic......Page 907 Section 171.1: Viewing bytecode with javap......Page 909 Section 172.1: Simple example with Platform MBean Server......Page 916 Section 173.1: These are the basics......Page 920 Section 174.1: Generating Java code from simple XSD file......Page 921 Section 175.4: -XXcallProfiling......Page 924 Section 175.7: -XXdumpSize......Page 925 Section 175.8: -XXexitOnOutOfMemory......Page 926 Section 176.1: Iterate over objects reachable from object (Heap 1.0)......Page 927 Section 176.3: Example of initialization inside of Agent_OnLoad method......Page 929 Section 177.1: Setting the Heap, PermGen and Stack sizes......Page 931 Section 177.2: Garbage collection......Page 932 Section 177.3: Memory leaks in Java......Page 934 Section 177.4: Finalization......Page 935 Section 177.5: Manually triggering GC......Page 936 Section 178.1: An evidence-based approach to Java performance tuning......Page 937 Section 178.3: General approach......Page 938 Section 179.1: Simple JMH example......Page 940 Section 180.1: Upload file to s3 bucket......Page 943 Section 181.1: Example of Instrumentation of all BW Applications in a Single Step for Appdynamics......Page 945 Section A.1: Setting %PATH% and %JAVA_HOME% after installing on Windows......Page 946 Section A.2: Installing a Java JDK on Linux......Page 947 Section A.3: Installing a Java JDK on macOS......Page 949 Section A.4: Installing a Java JDK or JRE on Windows......Page 950 Section A.5: Configuring and switching Java versions on Linux using alternatives......Page 951 Section A.7: Selecting an appropriate Java SE release......Page 952 Section A.9: Installing Oracle Java on Linux with latest tar file......Page 953 Section A.10: Post-installation checking and configuration on Linux......Page 954 Section B.1: Dierences between Java SE JRE or Java SE JDK distributions......Page 957 Section B.2: Java SE Versions......Page 958 Section B.3: Dierences between Java EE, Java SE, Java ME and JavaFX......Page 959 Section C.2: Adding all JARs in a directory to the classpath......Page 961 Section C.4: Classpath path syntax......Page 962 Section C.7: The bootstrap classpath......Page 963 Section C.8: What the classpath means: how searches work......Page 964 Section D.3: Finding and reading resources using a classloader......Page 965 Section D.4: Loading same-name resource from multiple JARs......Page 967 Credits......Page 968 You may also like......Page 982

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF