About 16,300,000 results
Open links in new tab
  1. What is cool about generics, why use them? [closed]

    I thought I'd offer this softball to whomever would like to hit it out of the park. What are generics, what are the advantages of generics, why, where, how should I use them? Please keep it fairly ...

  2. Java generics: multiple generic parameters? - Stack Overflow

    package generics.basics; import java.util.ArrayList; import java.util.List; public class GenericMethods { /* Declare the generic type parameter T in this method. After the qualifiers public and static, you put …

  3. oop - What are Generics in Java? - Stack Overflow

    Oct 19, 2011 · Generics are not templates. Primitives do not (yet) have common type in Java. So T could not be anything that then can be used for any of these types. There are wrappers and they all …

  4. Generics/templates in python? - Stack Overflow

    Oct 13, 2014 · The other answers are totally fine: One does not need a special syntax to support generics in Python Python uses duck typing as pointed out by André. However, if you still want a …

  5. Create instance of generic type in Java? - Stack Overflow

    Sep 17, 2008 · 20 From Java Tutorial - Restrictions on Generics: Cannot Create Instances of Type Parameters You cannot create an instance of a type parameter. For example, the following code …

  6. c# - <out T> vs <T> in Generics - Stack Overflow

    291 The out keyword in generics is used to denote that the type T in the interface is covariant. See Covariance and contravariance for details. The classic example is IEnumerable<out T>. Since …

  7. java - What are Reified Generics? How do they solve Type Erasure ...

    Yes, generics in class declarations like the types in generic parameters, types of fields, types in method signatures, type of superclass, type of enclosing class of inner classes (there is nothing special about …

  8. Python generics and subclasses - Stack Overflow

    I'm trying to add type annotations to an existing package, and clearly I'm missing something important. I have an abstract superclass, and subclasses. The superclass should be generic, whereas the

  9. Understanding C# generics much better - Stack Overflow

    Generics let you avoid it by allowing you to code around a 'generic' type and later substitute it with specific types. The other solution to this problem is to use variables of type 'System.Object' to which …

  10. What are the differences between "generic" types in C++ and Java?

    Generics, as I understand them, work the other way around: the type parameters are used by the compiler to verify that the code using them is type-safe, but the resulting code is generated without …