Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
Advice
0 votes
4 replies
87 views

I was reading about Generics from the Eleventh Edition of "Java The Complete Reference", specifically the "Run-Time type Comparisons with a Generic Hierarchy" part. I was confused ...
pingu1605's user avatar
Advice
0 votes
8 replies
134 views

I am making a custom LinkedList<T> in Java, as a way to learn more about data structures, and I am trying to make a search method that filters items based on the input, but I ran into an issue. ...
DuskFlare13's user avatar
0 votes
1 answer
114 views

I am getting this error while implementing a stack by myself. Here is my code interface IStack<T> where T : class { void Push(T item); T Pop(); T Peek(); bool IsEmpty { get; } ...
Md. Maruf Sarker's user avatar
1 vote
2 answers
149 views

I am developing a layered .NET project with API, BLL, DAL, and UI layers. The UI layer calls the API using a generic API repository built with HttpClient. My project structure is roughly like this: ...
NEX's user avatar
  • 13
1 vote
1 answer
78 views

I'm having trouble with implementing a trait bound generic parameter for an entity that sends messages to a proper entity depending on the message. Imagine a trait called MessageTrait and ...
James's user avatar
  • 21
5 votes
1 answer
87 views

I’m trying to understand how conditional types behave differently when a type parameter is “naked.” For example: type Wrapped<T> = [T] extends [string] ? "is string" : "not string&...
drdev's user avatar
  • 51
1 vote
3 answers
111 views

If given a generic interface of which generic is a reference to this generic interface itself, and this interface has a method with parameter as generic type. After implementing this interface with a ...
tankpow Kee's user avatar
2 votes
1 answer
155 views

I have an interface and a class in kotlin. For example, interface A and class B. I want to write a function or a class with generics that will accept as generic all types that are subclasses of both A ...
titovtima's user avatar
  • 111
0 votes
0 answers
46 views

I'm trying to make a generic snap carousel using ScrollView but stuck on over-scroll behavior of the ScrollView. When over-scrolled the re-calculation creates a jittered animation ripple. I want the ...
Yasha's user avatar
  • 96
3 votes
1 answer
64 views

In Kotlin, the removeAll extension function on MutableCollection with Iterable argument is defined as (see reference here): @IgnorableReturnValue fun <T> MutableCollection<in T>.removeAll( ...
John's user avatar
  • 125
3 votes
2 answers
168 views

I have a method that accepts a T generic argument. The T has the allows ref struct anti-constraint. Now I want to validate this argument, and in case of failure to include the value of the argument in ...
Theodor Zoulias's user avatar
1 vote
2 answers
170 views

I am very new to Rust. I want to have a type depend on a constant generic parameter in Rust. In C++, this can easily be achieved with some metaprogramming: template<std::size_t N> struct ...
Adel M.'s user avatar
  • 538
2 votes
1 answer
164 views

Go v1.22 added the ability to easily range from 0 to n-1: // Prints 0, 1, 2 on separate lines. for i := range 3 { fmt.Println(i) } However, it doesn't work as expected when the expression's type ...
Richard Hansen's user avatar
3 votes
1 answer
99 views

In Kotlin, the plusAssign (+=) operator function on MutableCollection with Array argument is defined as (see reference here): inline operator fun <T> MutableCollection<in T>.plusAssign( ...
John's user avatar
  • 125
0 votes
1 answer
124 views

Let's have 3 entities with the same base class for ID's: public class EntityBase { public int Id { get; set; } } public class Company : EntityBase { public string Brand { get; set; } public ...
Pavel Foltyn's user avatar

15 30 50 per page
1
2 3 4 5
3448