mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 20:06:28 +08:00
7f8b0fff54
* feat: add Swift codes for hash_collision article * refactor: extract common Pair * Update hash_map.md --------- Co-authored-by: Yudong Jin <krahets@163.com>
20 lines
400 B
Swift
20 lines
400 B
Swift
/**
|
|
* File: Pair.swift
|
|
* Created Time: 2023-06-28
|
|
* Author: nuomi1 (nuomi1@qq.com)
|
|
*/
|
|
|
|
/* 键值对 */
|
|
public class Pair: Equatable {
|
|
public var key: Int
|
|
public var val: String
|
|
|
|
public init(key: Int, val: String) {
|
|
self.key = key
|
|
self.val = val
|
|
}
|
|
|
|
public static func == (lhs: Pair, rhs: Pair) -> Bool {
|
|
lhs.key == rhs.key && lhs.val == rhs.val
|
|
}
|
|
}
|