/
index.d.ts
2555 lines (2271 loc) · 131 KB
/
index.d.ts
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// noinspection JSUnusedGlobalSymbols,JSValidateJSDoc
// tslint:disable:max-classes-per-file
// tslint:disable:no-namespace
// tslint:disable:ban-types
// tslint:disable:member-ordering
// tslint:disable:unified-signatures
declare module '2a' {
export import Lz = twoa.Lz;
export import BinarySearch = twoa.BinarySearch;
export import Comparator = twoa.Comparator;
export import SortedMap = twoa.SortedMap;
export import StringBuilder = twoa.StringBuilder;
export import FilenameUtils = twoa.FilenameUtils;
}
declare module '2a/geometry' {
export import BoundingBox = twoa.geometry.BoundingBox;
export import BoundingSphere = twoa.geometry.BoundingSphere;
export import Matrix = twoa.geometry.Matrix;
export import Quaternion = twoa.geometry.Quaternion;
export import Vector3 = twoa.geometry.Vector3;
}
declare module '2a/client' {
export import bodyParam = twoa.client.bodyParam;
export import client = twoa.client.client;
export import mapping = twoa.client.mapping;
export import headerParam = twoa.client.headerParam;
export import pathParam = twoa.client.pathParam;
export import formParam = twoa.client.formParam;
export import queryParam = twoa.client.queryParam;
export import init = twoa.client.init;
export import HttpMethod = twoa.client.HttpMethod;
}
declare module '2a/di' {
export import Application = twoa.di.Application;
export import autowire = twoa.di.autowire;
export import inject = twoa.di.inject;
export import service = twoa.di.service;
}
declare module '2a/scheduling' {
export import scheduled = twoa.scheduling.scheduled;
export import enableScheduling = twoa.scheduling.enableScheduling;
export import disableScheduling = twoa.scheduling.disableScheduling;
export import interval = twoa.scheduling.interval;
}
declare module '2a/util' {
export import Color = twoa.util.Color;
export import MathHelper = twoa.util.MathHelper;
export import NamesGenerator = twoa.util.NamesGenerator;
export import TextMatching = twoa.util.TextMatching;
export import createUrl = twoa.util.createUrl;
export import downloadFile = twoa.util.downloadFile;
export import blobToObject = twoa.util.blobToObject;
export import blobToString = twoa.util.blobToString;
export import uuid = twoa.util.uuid;
}
declare namespace twoa {
export type LzIterable<T> = IterableIterator<T> | T[];
export type ComparatorFunction<T> = (a: T, b: T) => number;
export type IdentityFunction<T> = (item: T) => T;
export type PredicateFunction<T> = (item: T, index: number) => boolean;
export type SelectorFunction<T, U> = (item: T, index: number) => U;
export type SelectorFunctionNoIndex<T, U> = (item: T) => U;
export type AccumulatorFunction<T, U> = (accumulator: U, item: T, index: number) => U;
export type Action<T> = SelectorFunction<T, void>;
export class BinarySearch {
public static find<T>(source: T[], index: number, length: number, item: T, comparator?: (a: T, b: T) => number): number;
}
export class Comparator {
public static defaultComparator<T>(a: T, b: T): number;
public static comparing<T, U>(selector: SelectorFunctionNoIndex<T, U> | keyof T): ComparatorFunction<T>;
public static selector<T, U>(selector: keyof T): SelectorFunctionNoIndex<T, U>;
}
export class Lz<T> implements IterableIterator<T> {
public static identityFunction<T>(item: T): T;
/**
* Returns the input typed as LzIterable<T>.
* @returns {IterableIterator<T>} The input sequence typed as LzIterable<T>.
*/
public toIterable(): Lz<T>;
/**
* Returns the input typed as LzIterable<T>.
* @param {LzIterable<T>} source The sequence to type as LzIterable<T>.
* @returns {IterableIterator<T>} The input sequence typed as LzIterable<T>.
*/
public static toIterable<T>(source: LzIterable<T>): Lz<T>;
/**
* Appends a value to the end of the sequence.
* @param {T[]} elements The value(s) to append to source.
* @returns {Lz<T>} A new sequence that ends with element.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public append(...elements: T[]): Lz<T>;
/**
* Appends a value to the end of the sequence.
* @param {LzIterable<T>} source A sequence of values.
* @param {T[]} elements The value(s) to append to source.
* @returns {Lz<T>} A new sequence that ends with element.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static append<T>(source: LzIterable<T>, ...elements: T[]): Lz<T>;
/**
* Adds a value to the beginning of the sequence.
* @param {T[]} elements The value(s) to prepend to <i>source</i>.
* @returns {Lz<T>} A new sequence that begins with <i>element</i>.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public prepend(...elements: T[]): Lz<T>;
/**
* Adds a value to the beginning of the sequence.
* @param {LzIterable<T>} source A sequence of values.
* @param {T[]} elements The value(s) to prepend to <i>source</i>.
* @returns {Lz<T>} A new sequence that begins with <i>element</i>.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static prepend<T>(source: LzIterable<T>, ...elements: T[]): Lz<T>;
/**
* Concatenates two sequences.
* @param {LzIterable<T>} second The sequence to concatenate to the first sequence.
* @returns {Lz<T>} A sequence that contains the concatenated elements of the two input sequences.
*/
public concat(second: LzIterable<T>): Lz<T>;
/**
* Returns the elements of the specified sequence or the specified value as a singleton collection if the
* sequence is empty.
* @param {T} defaultValue The value to return if the sequence is empty.
* @returns {Lz<T>} A sequence that contains <i>defaultValue</i> if <i>source</i> is empty; otherwise,
* <i>source</i>
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public defaultIfEmpty(defaultValue: T): Lz<T>;
/**
* Returns the elements of the specified sequence or the specified value as a singleton collection if the sequence
* is empty.
* @param {LzIterable<T>} source The sequence to return the specified value for if it is empty.
* @param {T} defaultValue The value to return if the sequence is empty.
* @returns {Lz<T>} A sequence that contains <i>defaultValue</i> if <i>source</i> is empty; otherwise,
* <i>source</i>.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static defaultIfEmpty<T>(source: LzIterable<T>, defaultValue: T): Lz<T>;
/**
* Produces the symmetrical set difference of two sequences by using the specified <i>ComparatorFunction<T></i> to
* compare values.
* @param {LzIterable<T>} second A sequence whose elements that also occur in the first sequence will
* cause those elements to be removed from the returned sequence.
* @param {ComparatorFunction<T>} comparator Optional. A ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains the symmetrical set difference of the elements of two sequences.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public disjunctive(second: LzIterable<T>, comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Produces the symmetrical set difference of two sequences by using the specified <i>ComparatorFunction<T></i> to
* compare values.
* @param {LzIterable<T>} first A sequence whose elements that also occur in the second sequence will
* cause those elements to be removed from the returned sequence.
* @param {LzIterable<T>} second A sequence whose elements that also occur in the first sequence will
* cause those elements to be removed from the returned sequence.
* @param {ComparatorFunction<T>} comparator Optional. A ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains the symmetrical set difference of the elements of two sequences.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static disjunctive<T>(first: LzIterable<T>, second: LzIterable<T>, comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Returns distinct elements from a sequence by using a specified ComparatorFunction<T> to compare values.
* @param {ComparatorFunction<T>} comparator Optional. A ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains distinct elements from the source sequence.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public distinct(comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Returns distinct elements from a sequence by using a specified ComparatorFunction<T> to compare values.
* @param {LzIterable<T>} source The sequence to remove duplicate elements from.
* @param {ComparatorFunction<T>} comparator Optional. A ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains distinct elements from the source sequence.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static distinct<T>(source: LzIterable<T>, comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Returns an empty sequence that has the specified type argument.
* @returns {Lz<T>} An empty sequence whose type argument is <i>T</i>.
*/
public static empty<T>(): Lz<T>;
/**
* Produces the set difference of two sequences by using the specified <i>ComparatorFunction<T></i> to compare
* values.
* @param {LzIterable<T>} second A sequence whose elements that also occur in the first sequence will
* cause those elements to be removed from the returned sequence.
* @param {ComparatorFunction<T>} comparator Optional. A ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains the set difference of the elements of two sequences.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public except(second: LzIterable<T>, comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Produces the set difference of two sequences by using the specified <i>ComparatorFunction<T></i> to compare
* values.
* @param {LzIterable<T>} first A sequence whose elements that are not also in <i>second</i> will be
* returned.
* @param {LzIterable<T>} second A sequence whose elements that also occur in the first sequence will
* cause those elements to be removed from the returned sequence.
* @param {ComparatorFunction<T>} comparator Optional. A ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains the set difference of the elements of two sequences.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static except<T>(first: LzIterable<T>, second: LzIterable<T>,
comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Performs the specified action on each element of the sequence.
* @param {Action<T>>} action The action delegate to perform on each element of the sequence.
*/
public forEach(action: Action<T>): void;
/**
* Performs the specified action on each element of the sequence.
* @param {LzIterable<T>} source The sequence whose elements to perform the specified action on.
* @param {Action<T>>} action The action delegate to perform on each element of the sequence.
*/
public static forEach<T>(source: LzIterable<T>, action: Action<T>): void;
/**
* Inserts a value into the source sequence at the specified index.
* @param {T} element The value to insert to <i>source</i>.
* @param {number} index The index at which to insert <i>element</i>.
* @returns {Lz<T>} A new sequence that contains <i>element</i> at <i>index</i>.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public insert(element: T, index: number): Lz<T>;
/**
* Inserts a value into the source sequence at the specified index.
* @param {LzIterable<T>} source The sequence to remove duplicate elements from.
* @param {T} element The value to insert to <i>source</i>.
* @param {number} index The index at which to insert <i>element</i>.
* @returns {Lz<T>} A new sequence that contains <i>element</i> at <i>index</i>.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static insert<T>(source: LzIterable<T>, element: T, index: number): Lz<T>;
/**
* Produces the set intersection of two sequences.
* @param {LzIterable<T>} second A sequence whose distinct elements that also appear in the first sequence will be returned.
* @param {ComparatorFunction<T>} comparator A ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains the elements that form the set intersection of two sequences.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public intersect(second: LzIterable<T>, comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Produces the set intersection of two sequences.
* @param {LzIterable<T>} first A sequence whose distinct elements that also appear in <i>second</i>
* will be returned.
* @param {LzIterable<T>} second A sequence whose distinct elements that also appear in the first sequence will be returned.
* @param {ComparatorFunction<T>} comparator A ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains the elements that form the set intersection of two sequences.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static intersect<T>(first: LzIterable<T>, second: LzIterable<T>,
comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Correlates the elements of two sequences based on matching keys.
* @param {IterableIterator<T2> | T2[]} inner The sequence to join to the first sequence.
* @param {SelectorFunction<T, K>} outerKeySelector A function to extract the join key from each element of the first sequence.
* @param {SelectorFunction<T2, K>} innerKeySelector A function to extract the join key from each element of the second sequence.
* @param {(a: T, b: T2) => U} resultSelector A function to create a result element from two matching elements.
* @returns {Lz<U>} A sequence that has elements of type <i>U</i> that are obtained by performing an inner
* join on two sequences.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public join<T2, K, U>(inner: IterableIterator<T2> | T2[],
outerKeySelector: SelectorFunction<T, K>,
innerKeySelector: SelectorFunction<T2, K>,
resultSelector: (a: T, b: T2) => U): Lz<U>;
/**
* Correlates the elements of two sequences based on matching keys.
* @param {IterableIterator<T1> | T1[]} outer The first sequence to join.
* @param {IterableIterator<T2> | T2[]} inner The sequence to join to the first sequence.
* @param {SelectorFunction<T1, K>} outerKeySelector A function to extract the join key from each element of the first sequence.
* @param {SelectorFunction<T2, K>} innerKeySelector A function to extract the join key from each element of the second sequence.
* @param {(a: T1, b: T2) => U} resultSelector A function to create a result element from two matching elements.
* @returns {Lz<U>} A sequence that has elements of type <i>U</i> that are obtained by performing an inner
* join on two sequences.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static join<T1, T2, K, U>(outer: IterableIterator<T1> | T1[], inner: IterableIterator<T2> | T2[],
outerKeySelector: SelectorFunction<T1, K>,
innerKeySelector: SelectorFunction<T2, K>,
resultSelector: (a: T1, b: T2) => U): Lz<U>;
/**
* Returns the last element of a sequence.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {T} The value at the last position in the source sequence.
* @throws If the source sequence contains no elements or the predicate did not match any elements.
*/
public last(predicate?: PredicateFunction<T>): T;
/**
* Returns the last element of a sequence.
* @param {LzIterable<T>} source A sequence to return the last element of.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {T} The value at the last position in the source sequence.
* @throws If the source sequence contains no elements or the predicate did not match any elements.
*/
public static last<T>(source: LzIterable<T>, predicate?: PredicateFunction<T>): T;
/**
* Returns the last element of a sequence, or a default value if no element is found.
* @param {T} defaultValue The default value.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {T} The value at the last position in the source sequence.
*/
public lastOrDefault(defaultValue: T, predicate?: PredicateFunction<T>): T;
/**
* Returns the last element of a sequence, or a default value if no element is found.
* @param {LzIterable<T>} source A sequence to return the last element of.
* @param {T} defaultValue The default value.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {T} The value at the last position in the source sequence.
*/
public static lastOrDefault<T>(source: LzIterable<T>, defaultValue: T,
predicate?: PredicateFunction<T>): T;
/**
* Sorts the elements of a sequence in ascending order according to a key.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @returns {LzOrdered<T, V>} A sequence whose elements are sorted according to a key.
*/
public orderBy<V>(selector: SelectorFunctionNoIndex<T, V>): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in ascending or descending order according to a key.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @param {boolean} descending Whether to sort in descending order rather than ascending.
* @returns {Lz<T>} A sequence whose elements are sorted according to a key.
*/
public orderBy<V>(selector: SelectorFunctionNoIndex<T, V>, descending: boolean): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in ascending order by using a specified comparator.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @param {ComparatorFunction<V>} comparator A ComparatorFunction<V> to compare keys.
* @returns {LzOrdered<T, V>} A sequence whose elements are sorted according to a key.
*/
public orderBy<V>(selector: SelectorFunctionNoIndex<T, V>, comparator: ComparatorFunction<V>): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in ascending or descending order by using a specified comparator.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @param {ComparatorFunction<V>} comparator A ComparatorFunction<V> to compare keys.
* @param {boolean} descending Whether to sort in descending order rather than ascending.
* @returns {Lz<T>} A sequence whose elements are sorted according to a key.
*/
public orderBy<V>(selector: SelectorFunctionNoIndex<T, V>, comparator: ComparatorFunction<V>, descending: boolean): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in ascending order according to a key.
* @param {LzIterable<T>} source A sequence of values to order.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @returns {LzOrdered<T, V>} A sequence whose elements are sorted according to a key.
*/
public static orderBy<T, V>(source: LzIterable<T>, selector: SelectorFunctionNoIndex<T, V>): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in ascending or descending order according to a key.
* @param {LzIterable<T>} source A sequence of values to order.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @param {boolean} descending Whether to sort in descending order rather than ascending.
* @returns {Lz<T>} A sequence whose elements are sorted according to a key.
*/
public static orderBy<T, V>(source: LzIterable<T>, selector: SelectorFunctionNoIndex<T, V>, descending: boolean): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in ascending order by using a specified comparator.
* @param {LzIterable<T>} source A sequence of values to order.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @param {ComparatorFunction<V>} comparator A ComparatorFunction<V> to compare keys.
* @returns {LzOrdered<T, V>} A sequence whose elements are sorted according to a key.
*/
public static orderBy<T, V>(source: LzIterable<T>, selector: SelectorFunctionNoIndex<T, V>, comparator: ComparatorFunction<V>): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in ascending or descending order by using a specified comparator.
* @param {LzIterable<T>} source A sequence of values to order.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @param {ComparatorFunction<V>} comparator A ComparatorFunction<V> to compare keys.
* @param {boolean} descending Whether to sort in descending order rather than ascending.
* @returns {Lz<T>} A sequence whose elements are sorted according to a key.
*/
public static orderBy<T, V>(source: LzIterable<T>, selector: SelectorFunctionNoIndex<T, V>, comparator: ComparatorFunction<V>, descending: boolean): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in descending order according to a key.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @returns {LzOrdered<T, V>} A sequence whose elements are sorted according to a key.
*/
public orderByDescending<V>(selector: SelectorFunctionNoIndex<T, V>): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in descending order by using a specified comparator.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @param {ComparatorFunction<V>} comparator A ComparatorFunction<V> to compare keys.
* @returns {LzOrdered<T, V>} A sequence whose elements are sorted according to a key.
*/
public orderByDescending<V>(selector: SelectorFunctionNoIndex<T, V>, comparator: ComparatorFunction<V>): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in descending order according to a key.
* @param {LzIterable<T>} source A sequence of values to order.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @returns {LzOrdered<T, V>} A sequence whose elements are sorted according to a key.
*/
public static orderByDescending<T, V>(source: LzIterable<T>, selector: SelectorFunctionNoIndex<T, V>): LzOrdered<T, V>;
/**
* Sorts the elements of a sequence in descending order by using a specified comparator.
* @param {LzIterable<T>} source A sequence of values to order.
* @param {SelectorFunctionNoIndex<T, V>} selector A function to extract a key from an element.
* @param {ComparatorFunction<V>} comparator A ComparatorFunction<V> to compare keys.
* @returns {LzOrdered<T, V>} A sequence whose elements are sorted according to a key.
*/
public static orderByDescending<T, V>(source: LzIterable<T>, selector: SelectorFunctionNoIndex<T, V>, comparator: ComparatorFunction<V>): LzOrdered<T, V>;
/**
* Generates a sequence of integral numbers within a specified range.
* @param {number} start The value of the first integer in the sequence.
* @param {number} count The number of sequential integers to generate.
* @returns {Lz<number>} A sequence that contains a range of sequential integral numbers.
* @throws If count is less than 0.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static range(start: number, count: number): Lz<number>;
/**
* Generates a sequence that contains one repeated value.
* @param {T} element The value to be repeated.
* @param {number} count The number of times to repeat the value in the generated sequence.
* @returns {Lz<T>} A sequence that contains a repeated value.
* @throws If count is less than 0.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static repeat<T>(element: T, count: number): Lz<T>;
/**
* Inverts the order of the elements in a sequence.
* @returns {Lz<T>} A sequence whose elements correspond to those of the input sequence in reverse order.
*/
public reverse(): Lz<T>;
/**
* Inverts the order of the elements in a sequence.
* @param {LzIterable<T>} source A sequence of values to reverse.
* @returns {Lz<T>} A sequence whose elements correspond to those of the input sequence in reverse order.
*/
public static reverse<T>(source: LzIterable<T>): Lz<T>;
/**
* Determines whether two sequences are equal by comparing their elements by using a specified
* ComparatorFunction<T>.
* @param {LzIterable<T>} second A sequence to compare to the first sequence.
* @param {ComparatorFunction<T>} comparator A ComparatorFunction<T> to use to compare elements.
* @returns {boolean} <i>true</i> if the two source sequences are of equal length and their corresponding elements
* compare equal according to <i>comparator</i>; otherwise, <i>false</i>.
*/
public sequenceEqual(second: LzIterable<T>, comparator?: ComparatorFunction<T>): boolean;
/**
* Determines whether two sequences are equal by comparing their elements by using a specified
* ComparatorFunction<T>.
* @param {LzIterable<T>} first A sequence to compare to <i>second</i>.
* @param {LzIterable<T>} second A sequence to compare to the first sequence.
* @param {ComparatorFunction<T>} comparator A ComparatorFunction<T> to use to compare elements.
* @returns {boolean} <i>true</i> if the two source sequences are of equal length and their corresponding elements
* compare equal according to <i>comparator</i>; otherwise, <i>false</i>.
*/
public static sequenceEqual<T>(first: LzIterable<T>, second: LzIterable<T>,
comparator?: ComparatorFunction<T>): boolean;
/**
* Concatenates two sequences.
* @param {LzIterable<T>} first The first sequence to concatenate.
* @param {LzIterable<T>} second The sequence to concatenate to the first sequence.
* @returns {Lz<T>} A sequence that contains the concatenated elements of the two input sequences.
*/
public static concat<T>(first: LzIterable<T>, second: LzIterable<T>): Lz<T>;
/**
* Filters a sequence of values based on a predicate.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition. Return true to keep the
* element, false otherwise.
* @returns {Lz<T>} An iterable that contains elements from the input sequence that satisfy the condition.
*/
public where(predicate: PredicateFunction<T>): Lz<T>;
/**
* Filters a sequence of values based on a predicate.
* @param {LzIterable<T>} source An iterable to filter.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition. Return true to keep the
* element, false otherwise.
* @returns {Lz<T>} An iterable that contains elements from the input sequence that satisfy the condition.
*/
public static where<T>(source: LzIterable<T>, predicate: PredicateFunction<T>): Lz<T>;
/**
* Projects each element of a sequence into a new form.
* @param {SelectorFunction<T, U>} selector A transform function to apply to each element.
* @returns {Lz<U>} An iterable whose elements are the result of invoking the transform function on each element of source.
*/
public select<U>(selector: SelectorFunction<T, U>): Lz<U>;
/**
* Projects each element of a sequence into a new form.
* @param {LzIterable<T>} source An iterable of values to invoke a transform function on.
* @param {SelectorFunction<T, U>} selector A transform function to apply to each element.
* @returns {Lz<U>} An iterable whose elements are the result of invoking the transform function on each element of source.
*/
public static select<T, U>(source: LzIterable<T>, selector: SelectorFunction<T, U>): Lz<U>;
/**
* Projects each element of a sequence to an IterableIterator<U> and flattens the resulting sequences into one sequence.
* @param {SelectorFunction<T, IterableIterator<U> | U[]>} selector A transform function to apply to each element.
* @returns {Lz<U>} An sequence whose elements are the result of invoking the one-to-many transform function on each element of the
* input sequence.
*/
public selectMany<U>(selector: SelectorFunction<T, IterableIterator<U> | U[]>): Lz<U>;
/**
* Projects each element of a sequence to an IterableIterator<U> and flattens the resulting sequences into one sequence.
* @param {LzIterable<T>} source A sequence of values to project.
* @param {SelectorFunction<T, IterableIterator<U> | U[]>} selector A transform function to apply to each element.
* @returns {Lz<U>} An sequence whose elements are the result of invoking the one-to-many transform function on each element of the
* input sequence.
*/
public static selectMany<T, U>(source: LzIterable<T>, selector: SelectorFunction<T, IterableIterator<U> | U[]>): Lz<U>;
/**
* Returns a specified number of contiguous elements from the start of a sequence.
* @param {number} count The number of elements to return.
* @returns {IterableIterator<T>} An iterable that contains the specified number of elements from the start of the input sequence.
*/
public take(count: number): Lz<T>;
/**
* Returns a specified number of contiguous elements from the start of a sequence.
* @param {LzIterable<T>} source The sequence to return elements from.
* @param {number} count The number of elements to return.
* @returns {IterableIterator<T>} An iterable that contains the specified number of elements from the start of the input sequence.
*/
public static take<T>(source: LzIterable<T>, count: number): Lz<T>;
/**
* Bypasses a specified number of elements in a sequence and then returns the remaining elements.
* @param {number} count The number of elements to skip before returning the remaining elements.
* @returns {IterableIterator<T>} An iterable that contains the elements that occur after the specified index in the input sequence.
*/
public skip(count: number): Lz<T>;
/**
* Bypasses a specified number of elements in a sequence and then returns the remaining elements.
* @param {LzIterable<T>} source The sequence to return elements from.
* @param {number} count The number of elements to skip before returning the remaining elements.
* @returns {IterableIterator<T>} An iterable that contains the elements that occur after the specified index in the input sequence.
*/
public static skip<T>(source: LzIterable<T>, count: number): Lz<T>;
/**
* Returns elements from a sequence as long as a specified condition is true.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {IterableIterator<T>} A sequence that contains the elements from the input sequence that occur before the element at which the
* test no longer passes.
*/
public takeWhile(predicate: PredicateFunction<T>): Lz<T>;
/**
* Returns elements from a sequence as long as a specified condition is true.
* @param {LzIterable<T>} source A sequence to return elements from.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {IterableIterator<T>} A sequence that contains the elements from the input sequence that occur before the element at which the
* test no longer passes.
*/
public static takeWhile<T>(source: LzIterable<T>, predicate: PredicateFunction<T>): Lz<T>;
/**
* Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {IterableIterator<T>} A sequence that contains the elements from the input sequence starting at the first element in the
* linear series that does not pass the test specified by predicate.
*/
public skipWhile(predicate: PredicateFunction<T>): Lz<T>;
/**
* Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
* @param {LzIterable<T>} source A sequence to return elements from.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {IterableIterator<T>} A sequence that contains the elements from the input sequence starting at the first element in the
* linear series that does not pass the test specified by predicate.
*/
public static skipWhile<T>(source: LzIterable<T>, predicate: PredicateFunction<T>): Lz<T>;
/**
* Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a
* specified function.
* @param {SelectorFunction<T, K>} keySelector A function to extract the key for each element.
* @returns {IterableIterator<[K, T[]]>} A Map where each entry contains a collection of objects of type T.
*/
public groupBy<K>(keySelector: SelectorFunction<T, K>): LzGrouped<K, T[]>;
/**
* Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a
* specified function.
* @param {SelectorFunction<T, K>} keySelector A function to extract the key for each element.
* @param {SelectorFunction<T, V>} elementSelector A function to map each source element to an element in the returned Map.
* @returns {IterableIterator<[K, V[]]>} A Map where each entry contains a collection of objects of type V.
*/
public groupBy<K, V>(keySelector: SelectorFunction<T, K>, elementSelector?: SelectorFunction<T, V>): LzGrouped<K, V[]>;
/**
* Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a
* specified function.
* @param {LzIterable<T>} source The sequence whose elements to group.
* @param {SelectorFunction<T, K>} keySelector A function to extract the key for each element.
* @returns {IterableIterator<[K, V[]]>} A Map where each entry contains a collection of objects of type V.
*/
public static groupBy<T, K>(source: LzIterable<T>, keySelector: SelectorFunction<T, K>): LzGrouped<K, T[]>;
/**
* Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a
* specified function.
* @param {LzIterable<T>} source The sequence whose elements to group.
* @param {SelectorFunction<T, K>} keySelector A function to extract the key for each element.
* @param {SelectorFunction<T, V>} elementSelector A function to map each source element to an element in the returned Map.
* @returns {IterableIterator<[K, V[]]>} A Map where each entry contains a collection of objects of type V.
*/
public static groupBy<T, K, V>(source: LzIterable<T>, keySelector: SelectorFunction<T, K>,
elementSelector?: SelectorFunction<T, V>): LzGrouped<K, V[]>;
/**
* Partitions the sequence into arrays of specified size.
* @param {number} size The size of each partitioned array. The last array may be smaller if there are
* not enough elements in the sequence to fill it.
* @returns {Lz<T[]>} A sequence that contains the partitioned arrays.
*/
public partition(size: number): Lz<T[]>;
/**
* Partitions the sequence into arrays of specified size.
* @param {twoa.LzIterable<T>} source The sequence whose elements to partition.
* @param {number} size The size of each partitioned array. The last array may be smaller if there are
* not enough elements in the sequence to fill it.
* @returns {Lz<T[]>} A sequence that contains the partitioned arrays.
*/
public static partition<T>(source: LzIterable<T>, size: number): Lz<T[]>;
/**
* Produces the set union of two sequences.
* @param {LzIterable<T>} second A sequence whose distinct elements form the second set for the union.
* @param {ComparatorFunction<T>} comparator The ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains the elements from both input sequences, excluding duplicates.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public union(second: LzIterable<T>, comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Produces the set union of two sequences.
* @param {LzIterable<T>} first A sequence whose distinct elements form the first set for the union.
* @param {LzIterable<T>} second A sequence whose distinct elements form the second set for the union.
* @param {ComparatorFunction<T>} comparator The ComparatorFunction<T> to compare values.
* @returns {Lz<T>} A sequence that contains the elements from both input sequences, excluding duplicates.
* @remarks
* This method is implemented by using deferred execution. The immediate return value is an object that stores all
* the information that is required to perform the action. The query represented by this method is not executed
* until the object is enumerated either by calling its toArray method directly or by using for...of.
*/
public static union<T>(first: LzIterable<T>, second: LzIterable<T>, comparator?: ComparatorFunction<T>): Lz<T>;
/**
* Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.
* @param {IterableIterator<U>} second The second sequence to merge.
* @param {(first: T, second: U) => V} resultSelector A function that specifies how to merge the elements from the two sequences.
* @returns {IterableIterator<V>} A sequence that contains merged elements of two input sequences.
*/
public zip<U, V>(second: LzIterable<U>, resultSelector: (first: T, second: U) => V): Lz<V>;
/**
* Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.
* @param {LzIterable<T>} first The first sequence to merge.
* @param {IterableIterator<U>} second The second sequence to merge.
* @param {(first: T, second: U) => V} resultSelector A function that specifies how to merge the elements from the two sequences.
* @returns {IterableIterator<V>} A sequence that contains merged elements of two input sequences.
*/
public static zip<T, U, V>(first: LzIterable<T>, second: LzIterable<U>, resultSelector: (first: T, second: U) => V): Lz<V>;
/**
* Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
* @param {AccumulatorFunction<T, U>} func An accumulator function to be invoked on each element.
* @param {U} seed The initial accumulator value.
* @returns {U} The final accumulator value.
*/
public aggregate<U>(func: AccumulatorFunction<T, U>, seed?: U): U;
/**
* Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
* @param {LzIterable<T>} source The sequence to aggregate over.
* @param {AccumulatorFunction<T, U>} func An accumulator function to be invoked on each element.
* @param {U} seed The initial accumulator value.
* @returns {U} The final accumulator value.
*/
public static aggregate<T, U>(source: LzIterable<T>, func: AccumulatorFunction<T, U>, seed?: U): U;
/**
* Invokes a transform function on each element of a sequence and returns the maximum value.
* @param {SelectorFunction<T, number>} selector A transform function to apply to each element.
* @returns {number} The maximum value in the sequence.
*/
public max(selector: SelectorFunction<T, number>): number;
public max(selector?: SelectorFunction<number, number>): number;
/**
* Invokes a transform function on each element of a sequence and returns the maximum value.
* @param {LzIterable<T>} source A sequence of values to determine the maximum value of.
* @param {SelectorFunction<T, number>} selector A transform function to apply to each element.
* @returns {number} The maximum value in the sequence.
*/
public static max<T>(source: LzIterable<T>, selector: SelectorFunction<T, number>): number;
public static max<T extends number>(source: LzIterable<T>, selector?: SelectorFunction<T, number>): number;
/**
* Invokes a transform function on each element of a sequence and returns the minimum value.
* @param {SelectorFunction<T, number>} selector A transform function to apply to each element.
* @returns {number} The minimum value in the sequence.
*/
public min(selector: SelectorFunction<T, number>): number;
public min(selector?: SelectorFunction<number, number>): number;
/**
* Invokes a transform function on each element of a sequence and returns the minimum value.
* @param {LzIterable<T>} source A sequence of values to determine the minimum value of.
* @param {SelectorFunction<T, number>} selector A transform function to apply to each element.
* @returns {number} The minimum value in the sequence.
*/
public static min<T>(source: LzIterable<T>, selector: SelectorFunction<T, number>): number;
public static min<T extends number>(source: LzIterable<T>, selector?: SelectorFunction<T, number>): number;
/**
* Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.
* @param {SelectorFunction<T, number>} selector A transform function to apply to each element.
* @returns {number} The sum of the projected values.
*/
public sum(selector: SelectorFunction<T, number>): number;
public sum(selector?: SelectorFunction<number, number>): number;
/**
* Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.
* @param {LzIterable<T>} source A sequence of values that are used to calculate a sum.
* @param {SelectorFunction<T, number>} selector A transform function to apply to each element.
* @returns {number} The sum of the projected values.
*/
public static sum<T>(source: LzIterable<T>, selector: SelectorFunction<T, number>): number;
public static sum<T extends number>(source: LzIterable<T>, selector?: SelectorFunction<T, number>): number;
/**
* Computes the average of a sequence of values that are obtained by invoking a transform function on each element of the input sequence.
* @param {SelectorFunction<T, number>} selector A transform function to apply to each element.
* @returns {number} The average of the sequence of values, or 0 if the source sequence is empty.
*/
public average(selector: SelectorFunction<T, number>): number;
public average(selector?: SelectorFunction<number, number>): number;
/**
* Computes the average of a sequence of values that are obtained by invoking a transform function on each element of the input sequence.
* @param {LzIterable<T>} source A sequence of values that are used to calculate an average.
* @param {SelectorFunction<T, number>} selector A transform function to apply to each element.
* @returns {number} The average of the sequence of values, or 0 if the source sequence is empty.
*/
public static average<T>(source: LzIterable<T>, selector: SelectorFunction<T, number>): number;
public static average<T extends number>(source: LzIterable<T>, selector?: SelectorFunction<T, number>): number;
/**
* Returns a number that represents how many elements in the specified sequence satisfy a condition.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {number} A number that represents how many elements in the sequence satisfy the condition in the predicate function.
*/
public count(predicate?: PredicateFunction<T>): number;
/**
* Returns a number that represents how many elements in the specified sequence satisfy a condition.
* @param {LzIterable<T>} source The sequence to return elements from.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {number} A number that represents how many elements in the sequence satisfy the condition in the predicate function.
*/
public static count<T>(source: LzIterable<T>, predicate?: PredicateFunction<T>): number;
/**
* Determines whether any element of a sequence satisfies a condition.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {boolean} <b>true</b> if any elements in the source sequence pass the test in the specified predicate; otherwise,
* <b>false</b>.
*/
public any(predicate: PredicateFunction<T>): boolean;
/**
* Determines whether any element of a sequence satisfies a condition.
* @param {LzIterable<T>} source The sequence whose elements to apply the predicate to.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {boolean} <b>true</b> if any elements in the source sequence pass the test in the specified predicate; otherwise,
* <b>false</b>.
*/
public static any<T>(source: LzIterable<T>, predicate: PredicateFunction<T>): boolean;
/**
* Determines whether all elements of a sequence satisfy a condition.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {boolean} <b>true</b> if every element of the source sequence passes the test in the specified predicate, or if the sequence
* is empty; otherwise, <b>false</b>.
*/
public all(predicate: PredicateFunction<T>): boolean;
/**
* Determines whether all elements of a sequence satisfy a condition.
* @param {LzIterable<T>} source The sequence that contains the elements to apply the predicate to.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {boolean} <b>true</b> if every element of the source sequence passes the test in the specified predicate, or if the sequence
* is empty; otherwise, <b>false</b>.
*/
public static all<T>(source: LzIterable<T>, predicate: PredicateFunction<T>): boolean;
/**
* Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
* @param {PredicateFunction<T>} predicate A function to test an element for a condition. Return true to keep the element,
* false otherwise.
* @returns {T} The single element of the input sequence that satisfies a condition.
* @throws If no element satisfies the condition in predicate, or more than one element satisfies the condition
* in predicate, or the source sequence is empty.
*/
public single(predicate?: PredicateFunction<T>): T;
/**
* Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
* @param {LzIterable<T>} source An iterable to return the single element of.
* @param {PredicateFunction<T>} predicate A function to test an element for a condition. Return true to keep the element,
* false otherwise.
* @returns {T} The single element of the input sequence that satisfies a condition.
* @throws If no element satisfies the condition in predicate, or more than one element satisfies the condition
* in predicate, or the source sequence is empty.
*/
public static single<T>(source: LzIterable<T>,
predicate?: PredicateFunction<T>): T;
/**
* Returns the only element of a sequence that satisfies a specified condition or a default value if no such element
* exists; this method throws an exception if more than one element satisfies the condition.
* @param {T} defaultValue The default value.
* @param {PredicateFunction<T>} predicate A function to test an element for a condition. Return true to keep the element,
* false otherwise.
* @returns {T} The single element of the input sequence that satisfies a condition.
* @throws If more than one element satisfies the condition in predicate.
*/
public singleOrDefault(defaultValue: T, predicate?: PredicateFunction<T>): T;
/**
* Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists;
* this method throws an exception if more than one element satisfies the condition.
* @param {LzIterable<T>} source A sequence to return the single element from.
* @param {T} defaultValue The default value.
* @param {PredicateFunction<T>} predicate A function to test an element for a condition. Return true to keep the element,
* false otherwise.
* @returns {T} The single element of the input sequence that satisfies the condition, or <i>defaultValue</i> if
* no such element is found.
* @throws If more than one element satisfies the condition in predicate.
*/
public static singleOrDefault<T>(source: LzIterable<T>, defaultValue: T,
predicate?: PredicateFunction<T>): T;
/**
* Returns the first element of a sequence.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {T} The first element.
* @throws If the source sequence contains no elements or the predicate did not match any elements.
*/
public first(predicate?: PredicateFunction<T>): T;
/**
* Returns the first element of a sequence.
* @param {LzIterable<T>} source The sequence to return an element from.
* @param {(PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {T} The first element.
* @throws If the source sequence contains no elements or the predicate did not match any elements.
*/
public static first<T>(source: LzIterable<T>, predicate?: PredicateFunction<T>): T;
/**
* Returns the first element of a sequence, or a default value if the sequence contains no elements.
* @param {T} defaultValue The default value.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {T} The first element, or a default value if the sequence contains no elements.
*/
public firstOrDefault(defaultValue: T, predicate?: PredicateFunction<T>): T;
/**
* Returns the first element of a sequence, or a default value if the sequence contains no elements.
* @param {LzIterable<T>} source The sequence to return an element from.
* @param {T} defaultValue The default value.
* @param {PredicateFunction<T>} predicate A function to test each element for a condition.
* @returns {T} The first element, or a default value if the sequence contains no elements.
*/
public static firstOrDefault<T>(source: LzIterable<T>, defaultValue: T,
predicate?: PredicateFunction<T>): T;