티스토리 뷰

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


공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/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
글 보관함