Skip to content

Extension private field in java

I read the Spring Data source and meet a question: JdbcTemplate has a method: and I find that this.dataSource is from it`s father class JdbcAccessor.declearing as follow my question is: why extension class JdbcTemplate can access its father class`s private field? I try to use it as follow and find IDE show it…

Power set of an input set as custom collection

I have been reading the Effective Java book and I have stuck with this code I am unable to understand how this code is generating power set. Code: Output: Can someone explain how this code is generating powerset of a given set. Answer The code uses the binary representation of the index number as a map of whi…

Controller Endpoint Naming Convention

I have a controller endpoint and I need help with the naming convention. Basically, the endpoint is supposed to find a customer by their Id/Email (which is sent in the url of the request). Thus I need to have two endpoints, one for users/{id} and one for users/{email}. The issue is, the above wouldn’t w…