Top "Generics" questions

Generics are a form of parametric polymorphism found in a range of languages, including .NET languages, Java, Swift, and Rust.

Jackson and generic type reference

I want to use jackson json library for a generic method as follows: public MyRequest<T> tester() { TypeReference&…

java json generics jackson
What is the point of the diamond operator (<>) in Java 7?

The diamond operator in java 7 allows code like the following: List<String> list = new LinkedList<>(); However …

java generics java-7 diamond-operator
Create a new object from type parameter in generic class

I'm trying to create a new object of a type parameter in my generic class. In my class View, I …

typescript generics
How to Pass Parameters to Activator.CreateInstance<T>()

I want to create an instance of a type that I specify in a generic method that I have. This …

c# generics createinstance
Generics in C#, using type of a variable as parameter

I have a generic method bool DoesEntityExist<T>(Guid guid, ITransaction transaction) where T : IGloballyIdentifiable; How do I …

c# .net generics types
What does <T> denote in C#

I'm new to C# and directly diving into modifying some code for a project I received. However, I keep seeing …

c# .net generics
How do I implement IEnumerable<T>

I know how to implement the non generic IEnumerable, like this: using System; using System.Collections; namespace ConsoleApplication33 { class Program { …

c# .net generics
What does <T> (angle brackets) mean in Java?

I am currently studying Java and have recently been stumped by angle brackets(<>). What exactly do they mean? …

java generics
Cast object to T

I'm parsing an XML file with the XmlReader class in .NET and I thought it would be smart to write …

c# generics casting
Generic type conversion FROM string

I have a class that I want to use to store "properties" for another class. These properties simply have a …

c# generics primitive type-safety