Contents
- Inheritance
- Inheritance
- Implementing multiple interfaces
- Abstract Classes
- Declaring and Implementing an Interface
- Using final to restrict inheritance and overriding
- The Liskov Substitution Principle
- Static Inheritance
- Abstract class and Interface usage Is-a relation vs Has-a capability
- Inheritance and Static Methods
- Variable shadowing
- Narrowing and Widening of object references
- Programming to an interface
- Overriding in Inheritance
- Getting started with Java
- Streams
- Streams
- Using Streams
- Consuming Streams
- Creating a Frequency Map
- Infinite Streams
- Collect Elements of a Stream into a Collection
- Using Streams to Implement Mathematical Functions
- Parallel Stream
- Flatten Streams with flatMap
- Creating a Stream
- Finding Statistics about Numerical Streams
- Using IntStream to iterate over indexes
- Converting an iterator to a stream
- Concatenate Streams
- Using Streams of Map.Entry to Preserve Initial Values after Mapping
- Using Streams and Method References to Write Self-Documenting Processes
- Finding the First Element that Matches a Predicate
- Reduction with Streams
- IntStream to String
- Get a Slice of a Stream
- Converting a Stream of Optional to a Stream of Values
- Create a Map based on a Stream
- Joining a stream to a single String
- Streams of Primitives
- Sort Using Stream
- Stream operations categories
- Generating random Strings using Streams
- Collect Results of a Stream into an Array
- Closing Streams
- Exceptions
- Exceptions and exception handling
- Catching an exception with try-catch
- The try-with-resources statement
- Custom Exceptions
- Handling InterruptedException
- Return statements in try catch block
- Introduction
- The Java Exception Hierarchy - Unchecked and Checked Exceptions
- Creating and reading stacktraces
- Throwing an exception
- Advanced features of Exceptions
- The try-finally and try-catch-finally statements
- The throws clause in a method declaration
- Collections
- Collections
- Removing items from a List within a loop
- Constructing collections from existing data
- Declaring an ArrayList and adding objects
- Iterating over Collections
- Usage of HashMap
- Immutable Empty Collections
- Unmodifiable Collection
- Sub Collections
- Pitfall concurrent modification exceptions
- Removing matching items from Lists using Iterator.
- Join lists
- Creating your own Iterable structure for use with Iterator or for-each loop.
- Collections and Primitive Values
- Sorting a generic list
- The usage of the PriorityQueue
- BlockingQueue
- LinkedList as a FIFO Queue
- Stacks
- Types and Usage of Sets
- Declaring a HashSet with values
- Concurrent Collections
- Queue Interface
- Thread-safe Collections
- Insertion into ConcurrentHashMap
- Lambda Expressions
- Lambda Expressions
- Introduction to Java lambdas
- Using Lambda Expressions to Sort a Collection
- Method References
- Implementing multiple interfaces
- Lambda - Listener Example
- Java Closures with lambda expressions.
- Lambdas and memory utilization
- Using lambda expression with your own functional interface
- Traditional style to Lambda style
- return only returns from the lambda not the outer method
- Lambdas and Execute-around Pattern
- Using lambda expressions predicates to get a certain values from a list
- Generics
- Generics
- Creating a Generic Class
- Deciding between T super T and extends T
- The Diamond
- Declaring a Generic Method
- Requiring multiple upper bounds extends A B
- Instantiating a generic type
- Benefits of Generic class and interface
- Obtain class that satisfies generic parameter at runtime
- Creating a Bounded Generic Class
- Referring to the declared generic type within its own declaration
- Using Generics to auto-cast
- Binding generic parameter to more than 1 type
- Use of instanceof with Generics
- Different ways for implementing a Generic Interface or extending a Generic Class
- File I/O
- File IO
- Migrating from java.io.File to Java 7 NIO java.nio.file.Path
- Reading an image from a file
- File ReadWrite Using FileInputStreamFileOutputStream
- Reading all bytes to a byte
- Copying a file using Channel
- Writing a byte to a file
- Stream vs WriterReader API
- Reading a file with a Scanner
- Copying a file using InputStream and OutputStream
- Locking
- Reading from a binary file
- Reading a file using Channel and Buffer
- Reading a whole file at once
- Reading a file using BufferedInputStream
- Writing a file using Channel and Buffer
- Writing a file using PrintStream
- Adding Directories
- Iterating over a directory and filter by file extension
- Iterate over a directory printing subdirectories in it
- Blocking or redirecting standard output error
- Accessing the contents of a ZIP file
- Arrays
- Arrays
- Creating and Initializing Arrays
- Creating a List from an Array
- Creating an Array from a Collection
- Multidimensional and Jagged Arrays
- ArrayIndexOutOfBoundsException
- Array Covariance
- Arrays to Stream
- Iterating over arrays
- Arrays to a String
- Sorting arrays
- How do you change the size of an array
- Getting the Length of an Array
- Converting arrays between primitives and boxed types
- Remove an element from an array
- Finding an element in an array
- Comparing arrays for equality
- Copying arrays
- Casting Arrays
- Interfaces
- Maps
- Strings
- Strings
- Comparing Strings
- Changing the case of characters within a String
- Finding a String Within Another String
- String pool and heap storage
- Splitting Strings
- Joining Strings with a delimiter
- String concatenation and StringBuilders
- Platform independent new line separator
- Substrings
- Converting String to other datatypes.
- Reversing Strings
- Adding toString method for custom objects
- Remove Whitespace from the Beginning and End of a String
- Case insensitive switch
- Replacing parts of Strings
- Base64 Encoding Decoding
- Conversion to from bytes
- Getting the nth character in a String
- Getting the length of a String
- Counting occurrences of a substring or character in a string
- Converting other datatypes to String
- Getting a String from an InputStream
- Parsing Strings to a Numerical Value
- InputStreams and OutputStreams
- Default Methods
- Classes and Objects
- Basic Control structures
- Concurrent Programming Threads
- Concurrent Programming Threads
- Callable and Future
- CountDownLatch
- Basic Multithreading
- Locks as Synchronisation aids
- Semaphore
- Runnable Object
- Creating basic deadlocked system
- Synchronization
- Creating a java.lang.Thread instance
- Atomic operations
- Exclusive write Concurrent read access
- Visualizing readwrite barriers while using synchronized volatile
- Get status of all threads started by your program excluding system threads
- Producer-Consumer
- Multiple producerconsumer example with shared global queue
- Using ThreadLocal
- Add two int arrays using a Threadpool
- Pausing Execution
- Thread Interruption Stopping Threads
- Console I/O
- Singletons
- Visibility controlling access to members of a class
- Regular Expressions
- Autoboxing
- Documenting Java Code
- Executor, ExecutorService and Thread pools
- Executor ExecutorService and Thread pools
- ThreadPoolExecutor
- Retrieving value from computation - Callable
- submit vs execute exception handling differences
- Fire and Forget - Runnable Tasks
- Handle Rejected Execution
- Use cases for different types of concurrency constructs
- Wait for completion of all tasks in ExecutorService
- Use cases for different types of ExecutorService
- Scheduling tasks to run at a fixed time after a delay or repeatedly
- Using Thread Pools
- Object Class Methods and Constructor
- JAXB
- JAXB
- Reading an XML file unmarshalling
- Writing an XML file marshalling an object
- Manual fieldproperty XML mapping configuration
- Binding an XML namespace to a serializable Java class.
- Using XmlAdapter to generate desired xml format
- Automatic fieldproperty XML mapping configuration XmlAccessorType
- Specifying a XmlAdapter instance to reuse existing data
- Using XmlAdapter to trim string.
- Primitive Data Types
- Primitive Data Types
- Comparing floating point values
- The char primitive
- Primitive Types Cheatsheet
- Using underscore to improve readability
- The float primitive
- Converting Primitives
- The int primitive
- Memory consumption of primitives vs. boxed primitives
- The double primitive
- The byte primitive
- The boolean primitive
- The long primitive
- Hexadecimal Octal and Binary literals
- Negative value representation
- The short primitive
- Networking
- Networking
- Basic Client and Server Communication using a Socket
- Basic ClientServer Communication using UDP Datagram
- Loading TrustStore and KeyStore from InputStream
- Socket example - reading a web page using a simple socket
- Multicasting
- Temporarily disable SSL verification for testing purposes
- Downloading a file using Channel
- Optional
- Enums
- Enums
- Declaring and using a basic enum
- Enums with constructors
- Enums with Abstract Methods
- Implements Interface
- Implement Singleton pattern with a single-element enum
- Using methods and static blocks
- Zero instance enum
- Documenting enums
- Enum constant specific body
- Enum as a bounded type parameter
- Getting the values of an enum
- Compare and Contains for Enum values
- Enum Polymorphism Pattern
- Enum with properties fields
- Get enum constant by name
- Convert enum to String
- Enums with static fields
- HttpURLConnection
- Annotations
- Annotations
- The idea behind Annotations
- Defining annotation types
- Runtime annotation checks via reflection
- Built-in annotations
- Compile time processing using annotation processor
- Repeating Annotations
- Inherited Annotations
- Getting Annotation values at run-time
- Annotations for this and receiver parameters
- Add multiple annotation values
- Audio
- Data Class
- Date Class
- Convert java.util.Date to java.sql.Date
- A basic date output
- Java 8 LocalDate and LocalDateTime objects
- Converting Date to a certain String format
- Creating a Specific Date
- Creating Date objects
- Time Zones and java.util.Date
- Comparing Date objects
- LocalTime
- Converting String into Date
- Convert formatted string representation of date to Date object
- Calendar and its Subclasses
- Nashorn JavaScript engine
- Java Native Interface (JNI)
- Remote Method Invocation (RMI)
- Iterator and Iterable
- Operators
- Operators
- The IncrementDecrement Operators --
- The Conditional Operator
- The Bitwise and Logical Operators
- Checking setting clearing and toggling individual bits. Using long as bit mask
- Operator Precedence
- The Arithmetic Operators -
- The String Concatenation Operator
- The Instanceof Operator
- The Assignment Operators - and
- The conditional-and and conditional-or Operators and
- The Shift Operators and
- The Equality Operators
- The Lambda operator -
- The Relational Operators
- Asserting
- Scanner
- Properties Class
- Preferences
- Reflection API
- Reflection API
- Introduction
- Dynamic Proxies
- Misuse of Reflection API to change private and final variables
- Getting and Setting fields
- Evil Java hacks with Reflection
- Call constructor
- Get Class given its fully qualified name
- Call overloaded constructors using reflection
- Invoking a method
- Call constructor of nested class
- Getting the Constants of an Enumeration
- Constructors
- ByteBuffer
- Serialization
- JSON in Java
- JSON in Java
- Using Jackson Object Mapper
- JSON To Object Gson Library
- JSONObject.NULL
- JSON Builder - chaining methods
- Object To JSON Gson Library
- JSON Iteration
- optXXX vs getXXX methods
- Encoding data as JSON
- Decoding JSON data
- Extract single element from JSON
- JsonArray to Java List Gson Library
- Deserialize JSON collection to collection of Objects using Jackson
- Random Number Generation
- Recursion
- Recursion
- The basic idea of recursion
- Deep recursion is problematic in Java
- Types of Recursion
- Computing the Nth Fibonacci Number
- Computing the Nth power of a number
- Traversing a Tree data structure with recursion
- StackOverflowError recursion to loop
- Reverse a string using Recursion
- Computing the sum of integers from 1 to N
- Polymorphism
- StringBuilder
- Refernce Data Types
- Bit Manipulation
- Java Agents
- Encapsulation
- Type Conversion
- BigInteger
- BigDecimal
- RSA Encryption
- Varargs Variable Arguments
- ThreadLocal
- Logging
- static keyword
- Disassembling and Decompling
- Resources on classpath
- log4j, log4j2
- JVM Flags
- Oracle Official Code Standard
- Oracle Official Code Standard
- Naming Conventions
- Class Structure
- Annotations
- Import statements
- Redundant Parentheses
- Braces
- Modifiers
- Indentation
- Literals
- Lambda Expressions
- Package declaration
- Whitespace
- Wrapping statements
- Java Source Files
- Wrapping Expressions
- Wrapping Method Declarations
- Variable Declarations
- Special Characters
- Character encoding
- Java Memory Management
- Immutable Objects
- Object Cloning
- Alternative Collections
- Lists
- Lists
- Sorting a generic list
- Convert a list of integers to a list of strings
- Classes implementing List - Pros and Cons
- Finding common elements between 2 lists
- Creating a List
- Positional Access Operations
- Iterating over elements in a list
- Removing elements from list B that are present in the list A
- Creating Adding and Removing element from an ArrayList
- In-place replacement of a List element
- Making a list unmodifiable
- Moving objects around in the list
- BufferedWriter
- LocalTime
- Sets
- Comparable and Comparator
- JVM Tool Interface
- Nested and Inner Classes
- Apache Commons Lang
- Getters and Setter
- The Classpath
- Bytecode Modification
- XML Parsing using JAXP
- Reference Types
- Localization and Internationalization
- JAX-WS
- XML XPath Evaluation
- Performance Tuning
- Parallel programming with ForkJoin framework
- Common Pitfalls
- Common Java Pitfalls
- Pitfall using to compare primitive wrappers objects such as Integer
- Pitfall using to compare strings
- Pitfall forgetting to free resources
- Pitfall testing a file before attempting to open it.
- Pitfall thinking of variables as objects
- Pitfall memory leaks
- Pitfall - Catching Throwable Exception Error or RuntimeException
- Pitfall Not understanding that String is an immutable class
- Pitfall - Missing a break in a switch case
- Pitfall - Ignoring or squashing exceptions
- Pitfall combining assignment and side-effects
- Pitfall - String concatenation in a loop does not scale
- Pitfall - Throwing Throwable Exception Error or RuntimeException
- Pitfall concurrent modification exceptions
- Pitfall - Ignoring method visibility
- Pitfall Runtime.exec Process and ProcessBuilder dont understand shell syntax
- Pitfall - Using new to create primitive wrapper instances is inefficient
- Pitfall - Misplaced semicolons and missing braces
- Pitfall incorrect use of wait notify
- Pitfall - The overheads of creating log messages
- Non-Access Modifiers
- Java Compiler
- XJC
- Installing Java Standard Edition
- Installing Java Standard Edition
- Setting %PATH% and %JAVA_HOME% after installing on Windows
- Installing a Java JDK on Linux
- Installing a Java JDK on macOS
- Differences between Java SE JRE or Java SE JDK distributions
- Installing a Java JDK or JRE on Windows
- Selecting an appropriate Java SE release
- Java release and version naming
- Configuring and switching Java versions on Linux using alternatives
- What do I need for Java Development
- Post-installation checking and configuration on Linux
- Installing oracle java on Linux with latest tar file
- What is the difference between Oracle Hotspot and OpenJDK
- Process
- Command line argument processing
- Dates and Time using java.time
- Fluent Interface
- XOM - XML Object Model
- Just in Time JIT compiler
- FTP File Transfer Protocol
- Java Native Access JNI
- Modules
- Pitfalls - exceptions
- Java Pitfalls - Exception usage
- Pitfall - Catching Throwable Exception Error or RuntimeException
- Pitfall - Ignoring or squashing exceptions
- Pitfall - Throwing Throwable Exception Error or RuntimeException
- Pitfall - Using exceptions for normal flowcontrol
- Pitfall - Catching InterruptedException
- Pitfall - Excessive or inappropriate stacktraces
- Pitfall - Directly subclassing Throwable
- Pitfalls - language syntax
- Java Pitfalls - Language syntax
- Pitfall - Missing a break in a switch case
- Pitfall - Leaving out braces the dangling if and dangling else problems
- Pitfall - Declaring classes with the same names as standard classes
- Pitfall - Ignoring method visibility
- Pitfall - Octal literals
- Pitfall - Using to test a boolean
- Pitfall - Misplaced semicolons and missing braces
- Pitfall - Wildcard imports can make your code fragile
- Pitfall Using assert for argument or user input validation
- Pitfall - Overloading instead of overriding
- Pitfall of Auto-Unboxing Null Objects into Primitives
- ServiceLoader
- ClasssLoader
- Object References
- Pitfalss - performance
- Java Pitfalls - Performance Issues
- Pitfall - String concatenation in a loop does not scale
- Pitfall - Using size to test if a collection is empty is inefficient.
- Pitfall - Using new to create primitive wrapper instances is inefficient
- Pitfall - Interning strings so that you can use is a bad idea
- Pitfall - Efficiency concerns with regular expressions
- Pitfall - Small reads writes on unbuffered streams are inefficient
- Pitfall - Over-use of primitive wrapper types is inefficient
- Pitfall - Iterating a Maps keys can be inefficient
- Pitfall - The overheads of creating log messages
- Pitfall - Calling new StringString is inefficient
- Pitfall - Calling System.gc is inefficient
- Creating Images Programmatically
- Creating Images Programmatically
- Creating a simple image programmatically and displaying it
- Save an Image to disk
- Setting individual pixels color in BufferedImage
- Specifying image rendering quality
- Creating an image with BufferedImage class
- Editing and re-using image with BufferedImage
- How to scale a BufferedImage
- Applets
- NIO Networking
- New File I/O
- Secure objects
- Pitfalls - threads and concurrency
- Splitting a string into fixed length parts
- Pitfalls - nulls and NullPointerException
- Java Pitfalls - Nulls and NullPointerException
- Pitfall - Making good unexpected nulls
- Pitfall - Using null to represent an empty array or collection
- Pitfall - Returning null instead of throwing an exception
- Pitfall - Not checking if an IO stream isnt even initialized when closing it
- Pitfall - Using Yoda notation to avoid NullPointerException
- Pitfall - Unnecessary use of Primitive Wrappers can lead to NullPointerExceptions
- SecurityManager
- JNDI
- super keyword
- java.util.Objects class
- Java command: java and javaw
- Atomic types
- Floating Point Operations
- Converting to and from strings
- sun.misc.Unsafe
- Java Memory Model
- Java deployment
- Java plugin system implementations
- Queues and deques
- Runtime commands
- NumberFormat
- Security and Cryptograhy
- Java Virtual Machine JVM
- Unit Testing
- JavaBean
- Expressions
- Literals
- Java SE 8 Features
- Java SE 7 Features
- Packages
- Concurrency and Money
- Concurrent Collections
- Using ThreadPoolExecutor in multi-threaded applications
- Java Editions, versions, releases and distributions
- Dynamic method dispatch
- JMX
- Security and cryptography
- Generating Java Code
- JShell
- Benchmarks
- Collection Factory Methods
- Multi-release JAR files
- Stack-Walking API
- TreeMap and TreeSet
- Sockets
- Java Sockets
- Using other scripting languages in Java
- Functional interfaces
- List vs. set
- 2D graphics
- Reflection
- Deque interface
- Enum Map
- EnumSet class
- Local Inner class
- Java Print Service
- Immutable class
- String Tokenizer
- File upload to S3 / AWS
- Readers and writers
- Hashtable
- Enum starting with a number
- SortedMap
- WeakHashMap
- LinkedHashMap
- StringBuffer
- Choosing Collections
- C++ Comparison
- CompletableFuture
- Contributors