Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Decapsulation
- 배열빈도수
- 도커
- SpringApplication
- 오름차순
- wan
- 포트포워딩 안될때
- 유니캐스트
- 백준
- 도커권한설정
- instancenotfoundexception
- jmx
- 배열최소값최대값
- 디비버
- 우분투
- dbeaver
- name=springapplication
- 포트포워딩
- 페이로드
- ubuntu
- 리눅스환경
- 네트워크모델
- docker
- javax.management.instancenotfoundexception: org.springframework.boot:type=admin
- 브로드캐스트
- 배열복사
- springboot
- 모래시계출력
- 리눅스계열
- 백준1946
Archives
- Today
- Total
다잘하고싶어
length, length(), size() 본문
함수 길이를 반환하는 데이터 타입
length | 배열 |
length() | 문자열 (String Object) |
size() | 컬렉션 프레임워크 타입 (ArrayList, ..) |
배열과 문자열은 immutable (불변의) 한 특징을 가진다.
그리고 모든 최상위 Collection의 하위 클래스는 mutable한 특징을 갖는다.
따라서 “length” 라는 것을 봤다면, 그건 constant(=immutable) 변수일 것이다.
이와 반대일 때 “size”를 볼 수 있다.
Immutable Object란 생성 후 변경불가능한 객체 를 의미한다.
대표적인 Immutable 클래스로는 String, Boolean, Integer, Float, Long 등이 있다.
REFERENCE :
Difference between size and length methods?
What is the difference between .size() and .length ? Is .size() only for arraylists and .length only for arrays?
stackoverflow.com
'알고리즘' 카테고리의 다른 글
백준 1946. 신입사원 (Comparator 를 사용하여 객체배열 오름차순) (0) | 2024.01.31 |
---|---|
[알고리즘] BFS 너비우선탐색 (0) | 2022.10.06 |
[알고리즘]BufferedReader 사용 (1) | 2022.10.06 |
[알고리즘] 빅오표기법(Big-O Notation), 시간복잡도, 공간복잡도 (0) | 2022.10.06 |
알고리즘 개념 공부 순서 (1) | 2022.09.21 |