This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrderedDictionary <K: Hashable, V> { | |
typealias Key = K | |
typealias Value = V | |
private final var dictionary = [K: V]() | |
private final var orderedKeys = [K]() | |
init() { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
operator postfix ^ {} | |
@postfix func ^ <T> (object: T?) -> T? { | |
#if DEBUG | |
println(object) | |
#endif | |
return object | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infix operator ||= {} | |
func ||= <T> (first: T?, second: T) -> T { | |
if let l = first { | |
return l | |
} | |
return second | |
} |
NewerOlder