[JAVA] ArrayList List Null 체크 빈 값 체크 ~isEmpty()~(널 어레이 리스트)_empty _-list==null-++
0. List값이 NULL인지 체크하고 싶다.
1. list == null 비교 시 false return
2. 원인 return = []
3. List의 메소드 list.isEmpty()를 사용하여 비교
- list.isEmpty() = 값이 비어있으면 true return
4. 결론 : [list 널체크]
if(list == null) 대신 >> if(list.isEmpty()) 를 사용하면 된다.
댓글
댓글 쓰기