Iterate over the "entrySet" instead of the "keySet". Map에 있는 키 값을 꺼내서 루프를 돌리는데 만약 key값 이외 value도 필요하다며 keySet을 사용하지 말고 entrySet을 사용하라. "entrySet()" should be iterated when both the key and value are needed (squid:S2864) Code smell Major When only the keys from a map are needed in a loop, iterating the keySet makes sense. But when both the key and the value are needed, it's more efficient to iter..
Object를 일반적인 방법으로 복제를 하는 경우 문제가 발생할 수 있습니다. 아래 예제를 통해 확인해 보겠습니다. 테스트 코드 public class TestClone { public static void main(String[] args) { User user1 = new User("test1"); User cUser1 = (User)user1.clone(); cUser1.setName("test2"); System.out.println(user1.toString()); System.out.println(cUser1.toString()); } public static class User implements Cloneable, Serializable{ private String name; private..
검출 메시지 The type of the "map" object should be an interface such as "Map" rather than the implementation "HashMap".List, Set, Map 사용 시 자주 실수하는 내용 중 하나입니다. 심지어 List가 인터페이스인 줄도 모르는 개발자가 많습니다. 왜 인터페이스를 사용해야 하는지를 모르면서 습관처럼 만들고 사용합니다. 왜 그러해야하는가에 대한 것을 공부하고 좋은 습관을 만드는게 중요한거 같습니다. 잘못 사용 되는 예ArrayList list = new ArrayList();HashMap map = new HashMap();HashSet set = new HashSet(); public void test(HashMap..
- Total
- Today
- Yesterday
- AG-GRID
- java
- 메시지
- SHEETJS
- UI
- 엑셀
- RESTful
- 타임리프
- 설정
- Spring Boot
- 샘플
- mapToList
- cache
- 스프링부트
- 예제
- 그리드
- spring
- lombok
- listToMap
- springboot
- ag grid
- mybatis
- sample
- oracle
- 스프링
- Javascript
- example
- REST
- thymeleaf
- restful서비스
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |