September 2018
Intermediate to advanced
302 pages
7h 17m
English
Generics allow you to write code that will handle any type of object. For instance, you know that a list is a generic type. You can make a list of anything. Hence, when we used Immutable.List, we had to specify what kind of objects the list will consist of:
Immutable.List<TaskType>
List of tasks. Let's now create our own generic type.
In our code base, we have one util that is supposed to work with any type. It is a Maybe monad.
The Maybe monad is either Nothing, when the variable happens to be null, undefined, or Something of that type. This is a perfect fit for generic types: ...
Read now
Unlock full access