use pre-sized maps for fixed-size payloads
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -40,7 +40,7 @@ public final class AppRoleResponse extends VaultDataResponse {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
/* null empty strings on list objects */
|
||||
Map<String, Object> filteredData = new HashMap<>();
|
||||
Map<String, Object> filteredData = new HashMap<>(data.size(), 1);
|
||||
data.forEach((k, v) -> {
|
||||
if (!(v instanceof String && ((String) v).isEmpty())) {
|
||||
filteredData.put(k, v);
|
||||
|
@@ -40,7 +40,7 @@ public final class AppRoleSecretResponse extends VaultDataResponse {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
/* null empty strings on list objects */
|
||||
Map<String, Object> filteredData = new HashMap<>();
|
||||
Map<String, Object> filteredData = new HashMap<>(data.size(), 1);
|
||||
data.forEach((k, v) -> {
|
||||
if (!(v instanceof String && ((String) v).isEmpty())) {
|
||||
filteredData.put(k, v);
|
||||
|
@@ -22,7 +22,7 @@ import de.stklcode.jvault.connector.exception.InvalidResponseException;
|
||||
import de.stklcode.jvault.connector.model.response.embedded.VersionMetadata;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public class SecretResponse extends VaultDataResponse {
|
||||
*/
|
||||
public final Map<String, Object> getData() {
|
||||
if (data == null) {
|
||||
return new HashMap<>();
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
Reference in New Issue
Block a user