Timeline for How to eliminate repetition in three subclasses: each defines an identical method that does almost the same thing, but with a different return type
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 20 at 15:18 | comment | added | JimmyJames | This seemed like an obvious candidate for generics until I noticed that you are talking about arrays. Is the use of arrays an absolute requirement? Can you use a List instead? | |
Feb 20 at 13:12 | answer | added | gnasher729 | timeline score: 0 | |
Feb 20 at 12:15 | answer | added | user440873 | timeline score: 1 | |
Feb 20 at 11:13 | answer | added | k3b | timeline score: 1 | |
Feb 20 at 10:55 | comment | added | k3b |
It is much easier to answer this question if you provide some minimal (pseudo-) code that demonstrates the problem. Java uses generics to provide different results. For example java.util.List<E> has a method E get(int index) where <E> is the different returntype
|
|
Feb 19 at 18:26 | answer | added | Sebastian Sotto M. | timeline score: 2 | |
Feb 16 at 18:25 | history | edited | thatUserHOverThere | CC BY-SA 4.0 |
added 52 characters in body
|
Feb 16 at 17:04 | comment | added | Greg Burghardt | Can you edit your question to include more information about that consuming code? Are callers using the concrete types or the base types? | |
Feb 16 at 14:08 | comment | added | thatUserHOverThere | If I explained poorly or you need clarification please let me know! Thanks! | |
S Feb 16 at 14:08 | review | First questions | |||
Feb 16 at 14:58 | |||||
S Feb 16 at 14:08 | history | asked | thatUserHOverThere | CC BY-SA 4.0 |