Skip to content

Commit ffb8e48

Browse files
committed
* descriptions refactoring
1 parent cabc583 commit ffb8e48

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

Sources/RedBlackTree.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,7 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
7575
- returns: String
7676
*/
7777
public var description: String {
78-
var output = "["
79-
let l = count - 1
80-
for i in 0..<count {
81-
output += "\(self[i])"
82-
if i != l {
83-
output += ", "
84-
}
85-
}
86-
return output + "]"
78+
return "[" + map { "\($0)" }.joined(separator: ", ") + "]"
8779
}
8880

8981
/**

Sources/SortedMultiSet.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,7 @@ public struct SortedMultiSet<T: Comparable>: Probable, Collection, Equatable, Cu
7272
- returns: String
7373
*/
7474
public var description: String {
75-
var output = "["
76-
let l = count - 1
77-
for i in 0..<count {
78-
output += "\(self[i])"
79-
if i != l {
80-
output += ", "
81-
}
82-
}
83-
return output + "]"
75+
return "[" + map { "\($0)" }.joined(separator: ", ") + "]"
8476
}
8577

8678
/**

0 commit comments

Comments
 (0)