|
Duplicate :
|
java.net.http.HttpHeaders1 is an implementation class but was made public by mistake. Also, the current implementation approach is not thread safe.
A better approach might be to define a new class
class HttpHeadersUnmodifiable implements HttpHeaders {
HttpHeadersUnmodifiable(HttpHeadersImpl ) {}
}
The class should use final fields and the constructor above should populate these fields guaranteeing thread safety.
|