Relative Content

Tag Archive for collections

Injecting collections as constructor dependencies

We are using constructor dependency injection in our application. Following that approach we inject everything using an injection container so we are able to replace any dependency with a Mock.

Injecting collections as constructor dependencies

We are using constructor dependency injection in our application. Following that approach we inject everything using an injection container so we are able to replace any dependency with a Mock.

HashMap to replace Singletons?

Consider the following: I have controllers and views in a client-application. As this runs purely on the client side, each controller must only exist once.

Do we always need to override equals/hashcode when creating a new class?

When creating a new class, should we always override the equals and hashCode even if we don’t intent at that point to use the class with any Collection classes?
Or is it better to wait till such a need arises before overriding equals and hashCode so as to be sure on what the logical equality should be?