CollectionType

protocol CollectionType : Indexable, SequenceType

Returns a tuple of the prefix and suffix of self, the first element being the prefix up to n.

  • Returns a tuple of the prefix and suffix of self, the first element being the prefix up to n.

    Declaration

    Swift

    public func breakAt(n: Index) -> (SubSequence, SubSequence)
  • Returns a tuple of the prefix and suffix of self, the first element being the prefix up to n.

    Declaration

    Swift

    public func breakAt(n: Int) -> (SubSequence, SubSequence)
  • Returns a tuple of the prefix and suffix of self, the first element being the prefix up to the first elements of self which returns true for isBreak.

    Declaration

    Swift

    public func breakAt(@noescape isBreak: Generator.Element throws -> Bool) rethrows -> (SubSequence, SubSequence)
  • Returns the last element in self that satisfies a predicate, or nil if it doesn’t exist

    Declaration

    Swift

    func last(@noescape predicate: Generator.Element throws -> Bool) rethrows -> Generator.Element?
  • Returns the index of the final element in self which satisfies isElement, or nil if it doesn’t exist.

    Declaration

    Swift

    func lastIndexOf(@noescape isElement: Generator.Element throws -> Bool) rethrows -> Index?
  • Returns an array with n elements of self hopped over. The sequence includes the first element of self. “`swift [1, 2, 3, 4, 5, 6, 7, 8].hop(2)

    [1, 3, 5, 7] ”`

    Declaration

    Swift

    public func hop(n: Index.Stride) -> [Generator.Element]
  • Returns an array with n elements of self hopped over. The sequence includes the first element of self. “`swift [1, 2, 3, 4, 5, 6, 7, 8].hop(2)

    [1, 3, 5, 7] ”`

    Declaration

    Swift

    public func hop(n: Int) -> [Generator.Element]
  • Returns an array of n cycles of self. “`swift [1, 2, 3].cycle(2)

    [1, 2, 3, 1, 2, 3] ”`

    Declaration

    Swift

    func cycle(n: Int) -> [Generator.Element]