mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 18:07: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:
@@ -147,12 +147,10 @@ public class Bird {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("size");
|
||||
openapiFields.add("color");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("size", "color"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -147,12 +147,10 @@ public class Category {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("id");
|
||||
openapiFields.add("name");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("id", "name"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -179,15 +179,10 @@ public class DataQuery extends Query {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("id");
|
||||
openapiFields.add("outcomes");
|
||||
openapiFields.add("suffix");
|
||||
openapiFields.add("text");
|
||||
openapiFields.add("date");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("id", "outcomes", "suffix", "text", "date"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -428,18 +428,10 @@ public class DefaultValue {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("array_string_enum_ref_default");
|
||||
openapiFields.add("array_string_enum_default");
|
||||
openapiFields.add("array_string_default");
|
||||
openapiFields.add("array_integer_default");
|
||||
openapiFields.add("array_string");
|
||||
openapiFields.add("array_string_nullable");
|
||||
openapiFields.add("array_string_extension_nullable");
|
||||
openapiFields.add("string_nullable");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -176,13 +176,10 @@ public class NumberPropertiesOnly {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("number");
|
||||
openapiFields.add("float");
|
||||
openapiFields.add("double");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("number", "float", "double"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -325,18 +325,10 @@ public class Pet {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("id");
|
||||
openapiFields.add("name");
|
||||
openapiFields.add("category");
|
||||
openapiFields.add("photoUrls");
|
||||
openapiFields.add("tags");
|
||||
openapiFields.add("status");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("id", "name", "category", "photoUrls", "tags", "status"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields.add("name");
|
||||
openapiRequiredFields.add("photoUrls");
|
||||
openapiRequiredFields = new HashSet<String>(Arrays.asList("name", "photoUrls"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -211,12 +211,10 @@ public class Query {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("id");
|
||||
openapiFields.add("outcomes");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("id", "outcomes"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -147,12 +147,10 @@ public class Tag {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("id");
|
||||
openapiFields.add("name");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("id", "name"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -121,11 +121,10 @@ public class TestFormObjectMultipartRequestMarker {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("name");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("name"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -199,14 +199,10 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("size");
|
||||
openapiFields.add("color");
|
||||
openapiFields.add("id");
|
||||
openapiFields.add("name");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("size", "color", "id", "name"));
|
||||
|
||||
// a set of required properties/fields (JSON key names)
|
||||
openapiRequiredFields = new HashSet<String>();
|
||||
openapiRequiredFields = new HashSet<String>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -131,11 +131,10 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
|
||||
|
||||
static {
|
||||
// a set of all properties/fields (JSON key names)
|
||||
openapiFields = new HashSet<String>();
|
||||
openapiFields.add("values");
|
||||
openapiFields = new HashSet<String>(Arrays.asList("values"));
|
||||
|
||||
// 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