A Guide to Understand Java Generics with Examples

With Simple Examples Step by Step

4.40 (56 reviews)
Udemy
platform
English
language
Programming Languages
category
instructor
A Guide to Understand Java Generics with Examples
11,523
students
3 hours
content
Feb 2021
last update
$39.99
regular price

What you will learn

Guide to Understand Generics with Examples

Description

Java Generics

Java Generic methods and generic classes enable programmers to specify, with a single method declaration, a set of related methods, or with a single class declaration, a set of related types, respectively. Generics also provide compile-time type safety that allows programmers to catch invalid types at compile time. This reference will take you through simple and practical methods using Java Generics.

The Java Generics programming is introduced in J2SE 5 to deal with type-safe objects. It makes the code stable by detecting the bugs at compile time.

Before generics, we can store any type of objects in the collection, i.e., non-generic. Now generics force the java programmer to store a specific type of objects.

It would be nice if we could write a single sort method that could sort the elements in an Integer array, a String array, or an array of any type that supports ordering.

Java Generic methods and generic classes enable programmers to specify, with a single method declaration, a set of related methods, or with a single class declaration, a set of related types, respectively.

Generics also provide compile-time type safety that allows programmers to catch invalid types at compile time.

Using Java Generic concept, we might write a generic method for sorting an array of objects, then invoke the generic method with Integer arrays, Double arrays, String arrays and so on, to sort the array elements.

Content

Introduction

Java Generics Introduction

Java Generics Concepts

Java Generics Overview
Example to Understand the power of generics
Arrays vs Collection Introduction
Arrays vs Collection vs Generics Example
Why we need generics
Generic Class Syntax Introduction
Generic Class Example Part1
Generic Class Example Part2
Generics Naming Conventions
Generic Example With K Type and V Type
Type Inference in Java with Generics
Generic Method Introduction
Generic Method With Void Example
Generic Method With Return Example
Raw Type Generic Example

Java Generic Bounds

Upper Bound Generic Introduction
Upper Bound Generic Example
Multiple UpperBound Example
Upper Bound Wildcard Introduction
Upper Bound Wildcard Example1
Upper Bound Wildcard Example2
Upper Bound Restriction
Lower Bound Example Introduction
Lower Bound Example
UnBounded Wildcard Example

Type Erasure in Generics

Type Erasure Introduction
Type Erasure With Object Example
Type Erasure with Bounded Example
Restriction With Generics in Java

Thanks

Thank you !!!

Reviews

Donny
June 24, 2021
Patient, thorough and complete coverage of generics. This is an excellent supplement to anyone's study of Generics. I was stuck in my college course when this subject was covered, but now I'm unstuck. Thank you!
Guillermo
March 28, 2021
Muy buen curso, el profesor enseña bien, muestra ejemplos, y explica las causas de porque se puede hacer y las restricciones que hay

Coupons

DateDiscountStatus
2/20/2021100% OFF
expired

Charts

Price

A Guide to Understand Java Generics with Examples - Price chart

Rating

A Guide to Understand Java Generics with Examples - Ratings chart

Enrollment distribution

A Guide to Understand Java Generics with Examples - Distribution chart
3853988
udemy ID
2/16/2021
course created date
2/19/2021
course indexed date
Bot
course submited by