Questions tagged [type-parameter]

A type parameter is a parameter whose value is a type.

A parameter whose value is a type. Often, type parameters are a only compile time feature of a programming language.

C++'s template type parameters provide an example of type parameters.

472 questions
-1
votes
1 answer

When is a type parameter list required to be provided?

What's the general rule about when a type parameter list is required? For example, the type parameter list seen between static and the return type Set below: is it required? public static Set union(Set s1, Set s2) {} For another…
Zoe
  • 807
  • 3
  • 10
  • 16
-1
votes
2 answers

Generic Type as type parameter

Is it possible to have a generic type parameter that requires a type parameter? i.e. public abstract class ClassA {} public class ClassB:ClassA {} ... public void MethodA() where T:ClassA, new() { T x=new…
DJL
  • 1,821
  • 3
  • 17
  • 31
-1
votes
2 answers

Defenition of type parameter

I dont understand a strong defenition of type parameter in generic class or method. It's a reference type such that... what? Does it just non reifiable type? Is it true that all reference type for compiler is reifiable or not reifiable? 2.Consider…
St.Antario
  • 23,179
  • 26
  • 96
  • 243
-2
votes
1 answer

inheritance from generic interface with type parameter

The code says it all: interface a { } interface ab : a { } interface ac : a { } interface igeneric { } //this is OK class Clazz : igeneric, igeneric { } //compiler error : 'Clazz2' cannot implement both '' and 'igeneric'…
Yoni Shalom
  • 489
  • 4
  • 10
-2
votes
1 answer

Generic class type parameter value in Java

I have declared a Class Animal . And I have an interface Interface1. When I try to use a reference of this class in any method (let's take main method it gives a compile error) public interface Interface1 {} public class Animal
Raj
  • 183
  • 1
  • 1
  • 8
-2
votes
1 answer

Enum as a generic type and to be used in some annotations

I want the sub classes to pass specific enum values to parent class in extends, such that these specific enum value would be used in parent class in some annotation. Below is what I exactly want to achieve. public enum SomeEnum { VAL1,…
Priyank Doshi
  • 11,959
  • 16
  • 54
  • 81
-5
votes
1 answer

Scala extends Java Interface with type

I am curious how one would implement a Java Interface in Scala with the following signature; public interface MyService { ... } Thanks!!
cbm64
  • 799
  • 1
  • 10
  • 21
1 2 3
31
32