일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 코딩테스트 고득점 Kit
- 코딩테스트 고득점 Kit 완전탐색
- Java
- 데이터모델링과마이닝
- React JS
- react firebase
- useState
- NextJS
- 자바
- 컴퓨터 네트워크
- websocket
- 프로그래머스
- useEffect
- 장고
- codesandbox
- design pattern
- 백준
- 자바 공부
- 프로그래머스 자바
- 자바스크립트
- 리액트
- vanillaJS
- 코틀린
- 프로그래밍 언어론
- 프로그래머스 완전탐색
- JavaScript
- react hook
- 리액트 훅
- 디자인 패턴
- react
- Today
- Total
목록자바 공부 (11)
기록하는 개발자

Map map = new HashMap(); map의 String형 keySet을 list로 저장 List keySetList = new ArrayList(map .keySet()); value값에 따라 정렬 오름차순 Collections.sort(keySetList, (o1, o2) -> (temp.get(o1).compareTo(temp.get(o2)))); 내림차순 Collections.sort(keySetList, (o1, o2) -> (temp.get(o2).compareTo(temp.get(o1))));

문자 → 숫자 : int num = (int)c ; 숫자 → 문자 : char c=(char)num ;

PriorityQueue heap = new PriorityQueue(); heap.offer(value) : queue에 value 추가 heap.peek() : queue의 첫 번째 요소 반환 heap.poll() : queue의 첫 번째 요소를 삭제하고 반환. queue가 비어있는 경우 null 반환 heap.remove() : 큐의 첫 번째 값 제거 heap.clear() : 큐 초기화

제곱근 구하기 double result = Math.sqrt(25); // 5.0 거듭제곱 구하기 double result = Math.pow(5, 2); // 5*5

arraylist 정렬 import java.util.Collections; ArrayList arraylist = new ArrayList(); Collections.sort(arraylist); 배열 정렬 import java.util.Arrays; int[] intArray = {5,1,4,2,6,3,7}; Arrays.sort(intArray); // intArray ={1,2,3,4,5,6,7}

string을 정수로 변환 String StoN = "100"; int temp=Integer.parseInt(StoN); // temp = 10 정수를 string으로 변환 int num = 10; String numericStr1 = String.valueOf(num); String numericStr2 = Integer.toString(num); char형을 string으로 변환 char myChar = 'c'; String charToString = String.valueOf(myChar); // charToString = "c"

ArrayList() arraylist = new ArrayList(); int[] intArray = {1, 2, 3, 4, 5}; integer list를 int 배열로 int[] answer = arraylist.stream().mapToInt(Integer::intValue).toArray(); int 형 배열을 integer list로 ArrayList() list = Arrays.asList(intArray);