View Javadoc
1   package com.github.davidmoten.rx2;
2   
3   import java.util.concurrent.Callable;
4   
5   public final class Callables {
6   
7       private Callables() {
8           // prevent instantiation
9       }
10  
11      public static <T> Callable<T> constant(final T object) {
12          return new Callable<T>() {
13  
14              @Override
15              public T call() throws Exception {
16                  return object;
17              }
18          };
19      }
20  
21      public static <T> Callable<T> toNull() {
22          // TODO make holder
23          return new Callable<T>() {
24  
25              @Override
26              public T call() throws Exception {
27                  return null;
28              }
29          };
30      }
31  
32  }