1. 자료구조1) 스택2) 큐3) 우선순위 큐 2. 자료형1) StringBuffer2) String3) Array4) ArrayList5) HashSet6) HashMap7) LinkedList3. 형변환배열과 List 변환String에서 다른 자료형으로 변환하기다른 자료형에서 String으로 변환하기진법 변환Reverse4. Math5. 입출력6. 날짜 시간알고리즘
1. 자료구조
1) 스택
Stack<Integer> stack = new Stack<>();: 선언
push(): top에 삽입
pop(): top을 삭제&확인
peek(): top을 확인
2) 큐
Queue<Integer> queue = new LinkedList<Integer>();: 선언
add(): rear에 삽입
poll(): front를 삭제&확인
peek(): front를 확인
3) 우선순위 큐
PriorityQueue<Integer> pq = new PriorityQueue<>();: 선언
add(): rear에 삽입
remove(): front를 삭제&확인
java - 스택, 큐, ArrayDeque
java stack, queue, ArrayDeque
https://velog.io/@yuns8708/java-스택-큐-ArrayDeque

2. 자료형
1) StringBuffer
2) String
s.length()
string.charAt(), indexOf(), lastIndexOf(), length()
- indexOf(char ch, int fromIndex)
str.charAt(0)이면 첫 글자str.charAt(str.length()-1)이면 마지막 글자int findIndex = strValue.indexOf("Java", 10);10번째 위치부터 찾기
str1.equals(str2)
String s = “010-5360-4256”; String[] s = str.split(”-”);
String s = s.repeat(10);
- for(char c : skip.toCharArray())
- str.substring(0, index) + ch + str.substring(index+1);
- str.toUpperCase();
- Character.toUpperCase(’t);
- str.trim(); // 공백 제거
- 정규표현식
- * 참고 : 위와 같이 "\\" 처리 해줘야하는 문자들 **
"."(dot)을 기준으로 문자열을 나누고 싶다면
이렇게 사용하면된다.
물음표(?), 별(*), 더하기(+), 괄호( '(' , ')' ), 대괄호( '[' , ']' ), 중괄호( '{' , '}' )
- insert
3) Array
a.length
- 2차원 배열의 열 기준으로 오름차순 정렬
compare 메소드는 두 객체를 비교하고, 첫 번째 객체가 두 번째 객체보다 "작을 때" 음수를, "같을 때"는 0을, "클 때"는 양수를 반환해야 함
인자가 a, b일 때 a-b로 두면 a가 더 작을 때 음수가 되고 a를 앞에 두게 되어 오름차순 정렬이 되고,
b-a로 두면 a가 더 클 때 음수가 되고 a를 앞에 두게 되어 내림차순 정렬이 된다.
- array stream
- 도입 전
- 도입 후
4) ArrayList
al.size()
5) HashSet
6) HashMap
7) LinkedList
3. 형변환
배열과 List 변환
String에서 다른 자료형으로 변환하기
다른 자료형에서 String으로 변환하기
진법 변환
Reverse
4. Math
Math.pow(3,2)=3^2,Math.sqrt(9)=root(9)=3
- 반올림, 올림, 버림
Math.round(12.345*100)/100 // 12.35Math.ceil(12.345*100)/100 // 12.35Math.floor(12.345*100)/100 // 12.34
- Math.abs(-3.14)=3.14
5. 입출력
6. 날짜 시간
- String to LocalDate
- 덧셈뺄셈
알고리즘
- dfs, bfs, permutation
- TODO
2-2 자료구조 때 배운 그래프 자바로 링크드리스트로 구현과 배열로 구현 둘다 연습해보며 복습…… (완벽히 기억 나지 않아서 코테에서 낭패봤음 ㅠ)
스택/큐로 후위 연산 구현하는 것도 자바로 다시 해보기


