Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
Advice
0 votes
4 replies
85 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
133 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
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
1 vote
1 answer
109 views

I have created a custom spinner in Java for Android and my class uses generics as such public class TLPSpinner<T> { I have an event that fires when a object is selected and if instantiate the ...
Rich Morey's user avatar
1 vote
0 answers
97 views

Is it possible to Java to model a (generic) interface that defines a method that is required to return a generic type that is required to be of a certain raw class? I want to model a container-like ...
knittl's user avatar
  • 270k
4 votes
2 answers
214 views

I am working on a small side project that uses a very simple command handler pattern for dispatching command classes to handler classes. I come from a C# background, and am running into an issue with ...
rob's user avatar
  • 1,226
0 votes
1 answer
117 views

With the deprecation of MappingJacksonValue in spring boot 4/Jackson 3, I'm trying to figure out how to serialize my objects based on a JsonView. I have the following SSE endpoint : @GetMapping(...
Mathis Dousse's user avatar
1 vote
0 answers
126 views

I am trying to create a custom generic repository using the fragment interface approach as described in this article: https://docs.spring.io/spring-data/jpa/reference/repositories/custom-...
Sidharth Bajpai's user avatar
Advice
0 votes
4 replies
72 views

Oracle documentation mentioned it clearly. a lower bounded wildcard restricts the unknown type to be a specific type or a super type of that type. To write the method that works on lists of Integer ...
Melad Basilius's user avatar
3 votes
3 answers
156 views

The following test renders fine in my IDE (Eclipse), but fails to compile when building via Maven. The compiler error is shown in the comment line in the code block below. It looks like the compiler ...
Kevin Day's user avatar
  • 16.6k
1 vote
0 answers
141 views

I am implementing an ordered list that automatically inserts elements in the correct sorted position using a Comparator. The list is built from scratch (not using java.util.ArrayList) and uses an ...
Raam's user avatar
  • 11
-3 votes
3 answers
267 views

I’m trying to implement a generic utility method that takes a String value and a Class<?> type, and returns an instance of that type. The context: This value represents data from a JPA column, ...
David Todorov's user avatar
3 votes
2 answers
123 views

I am working on a Spring Boot application and there I use JWE - tokens. When generating these tokens I serialize a given DTO. As an example, the generation of an AccessToken looks like this: public ...
LaggyLogic's user avatar
9 votes
2 answers
204 views

Why does the following cause a compilation error? One Map<Integer, Integer> map = new HashMap<>(); List<Integer> numList = map.entrySet().stream() .sorted(Comparator....
Joshua's user avatar
  • 93
2 votes
3 answers
201 views

I’m trying to understand the difference between assignment and casting in Java generics. Consider the following examples: List<Integer> ints = new ArrayList<>(); List<Number> nums = ...
AMZ's user avatar
  • 452

15 30 50 per page
1
2 3 4 5
1210