Skip to content

Instantly share code, notes, and snippets.

@WeZZard
Last active August 29, 2015 14:12
Show Gist options
  • Save WeZZard/51c3fe66d639c885340a to your computer and use it in GitHub Desktop.
Save WeZZard/51c3fe66d639c885340a to your computer and use it in GitHub Desktop.
Remove duplicate items in a ExtensibleCollectionType conformed collection object
public func removeDuplicates<C: ExtensibleCollectionType where C.Generator.Element : Equatable>(aCollection: C) -> C {
var container = C()
for element in aCollection {
if !contains(container, element) {
container.append(element)
}
}
return container
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment