mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
24 lines
467 B
Swift
24 lines
467 B
Swift
import Foundation
|
|
|
|
public struct SimpleSet<T: Equatable> {
|
|
private var items: [T] = []
|
|
|
|
public init() {
|
|
}
|
|
|
|
public mutating func insert(_ item: T) {
|
|
if !self.contains(item) {
|
|
self.items.append(item)
|
|
}
|
|
}
|
|
|
|
public func contains(_ item: T) -> Bool {
|
|
for currentItem in self.items {
|
|
if currentItem == item {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
}
|