Skip to content

Commit

Permalink
handle feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ntqdinh-axonivy committed Jul 31, 2024
1 parent cbac58d commit 0ac4b61
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

import static com.axonivy.market.constants.GitHubConstants.COMMON_IMAGES_FOLDER_NAME;

Expand Down Expand Up @@ -37,9 +40,13 @@ public enum NonStandardProduct {
private final boolean isVersionTagNumberOnly;
private final String pathToImageFolder;
private final String pathToProductFolder;
private static final Map<String, NonStandardProduct> NON_STANDARD_PRODUCT_MAP;

public static NonStandardProduct findById(String id) {
static {
NON_STANDARD_PRODUCT_MAP = Arrays.stream(NonStandardProduct.values()).collect(Collectors.toMap(NonStandardProduct::getId, Function.identity()));
}

return Arrays.stream(NonStandardProduct.values()).filter(product -> id.equalsIgnoreCase(product.getId())).findAny().orElse(DEFAULT);
public static NonStandardProduct findById(String id) {
return NON_STANDARD_PRODUCT_MAP.getOrDefault(id,DEFAULT);
}
}

0 comments on commit 0ac4b61

Please sign in to comment.