Files
hello-algo/ja/codes/swift/chapter_hashing/built_in_hash.swift
T
Yudong Jin d7b2277d2b Re-translate the Japanese version (#1871)
* Retranslate Japanese docs with GPT-5.4

* Retranslate Japanese code with GPT-5.4
2026-03-30 07:30:15 +08:00

38 lines
1.0 KiB
Swift

/**
* File: built_in_hash.swift
* Created Time: 2023-07-01
* Author: nuomi1 (nuomi1@qq.com)
*/
import utils
@main
enum BuiltInHash {
/* Driver Code */
static func main() {
let num = 3
let hashNum = num.hashValue
print("整数 \(num) のハッシュ値は \(hashNum)")
let bol = true
let hashBol = bol.hashValue
print("真偽値 \(bol) のハッシュ値は \(hashBol)")
let dec = 3.14159
let hashDec = dec.hashValue
print("小数 \(dec) のハッシュ値は \(hashDec)")
let str = "Hello アルゴリズム"
let hashStr = str.hashValue
print("文字列 \(str) のハッシュ値は \(hashStr)")
let arr = [AnyHashable(12836), AnyHashable("シャオハー")]
let hashTup = arr.hashValue
print("配列 \(arr) のハッシュ値は \(hashTup)")
let obj = ListNode(x: 0)
let hashObj = obj.hashValue
print("ノードオブジェクト \(obj) のハッシュ値は \(hashObj)")
}
}