-
Notifications
You must be signed in to change notification settings - Fork 2
/
Array+Linq.swift
43 lines (42 loc) · 1.24 KB
/
Array+Linq.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Array+Linq.swift
// swiftlinq-test
//
// Created by Matt Bridges on 3/23/15.
// Copyright (c) 2015 Matt Bridges. All rights reserved.
//
extension Array {
func Select<U>(f: (T) -> U) -> SequenceOf<U> {
return SequenceOf(self).Select(f)
}
func Where(f: (T) -> Bool) -> SequenceOf<T> {
return SequenceOf(self).Where(f)
}
func Take(count: Int) -> SequenceOf<T> {
return SequenceOf(self).Take(count)
}
func TakeWhile(f: (T) -> Bool) -> SequenceOf<T> {
return SequenceOf(self).TakeWhile(f)
}
func TakeUntil(f: (T) -> Bool) -> SequenceOf<T> {
return SequenceOf(self).TakeUntil(f)
}
func Skip(count: Int) -> SequenceOf<T> {
return SequenceOf(self).Skip(count)
}
func SkipWhile(f: (T) -> Bool) -> SequenceOf<T> {
return SequenceOf(self).SkipWhile(f)
}
func SkipUntil(f: (T) -> Bool) -> SequenceOf<T> {
return SequenceOf(self).SkipUntil(f)
}
func Any(f: (T) -> Bool) -> Bool {
return SequenceOf(self).Any(f)
}
func All(f: (T) -> Bool) -> Bool {
return SequenceOf(self).All(f)
}
func OrderBy<TKey: Comparable>(f: (T) -> TKey) -> OrderedSequenceOf<T> {
return SequenceOf(self).OrderBy(f)
}
}