본문 바로가기 메뉴 바로가기

InPro

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

InPro

검색하기 폼
  • 분류 전체보기 (232)
    • Programming (43)
      • ANDROID (5)
      • CSS (0)
      • HTML (1)
      • JAVA (12)
      • JAVASCRIPT (12)
      • JQUERY (5)
      • JSTL (0)
      • MYSQL (2)
      • PHP (1)
      • VUE (1)
    • 정보 (171)
    • 해몽 (15)
  • 방명록

자바 (4)
[Java] 자바 배열, 리스트 랜덤으로 섞기 random shuffle

자바 배열 리스트 랜덤으로 섞기 shuffle Collections의 shuffle을 이용해서 배열, 리스트를 섞는 방법입니다. public class Shuffle { public static void main(String[] args) { Integer[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; List numberList = Arrays.asList(numbers); // 기본값 System.out.println(Arrays.toString(numbers); Collections.shuffle(numberList); // 변경값 System.out.println(Arrays.toString(numbers); } } 결과 [1, 2, 3, 4, 5, 6, 7, 8, ..

Programming/JAVA 2022. 6. 22. 07:59
자바 Boolean 정렬 Boolean.compare

Boolean 정렬 Boolean.compare System.out.println(Boolean.compare(true, true); System.out.println(Boolean.compare(false, false); System.out.println(Boolean.compare(true, false); System.out.println(Boolean.compare(false, true); 결과 0 0 1 -1 Boolean.compare(x, y) x == y 인 경우 0을 리턴합니다. x가 true, y가 false면 -1를 리턴합니다. x가 false, y가 true면 1를 리턴합니다.

Programming/JAVA 2021. 4. 7. 18:01
자바 map 다중제거 Iterator

자바 map 다중제거 Iterator Map map = new HashMap(); map.put(1, 11); map.put(2, 22); // 1번 for (Iterator it = map.entrySet().iterator(); it.hasNext();) { Map.Entry entry = it.next(); if (entry.getKey() > 0) { // 제거 it.remove(); } } // 2번 map.entrySet().removeIf(e -> { return e.getKey() > 0; }); // 2번 요약 map.entrySet().removeIf(e -> e.getKey() > 0); // 3번 Iterator it = map.keySet().iterator(); while(it...

Programming/JAVA 2021. 4. 6. 18:58
[JAVA] 자바 정렬 Sort, Comparable

자바 정렬 (sort) 기본 Arrays.sort 를 이용해서 올림 및 내림차순 정렬을 할 수 있습니다. int[] intArray = new int[] { 3, 11, 7, 5, 6 } // 오름 차순 3 5 6 7 11 Arrays.sort(intArray); // 내림 차순 11 7 6 5 3 Arrays.sort(intArray, Collections.reverseOrder()); 객체정렬 Comparable에 compare를 이용해 정렬을 할 수 있습니다. 양수(+)를 리턴할 경우 : 1번이 앞에 위치 음수(-)를 리턴할 경우 : 2번이 앞에 위치 0을 리턴할 경우 : 동일한 값이기 때문에 입력 순서를 유지합니다. public class Item { private String name; priv..

Programming/JAVA 2021. 3. 29. 18:12
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • nginx Request Entity Too Large
  • 신한카드
  • 크린토피아 가격표
  • 자바
  • 자바 정렬
  • nginx client_max_body_size
  • 핸드폰
  • Java String 변환
  • 여권
  • 실업급여
  • Java Date 변환
  • nginx 파일 업로드 크기
  • 자바 LocalDateTime 변환
  • 구글
  • 우체국
  • 정렬
  • 안드로이드
  • 근로소득원천징수영수증 발급
  • 근로소득원천징수영수증 발급 방법
  • 휴면계좌
  • 국민연금
  • 아이폰
  • 자바 Date 변환
  • 근로소득원천징수영수증
  • 크린토피아
  • Javascript time to seconds
  • 자바 소수점
  • 자바 String 변환
  • 자바스크립트 time to seconds
  • Java LocalDateTime 변환
more
«   2025/05   »
일 월 화 수 목 금 토
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
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바