Top "Generics" questions

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

How do you convert a DataTable into a generic list?

Currently, I'm using: DataTable dt = CreateDataTableInSomeWay(); List<DataRow> list = new List<DataRow>(); foreach (DataRow dr in …

c# generics datatable
Create instance of generic type in Java?

Is it possible to create an instance of a generic type in Java? I'm thinking based on what I've seen …

java generics
Convert generic List/Enumerable to DataTable?

I have few methods that returns different Generic Lists. Exists in .net any class static method or whatever to convert …

c# list generics datatable
How do I address unchecked cast warnings?

Eclipse is giving me a warning of the following form: Type safety: Unchecked cast from Object to HashMap This is …

java generics warnings
What is SuppressWarnings ("unchecked") in Java?

Sometime when looking through code, I see many methods specify an annotation: @SuppressWarnings("unchecked") What does this mean?

java generics unchecked suppress-warnings
What causes javac to issue the "uses unchecked or unsafe operations" warning

For example: javac Foo.java Note: Foo.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

java generics warnings
How to remove elements from a generic list while iterating over it?

I am looking for a better pattern for working with a list of elements which each need processed and then …

c# list loops generics key-value
ArrayList vs List<> in C#

What is the difference between ArrayList and List<> in C#? Is it only that List<> has …

c# .net list generics arraylist
Create Generic method constraining T to an Enum

I'm building a function to extend the Enum.Parse concept that Allows a default value to be parsed in case …

c# generics enums generic-constraints
A generic list of anonymous class

In C# 3.0 you can create anonymous class with the following syntax var o = new { Id = 1, Name = "Foo" }; Is there a …

c# .net generics anonymous-types