
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Explore generics for compile time safety, collections and hashing based data structures like array lists, linked lists, stacks and queues, and learn reflection and the stream API to process collections.
Explore why Java generics matter, showing how generic programming strengthens type safety, reduces runtime casting, enables parameterized types and methods, and supports reusable algorithms like generic sorting across data types.
Demonstrates why generics beat method overloading in Java by replacing many overloads for integers, floating point values, doubles, and longs with a single generic method.
Explore how generics enforce type safety in Java by using a generic store with the diamond operator, replacing object and preventing compile time and runtime errors from casting.
Explains using multiple generic types in a class through a hash table example with key and value generics, showing the diamond operator, raw types, and type-safe key-value storage.
Discover how to implement generic methods in Java, using the diamond operator to declare generic parameters, print items with toString, and handle single or multiple generic values with return types.
Discover how to create generic methods that handle a one dimensional array of generic types, and learn why primitive types are unsupported and how type erasure shapes runtime behavior.
Bounded type parameters restrict generic arguments to numbers and their subclasses, enabling mathematical operations on integers, floats, and doubles, with extends bounds and possible multiple bounds such as comparable.
Learn how bounded type parameters restrict generic methods to comparable types, enabling min comparisons via compareTo across integers, doubles, strings, and custom objects.
Explains bounding a generic type to number to enable summing generic values by converting to double, showing a generic sum method and list-based accumulation.
Understand how the Java compiler uses the type inference algorithm to determine generic type arguments, including when serializable applies, enabling the diamond operator and automatic type resolution.
Explore type inference in generics by implementing a generic bucket class, a static store method, and a list of buckets, showing how Java infers types with the diamond operator.
Explore how Java infers generic types in a static generic method using the diamond operator, by building a list of integers or strings, and returning the inferred generic list.
Learn how type witness declares the element type of a generic list in Java, guiding the compiler when inferring or constraining a returned list.
Explore how Java wildcards resolve generic subtyping issues by using ? to encompass collections, enabling printing of integer and double lists while highlighting upper and lower bounds.
Explore unbounded wildcards in Java generics, showing how they let lists hold different types for printing and drawing shapes, and compare with bounded type parameters using extends and super.
Explore upper bounded wild cards in Java, using extends to accept lists of any subclass of a type, enabling safe reading while disallowing insertion into such lists.
Explore upper bounded wildcards in Java using extends, showing how reads are safe while inserts are not; implement show all and sum methods to handle number subtypes.
Explore lower bounded wildcards in Java, using the super keyword to insert items into a generic collection of any super class of T; reading yields objects, unlike upper bounded wildcards.
Use the super keyword to work with lower bounded wild cards in lists of numbers, enabling insertion while reading yields object-typed results.
Shows copying items from a source list to a destination list with a generic copy method using upper bounded wildcards via extends and lower bounded wildcards via super.
Explore the difference between wildcards and bounded type parameters in Java, using extends and super, the get and put principle, and when to read, write, or both.
Discover how type erasure implements Java generics by replacing type parameters with bounds or objects, leaving plain bytecode. See how this process affects wildcards, bridge methods, and runtime-to-compile-time exception behavior.
Explore type erasure in Java by examining a generic bucket at runtime, showing that generics erase to object unless bounded by serializable and revealed by reflection.
Learn how type erasure and bridge methods prevent ambiguous type issues in Java, as the compiler adds a bridge method to reconcile a subclass's integer data with the superclass.
Explore why generic one-dimensional arrays in Java are problematic due to type erasure, which hides runtime type information and disrupts proper contiguous memory allocation.
Discover why primitive types cannot be used in generics due to type erasure replacing with object, since primitives are not objects, causing compile-time errors; wrappers like Integer work.
Leverage generics to build a library that stores and executes algorithms through a shared algorithm interface. Implement graph, search, and sorting algorithms and run them.
Explore the Java collections framework, standardizing how programs handle groups of objects with interfaces like list, set, and map, and implementations such as array lists, hash maps, and hash sets.
Explore measuring algorithm running time by counting basic operations, compare data structures for operations, and understand constant, linear, quadratic, and logarithmic time complexities.
Discover how data structures in the collections framework boost algorithm performance, from array lists to maps and sets, by selecting efficient structures and balancing memory versus running time.
Examine the list interface as an ordered, iterable collection that allows duplicates, its relation to collection and iterable, and implementations like ArrayList and LinkedList, including indexOf and lastIndexOf.
Explore how arrays enable fast random-access with zero-based indexing and contiguous memory. Learn about one and two dimensional arrays, Java type consistency, and dynamic resizing.
Explore array operations, including appending to the end and resizing when full by copying items to a larger array. Examine memory-time tradeoffs, shifting for arbitrary insertions, and removal costs.
Explore array lists, instantiated via the list interface with initial capacity and underlying one dimensional arrays. Learn random indexing, foreach loop, and key operations like insert, remove, contains.
Discover how linked lists store items with next pointers to enable efficient insertion, search, and removal without shifting, using a head pointer and a null value to mark the end.
Visualize linked list operations by showing how inserting at the beginning updates the head and next references in constant time, while end insertions and arbitrary removals run linearly.
Java's linked list is a generic, doubly linked list that implements list interface, enabling fast access to the first and last elements. Iterate with foreach and check size and isEmpty.
Examine the vector class as a generic, growable one-dimensional array that stores integers, doubles, strings, and objects, with random indexing and thread-safe resizing via capacity increment.
Learn the basic concepts and functions that you will need to build fully functional programs with the popular programming language, Java.
This course is about generics in the main. You will lern the basics of generic types, generic methods, type parameters and the theoretical background concerning these topics. This is a fundamental part of Java so it is definitly worth learning.
Section 1 - Generic and Generic Programming
why to use generics and generic programming
Section 2 - Basic Generics
generic types
generic methods
fundamentals of generics and generic programming
Section 3 - Bounded Type Parameters
bounded type parameters
Section 4 - Type Inference
what is type inference
Section 5 - Wildcards
what are wildcards?
lower bounded wildcards
upper bounded wildcards
wildcards and bounded type parameters
Section 6 - Type Erasure
what is type erasure?
bridge methods and type erasure
Section 7 - Collections Framework
the collections framework
measuring the running time of algorithms
what are data structures?
Section 8 - Lists
ArrayList and LinkedList
performance comparison of LinkedLists and ArrayLists
Vectors
Stacks
Section 9 - Queues
what are queues?
PriorityQueues
ArrayDeques
Section 10 - Maps
hashing based data structures and hash-functions
HashMaps and LinkedHashMaps
balanced binary search trees and red-black trees
TreeMaps
Section 11 - Sets
what are sets?
HashSets, LinkedHashSets and TreeSets
Section 12 - Sorting Collections
sorting arrays and collections
Comparable and Comparator interfaces
sorting with lambda expressions
Section 13 - Stream API
streams
sequential streams and parallel streams
map() and flatMap()
reduce()
Section 13 - Reflection
what is reflection?
annotations and reflection
reflection and frameworks (such as Spring)
Learning the fundamentals of Java is a good choice and puts a powerful and tool at your fingertips. Java is easy to learn as well as it has excellent documentation, and is the base for all object-oriented programming languages.
Jobs in Java development are plentiful, and being able to learn Java will give you a strong background to pick up other object-oriented languages such as C++, or C# more easily.