Skip to content

Commit 0490426

Browse files
committed
Make count type UInt
1 parent 6fda1b7 commit 0490426

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Multiset/Multiset.playground/Sources/Multiset.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import Foundation
99

1010
public struct Multiset<Element: Hashable> {
11-
fileprivate var storage: [Element: Int]
12-
private var _count = 0
11+
fileprivate var storage: [Element: UInt]
12+
private var _count: UInt = 0
1313

1414
public init() {
1515
storage = [:]
@@ -45,16 +45,16 @@ public struct Multiset<Element: Hashable> {
4545
return true
4646
}
4747

48-
public var count: Int {
48+
public var count: UInt {
4949
return _count
5050
}
5151

52-
public func count(for key: Element) -> Int {
52+
public func count(for key: Element) -> UInt {
5353
return storage[key] ?? 0
5454
}
5555

5656
public var allItems: [Element] {
57-
var result = Array<Element>()
57+
var result = [Element]()
5858
for (key, count) in storage {
5959
for _ in 0 ..< count {
6060
result.append(key)

0 commit comments

Comments
 (0)