SW개발/Java
자바 리스트 검색
개소왕
2018. 2. 1. 20:39
* indexOf
lst.indexOf(값);
- int 나 String 등의 리스트 상 위치 반환
- 객체는 주소값 으로 찾음
- 없으면 -1 을 반환
* BinarySearch
Collections.sort(lst2);
Collections.binarySearch(lst2, 값));
https://gs.saro.me/#!m=elec&jn=125
- 먼저 sort 가 필요
* CollectionUtils.select
http://flystone.tistory.com/196
https://stackoverflow.com/questions/13138990/how-to-search-in-a-list-of-java-object
- Apache commons-collection.jar 추가되어야 ...
https://stackoverflow.com/questions/13138990/how-to-search-in-a-list-of-java-object
* stream (Java 8 이상)
http://flystone.tistory.com/196
http://krksap.tistory.com/1021