linkedSetOf
[Kotlin] HashSet
HashSet이란? Set은 중복을 허용하지 않는 자료구조로, 순서대로 입력되지 않고 일정하게 유지되지 않는게 특징이다. HashSet은 null 요소도 허용한다. 가장 큰 특징은 중복을 허용하지 않는 것. 중복을 걸러내는 과정 HashSet은 객체를 저장하기 전에 먼저 객체의 hashCode() 메소드를 호출하여 해시코드를 얻어 낸 다음 저장되어 있는 개체들의 해시 코드와 비교한 뒤 같은 해시 코드가 있다면 equals() 메소드로 두 객체를 비교하여 같은 객체라면 중복 저장을 하지 않는다. 예제 fun main() { val hashSet = hashSetOf(1,2,3,4,5) hashSet.add(-1) hashSet.add(0) hashSet.add(-3) print(hashSet) // [-1..
![[Kotlin] HashSet](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FcwO8Sh%2Fbtrj88eL6Yd%2FAAAAAAAAAAAAAAAAAAAAACrood_aD_fg7-LT3bNspTAAQfhQ0Sqdl3taw1ZhpUiq%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1761922799%26allow_ip%3D%26allow_referer%3D%26signature%3DOT%252FsiA8WyET7c0rWxwvAo2e7IBI%253D)