dreamworker

Untitled

Apr 28th, 2020
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. каждый раз при запросе в цикле бегать ?
  2.  
  3.  
  4.     public static CurrencyCode valueOf(int value) throws IllegalArgumentException {
  5.  
  6.         for (CurrencyCode currencyCode : values()) {
  7.             if (currencyCode.value == value) {
  8.                 return currencyCode;
  9.             }
  10.         }
  11.  
  12. = >
  13.  
  14.  
  15.  
  16. static Map<Integer, GrantType> ENUM_MAP = new HashMap<>();
  17.  
  18.     static {
  19.  
  20.         for(GrantType value : GrantType.values()) {
  21.             ENUM_MAP.put(value.value, value);
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment