Generics in Java: Creating Classes and Methods Using Generics

Java    |    Intermediate
  • 12 videos | 1h 39m 12s
  • Includes Assessment
  • Earns a Badge
Rating 4.4 of 61 users Rating 4.4 of 61 users (61)
Generics is a handy tool in Java that greatly increases the maintainability of your code by allowing you to reuse code, using the same class or method with different types of data. Furthermore, generics also convert runtime checks to compile-time checks, making your code less error-prone. In this course, learn how to use generics in Java to write reusable and maintainable code, exploring why generic code has several advantages over non-generic code. Get hands-on practice with creating and defining classes with generic type parameters. Investigate how these generic types can be used as types for member variables, input arguments to methods, and return values from methods. Moving along, implement generic methods where the generic type parameter is associated with the method rather than the class itself. When you're finished, you'll have a solid foundation in defining and working with generic classes and methods in Java.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    List the advantages of writing generic code over non-generic code
    Recall the limitations on code reuse in non-generic classes
    Recall the limitations of using raw objects rather than generic types
    Implement a class with generics for type safety and compile-time checks
    Use generic types as input arguments to methods and return values from methods
  • Create non-parameterized objects from generic classes
    Recall the disadvantages of non-generic methods
    Parameterize the class definition to create generic methods
    Parameterize the method definition without parameterizing classes
    Illustrate type inference with parameterized methods
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 3s
  • 6m 39s
  • Locked
    3.  Identifying Non-generic Code Reuse Limitations
    7m 15s
  • Locked
    4.  Using Raw Objects to Store Data: The Limitations
    7m 38s
  • Locked
    5.  Implementing Classes with Generic Type Parameters
    12m 7s
  • Locked
    6.  Using Generic Types for Parameters and Return Types
    12m 40s
  • Locked
    7.  Constructing Raw Objects from Generic Classes
    7m 24s
  • Locked
    8.  Identifying the Limitations of Non-generic Methods
    11m 56s
  • Locked
    9.  Parameterizing Classes to Call Parameterized Methods
    7m 56s
  • Locked
    10.  Using Parameterized Methods
    9m 16s
  • Locked
    11.  Identifying Type Inference for Parameterized Methods
    12m 14s
  • Locked
    12.  Course Summary
    2m 4s

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

Rating 4.6 of 60 users Rating 4.6 of 60 users (60)
Rating 4.3 of 47 users Rating 4.3 of 47 users (47)
Rating 4.5 of 36 users Rating 4.5 of 36 users (36)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 36 users Rating 4.5 of 36 users (36)
Rating 4.9 of 8 users Rating 4.9 of 8 users (8)
Rating 4.7 of 134 users Rating 4.7 of 134 users (134)