메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, Hadoop ecosystem, Semantic IoT등의 프로젝트를 진행중에 습득한 내용을 정리하는 곳입니다.
필요한 분을 위해서 공개하고 있습니다. 문의사항은 gooper@gooper.com로 메일을 보내주세요.


1. 정렬 수행

        // data를 담고 있는 List변수

List<Map<String, String>> list = new ArrayList<Map<String, String>>();

        // List에 담기는 Map변수

HashMap<String,String> row = new HashMap<String, String>;


// 정렬실행

Collections.sort(list, new MapStringComparator("rest_type"));

Collections.sort(list, new MapStringComparator("corner_id"));

Collections.sort(list, new MapFloatComparator("cnt"));


2. 정렬 클래스(문자열)

class MapStringComparator implements Comparator<Map<String, String>> {
		private final String key;
		
		public MapStringComparator(String key) {
			this.key = key;
		}
		
		@Override
		public int compare(Map<String, String> first, Map<String, String> second) {
			String firstValue =first.get(key);
	        String secondValue = second.get(key);
	        
	         // 내림차순 정렬
             return firstValue.compareTo(secondValue);
		}
	}


3. 정렬 클래스(숫자)

class MapFloatComparator implements Comparator<Map<String, String>> {
		private final String key;
		
		public MapFloatComparator(String key) {
			this.key = key;
		}
		
		@Override
		public int compare(Map<String, String> first, Map<String, String> second) {
			float firstValue = Float.valueOf(first.get(key));
	         float secondValue = Float.valueOf(second.get(key));
	         
			// 내림차순 정렬
	         if (firstValue > secondValue) {
	             return -1;
	         } else if (firstValue < secondValue) {
	             return 1;
	         } else /* if (firstValue == secondValue) */ {
	             return 0;
	         }
		}
	}


번호 제목 글쓴이 날짜 조회 수
641 vuestorefrontui.io를 이용한 front end project 생성하기 총관리자 2022.02.06 23
640 eclipse editor 설정방법 총관리자 2022.02.01 10
639 windows10 pro에서 microservice pattern책의 예제를 kubernetes에서 기동하는 방법 총관리자 2022.01.30 18
638 [백업] 리눅스 시스템 백업하기 (Linux System Backup) - TAR 사용 시스템 전체 백업 총관리자 2022.01.19 455
637 kudu rebalance수행 command예시 총관리자 2022.01.17 85
636 Kudu tablet이 FAILED일때 원인 확인 방법 총관리자 2022.01.17 90
635 Failed to write to server: (no server available): 총관리자 2022.01.17 32
634 Soft memory limit exceeded (at 100.05% of capacity) 오류 조치 총관리자 2022.01.17 181
633 not leader of this config: current role FOLLOWER 오류 발생시 확인방법 총관리자 2022.01.17 23
632 Oracle NLOB type의 데이터를 import하는 경우 No Java type for SQL type 2011 for column rst와 같은 오류 발생시 조치사항 총관리자 2022.01.14 35
631 kudu 테이블 metadata강제 삭제시 발생하는 오류 메세지 총관리자 2022.01.12 110
630 hadoop nfs gateway설정 (Cloudera 6.3.4, CentOS 7.4 환경에서) 총관리자 2022.01.07 132
629 oracle 12에 sqoop해서 데이터 import하기 (console에서 sqoop import하는 방법) 총관리자 2021.12.31 55
628 python2.7.4에서 Oracle DB(11.2)를 사용하기 위한 설정(RPM을 이용하여 RHEL 7.4에 설치) 총관리자 2021.11.26 343
627 클러스터내의 전체 workflow및 coordinator현황을 사용자별로 추출하는 방법 총관리자 2021.11.25 25
626 hue.axes_accessattempt테이블의 username컬럼에 NULL 혹은 space가 들어갈수도 있음. 총관리자 2021.11.03 2838
625 Query Status: Sender xxx.xxx.xxx.xxx timed out waiting for receiver fragment instance: 1234:cdsf, dest node: 10 의 오류 원인및 대응방안 총관리자 2021.11.03 77
624 hive metastore db중 TBLS, TABLE_PARAMS테이블 설명 총관리자 2021.10.22 260
623 kudu hms check 사용법(예시) 총관리자 2021.10.22 69
622 Hue Load Balancer를 L4로 L/B하는 경우는 L4쪽 도멘인으로 발행된 인증서를 TLS/SSL항목에 설정해주어야 한다. 총관리자 2021.10.08 104

A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로