In Servlet API, the following API returns a Set:
(i) PushBuilder: public Set<String> getHeaderNames();
(ii) ServletContext: public Set<String> getResourcePaths(String path);
(iii) ServletContext: public Set<SessionTrackingMode> getDefaultSessionTrackingModes();
(iv) ServletContext: public Set<SessionTrackingMode> getEffectiveSessionTrackingModes();
(v) Registration: public Set<String> setInitParameters(Map<String, String> initParameters);
(vi) ServletRegistration: public Set<String> addMapping(String... urlPatterns);
(vii) ServletRegistration.Dynamic: public Set<String> setServletSecurity(ServletSecurityElement constraint);
For (i)-(iv), the returned set is from getter.
For (v)-(vii), the returned set is about conflicts.
The javadoc and spec does not mention the behavior of the returned Set.
For convenience, we will look at PushBuilder, (i) above, in the following wordings.
There are two options:
a) Backed:
The returned set is backed by the PushBuilder, so changes in the returned set
are reflected in the PushBuilder, and vice-versa.
b) NonBacked:
The returned set is not backed by the PushBuilder, so changes in the returned
set are not reflected in the PushBuilder, and vice-versa.
Please weigh in on this by close business Friday 24 March 2017.
In the absence of any discussion, we'll go with the "NonBacked” option for (i)-(vii) above.
Thanks.
Shing Wai Chan