So I was reading through the source code of Collections.java, there is a generic method copy(). I simplified it to this: public static <T> void copy(List&
I'm trying to filter a List of objects that implements an interface. And I'm trying to create a generic method for all the classes. Something like: interface So
I am trying to come up with a way to do this where I can have type safety but also loose coupling of a couple of different components in my class. I am running
How can I enforce providing the generic type of a generic method in dart. By default, dart allows us to not provide a generic type at all. And this should be a
I am testing out generics in go 1.18 and took a look at this example. I would like to recreate that example but instead be able to pass in a slice of int or sli
Probably a golang beginner's question :) I'm facing following compiler error when trying to compile the code below. I want to implement an object store for diff
I have to place an integer value into the map below. Map<String,?> map map.put("key",2000); When I run the above code I'm getting the following error: in
I'm getting a runtime error from a Dart generic function: Widget card = widget.cardBuilder(item); Which generates: type '(Contact) => Widget' is not a
I need to write a custom deserializer for a class with generics. I couldn't find a way to do this, however I cannot imagine I'm the only one with this problem.
IS there a way to pass an array of types to the "is" operator? I am trying to simplify the syntax of checking an object against multiple types. Something like
The Unity project makes frequent use of C# functions that supply a type in a diamond operator after the method name. In the Unity source code it's defined like
I am attempting to use MapStruct to convert between 2 internal models. These models are generated from the same specification and represent a large tree-like st
Since Python 3.5 you can use Generics and other interesting stuff described in PEP-0484. I tried that and here's a code I have: from typing import TypeVar, Ge
My type annotations I currently have look similar to the following, and I want to use an typing alias to not repeat myself so much: A class has class variables,
In code I created user defined class Myclass and Myclass2 which extends Myclass and then used in ArrayList<? extends Myclass> as a arguments that means no
I have a struct which holds registers. I want my read_register function to return a u8 for Register::V0 and Register::V1 but a u16 for Register::V2 and Register
My generic repository is as follows ( I have similar in synchronious and it works) public virtual async Task<IEnumerable<TEntity>> GetAsyn( Expr
I am trying to write a method that takes in a list of numeric values - eg List<Integer>, List<Float>, List<Double> etc - and give me the avera
I am trying to write a method that takes in a list of numeric values - eg List<Integer>, List<Float>, List<Double> etc - and give me the avera
Every time I make a new Script in Unity, I always end up doing a bunch of checks for any components my script depends on, like: SpriteRenderer sr = gameObject.