Top "Generics" questions

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

What does the question mark in Java generics' type parameter mean?

This is a small snippet of code taken from some of the examples that accompany the Stanford Parser. I've been …

java generics
Value of type 'T' cannot be converted to

This is likely a a novice question, but google surprisingly did not provide an answer. I have this rather artificial …

c# .net generics casting
returning a Void object

What is the correct way to return a Void type, when it isn't a primitive? Eg. I currently use null …

java generics return-value
List<object>.RemoveAll - How to create an appropriate Predicate

This is a bit of noob question - I'm still fairly new to C# and generics and completely new to …

c# generics delegates lambda predicate
Implement an Interface with Generic Methods

I'm drawing a blank on this one and can't seem to find any previous example that I wrote. I'm trying …

c# generics interface
Using Java generics for JPA findAll() query with WHERE clause

So, After a 10+ year break I'm coming back to Java and trying out stuff with JPA and Java generics. I've …

java generics jpa criteria-api
The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly

Could someone please clarify something for me. In my ASP.NET MVC 2 app, I've got a BaseViewModel class which includes …

c# linq generics asp.net-mvc-2 expression
Using Spring RestTemplate in generic method with generic parameter

To use generic types with Spring RestTemplate we need to use ParameterizedTypeReference (Unable to get a generic ResponseEntity<T&…

java spring generics jackson resttemplate
Cannot apply indexing with [] to an expression of type 'System.Collections.Generic.IEnumerable<>

Is there any specific reason why indexing is not allowed in IEnumerable. I found a workaround for the problem I …

c# list generics ienumerable
C# - Multiple generic types in one list

This is probably not possible, but I have this class: public class Metadata<DataType> where DataType : struct { private …

c# generics