File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed
rxjava-core/src/main/java/rx Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2013 Netflix, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package rx .operators ;
17
+
18
+ import rx .Observable ;
19
+ import rx .Observer ;
20
+ import rx .Subscription ;
21
+ import rx .util .Timestamped ;
22
+ import rx .util .functions .Func1 ;
23
+
24
+ public final class OperationTimestamp {
25
+
26
+ /**
27
+ * Accepts a sequence and adds timestamps to each item in it.
28
+ *
29
+ * @param sequence
30
+ * the input sequence.
31
+ * @param <T>
32
+ * the type of the input sequence.
33
+ * @return a sequence of timestamped values created by adding timestamps to each item in the input sequence.
34
+ */
35
+ public static <T > Func1 <Observer <Timestamped <T >>, Subscription > timestamp (Observable <T > sequence ) {
36
+ return OperationMap .map (sequence , new Func1 <T , Timestamped <T >>() {
37
+ @ Override
38
+ public Timestamped <T > call (T value ) {
39
+ return new Timestamped <T >(System .currentTimeMillis (), value );
40
+ }
41
+ });
42
+ }
43
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2013 Netflix, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
package rx .util ;
2
17
3
18
/**
You can’t perform that action at this time.
0 commit comments