mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 06:57:06 +00:00
Java: Optimize HashSet Initialization (#21205)
* Optimize HashSet Initialization Noticed this while debugging - we can avoid wasting memory/cpu creating 16 buckets when we only need one or a few. * generate samples * use Arrays.asList
This commit is contained in:
@@ -124,11 +124,10 @@ public class OneOf1 {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("message1");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("message1"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user