Solutions
Multiplatform
Server-side
Data science
Android
Docs
Community
Teach
Play
Playground
Examples
Koans
toggle menu
Kotlin libraries
1.3
2.0
1.9
1.8
1.7
1.6
1.5
1.4
1.3
1.2
1.1
1.0
Common
switch theme
search in API
kotlin-stdlib
/
kotlin.collections
/
toHashSet
to
Hash
Set
fun
<
T
>
Array
<
out
T
>
.
toHashSet
(
)
:
HashSet
<
T
>
(
source
)
fun
ByteArray
.
toHashSet
(
)
:
HashSet
<
Byte
>
(
source
)
fun
ShortArray
.
toHashSet
(
)
:
HashSet
<
Short
>
(
source
)
fun
IntArray
.
toHashSet
(
)
:
HashSet
<
Int
>
(
source
)
fun
LongArray
.
toHashSet
(
)
:
HashSet
<
Long
>
(
source
)
fun
FloatArray
.
toHashSet
(
)
:
HashSet
<
Float
>
(
source
)
fun
DoubleArray
.
toHashSet
(
)
:
HashSet
<
Double
>
(
source
)
fun
BooleanArray
.
toHashSet
(
)
:
HashSet
<
Boolean
>
(
source
)
fun
CharArray
.
toHashSet
(
)
:
HashSet
<
Char
>
(
source
)
fun
<
T
>
Iterable
<
T
>
.
toHashSet
(
)
:
HashSet
<
T
>
(
source
)
Returns a new
HashSet
of all elements.
Since Kotlin
1.0
Thanks for your feedback!
Was this page helpful?
Yes
No
How can we improve?
Enter your name and email address if you would like to receive a follow-up message or
contact our support
.
By submitting this form, I agree that JetBrains s.r.o. ("JetBrains") may use my name, email address, phone number, and country of residence to provide support. I agree that JetBrains may process said data using
third-party services
for this purpose in accordance with the
JetBrains Privacy Policy
.