| 1 |
/* |
| 2 |
* Copyright (c) 2016-present, RxJava Contributors. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in |
| 5 |
* compliance with the License. You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software distributed under the License is |
| 10 |
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See |
| 11 |
* the License for the specific language governing permissions and limitations under the License. |
| 12 |
*/ |
| 13 |
|
| 14 |
package io.reactivex.rxjava3.operators; |
| 15 |
|
| 16 |
import io.reactivex.rxjava3.annotations.NonNull; |
| 17 |
import io.reactivex.rxjava3.functions.Supplier; |
| 18 |
|
| 19 |
/** |
| 20 |
* A marker interface indicating that a scalar, constant value |
| 21 |
* is held by the implementing reactive type which can be |
| 22 |
* safely extracted during assembly time can be used for |
| 23 |
* optimization. |
| 24 |
* <p> |
| 25 |
* Implementors of {@link #get()} should not throw any exception. |
| 26 |
* <p> |
| 27 |
* Design note: the interface extends {@link Supplier} because if a scalar |
| 28 |
* is safe to extract during assembly time, it is also safe to extract at |
| 29 |
* subscription time or later. This allows optimizations to deal with such |
| 30 |
* single-element sources uniformly. |
| 31 |
* <p> |
| 32 |
* @param <T> the scalar value type held by the implementing reactive type |
| 33 |
* @since 3.1.1 |
| 34 |
*/ |
| 35 |
@FunctionalInterface |
| 36 |
public interface ScalarSupplier<@NonNull T> extends Supplier<T> { |
| 37 |
|
| 38 |
// overridden to remove the throws Throwable |
| 39 |
@Override |
| 40 |
T get(); |
| 41 |
} |