|
|
|
|
|
by didntcheck
1073 days ago
|
|
But why is it a problem (assuming the database in this example can handle any type)? If I'm writing a function that returns the 5th element of a list, I will always write that using generics, even if I know it's only used with one type (right now). Not only is it basically free (`<T> T getFifth(List<T>)` is really not any more complicated than `Foo getFifth(List<Foo>)`), it's also a separation of concerns. The logic is just about the container, so no need to complicate it with a "red herring" of a forced type |
|