Generics
- Q194: How do I define a generic class in EK9?
- Q195: How do I constrain generic type parameters in EK9?
- Q196: How do I define generics with multiple type parameters in EK9?
- Q197: How do I extend or specialize a generic type in EK9?
- Q198: What built-in generic types does EK9 provide?
- Q642: How does constructor-based type inference work for generic classes?
- Q643: Why must a generic class have both a default and an inferred-type constructor?
- Q644: How must constructor argument types match generic type parameters?
- Q645: Can a generic type constructor be private?
- Q646: Where is type inference not supported in generic type and function bodies?
- Q647: Why cannot I use a function type as a generic constraint?
- Q648: Why cannot I use named dynamic classes inside a generic type definition?
- Q649: Why must generic functions provide an implementation?
- Q650: What operators can be used with function-typed type parameters in generics?
- Q651: How must constrained type constructors match the parameterising type?
- Q652: Why must Result be used with two different types?
- Q653: Why is List of Circle not compatible with List of Shape?
- Q654: How does EK9 validate the number of type parameters for generics?
- Q655: Can I overload methods with different parameterised types in EK9?
- Q656: How does EK9 validate argument counts when calling generic functions?
- Q681: What is the correct syntax for generic type parameterization and instantiation?
- Q682: How does field encapsulation work in generic classes?
- Q683: What are the complete constructor rules for generic types?
- Q707: How do I use Consumer and Acceptor with concrete types?
- Q708: How do I use Supplier and Producer to create values?
- Q709: How do I use Predicate and Assessor for testing conditions?
- Q710: How do I use Function and Routine for transformations?
- Q711: How do I use BiConsumer and BiAcceptor with two parameters?
- Q712: How do I use BiPredicate and BiAssessor to test two values?
- Q713: How do I use BiFunction and BiRoutine for two-input transformations?
- Q714: How do I use the Comparator function type for ordering?
- Q715: How do I use UnaryOperator for same-type transformations?
- Q833: Why can't I use a function type to parameterize a generic that calls constructors?
- Q840: Why does passing the wrong type to a function cause E06270 in EK9?
- Q841: Why can't I instantiate an abstract generic type like Iterator of String?
- Q854: Why can't I use type inference inside a generic class body in EK9?
- Q948: Why must generic types always be parameterized when used?
- Q1071: Why does the compiler require two constructors for my generic class?
- Q1182: Define a generic Pair class with two type parameters and proper field initialisation.
- Q1234: Create me a generic Processor class of type T with an abstract process method, then extend it inline using a dynamic class with String as the type parameter.
- Q1235: Write me a generic Formatter of type T that captures a prefix variable from the enclosing scope and uses it inside the overridden format method.
- Q1242: Create me a generic Validator class of type T with two abstract methods (check and describe), and a dynamic class implementation that validates a Date by checking it falls within a known year range.
- Q1243: Write me a generic Transformer class with two type parameters K and V, and a dynamic class implementation that maps String keys to Integer values via a transform method.
- Q1268: Write a generic Pair class with two type parameters A and B that holds two values.
- Q1286: What does EK9 error E06060 mean on a generic class constructor and how do I fix it?
- Q1287: Can a generic class have multiple constructors in EK9, and do they all have to be public to avoid E06060?
- Q1309: Why does EK9 reject 'of TypeName' on a non-generic type like String?
- Q1310: Why does EK9 reject a generic type named without 'of' in a declaration?
- Q1346: Why does E07175 fire on my generic class with a 'T?' field and a default constructor?
- Q1347: When must a generic class use 'default private' for its no-argument constructor?
- Q1348: What are the two safe ways to write a generic class that has an optional 'T?' field?