Array
struct Array<Element> : RandomAccessCollection, MutableCollection
-
Append iff
!self.contains(newElement)
Declaration
Swift
public mutating func appendIfUnique(_ newElement: Element)
Parameters
newElement
Element to possibly append
-
Appends each element iff
!self.contains(newElement)
Declaration
Swift
public mutating func appendUniqueContents(of newElements: [Element])
Parameters
newElements
Elements to possibly append
-
Returns an array of Elements not included in self
Declaration
Swift
public func uniqueContents(of newElements: [Element]) -> [Element]
Parameters
newElements
Elements to compare
Return Value
Array of unique elements
-
Returns count of unique elements
Declaration
Swift
public func uniqueCount(from newElements: [Element]) -> Int
Parameters
newElements
Elements to compare
Return Value
Count of uniques
-
Removes element if it exists in self
Declaration
Swift
public mutating func removeElement(_ element: Element)
Parameters
element
Element to remove
-
Safely subscripts an array, returning nil if index is out of bounds
Declaration
Swift
subscript (safe index: UInt) -> Element?
Parameters
index
-
Safely subscripts an array, returning nil if index is out of bounds
Declaration
Swift
subscript (safe index: Int) -> Element?
Parameters
index
-
Safely subscripts an array, returning nil if index is out of bounds
Declaration
Swift
func at(safe index: UInt) -> Element?
Parameters
index
-
Safely subscripts an array, returning nil if index is out of bounds
Declaration
Swift
func at(safe index: Int) -> Element?
Parameters
index