@Test public void shouldBeIterableOverValueIfSome() throws Exception { Option<Integer> option = some(10); Iterator<Integer> iterator = option.iterator(); assertThat(iterator.hasNext(), is(true)); assertThat(iterator.next(), is(10)); assertThat(iterator.hasNext(), is(false)); }
public static <T> Option<T> some(T value) { return Some.some(value); }
Option implements Mappable<T, Option<?>>,
                   Value<T>,
                   Iterable<T> { public static <T> Option<T> some(T value) { return Some.some(value); } }
Option implements Mappable<T, Option<?>>,
                   Value<T>,
                   Iterable<T> { public static <T> Option<T> some(T value) { return Some.some(value); } protected  Option(); }
Option implements Mappable<T, Option<?>>,
                   Value<T>,
                   Iterable<T> { public static <T> Option<T> some(T value) { return Some.some(value); } protected  Option(); static Option<T> none(); static Option<T> none(Class<T> typeClass); static Option<T> some(T value); static Option<T> option(T value); abstract Boolean hasValue(); abstract Boolean hasNoValue(); @Override T getValue(); abstract T get(); abstract T getOrElse(T value); abstract T getOrNull(); abstract T getOrCall(NullaryFunction<? extends T> function); abstract T getOrCall(Callable<? extends T> callable); abstract T getOrThrow(E throwable); abstract Option<T> or(Option<? extends T> other); abstract Option<T> or(NullaryFunction<? extends Option<? extends T>> function); Option<T> or(Callable<? extends Option<? extends T>> function); abstract Option<T> orSome(T other); abstract Option<T> orOption(T other); abstract Option<S> map(UnaryFunction<? super T, ? extends S> function); abstract Option<S> flatMap(UnaryFunction<? super T, ? extends Option<? extends S>> function); @Override boolean equals(Object other); @Override int hashCode(); }
Option implements Mappable<T, Option<?>>,
                   Value<T>,
                   Iterable<T> { public static <T> Option<T> some(T value) { return Some.some(value); } protected  Option(); static Option<T> none(); static Option<T> none(Class<T> typeClass); static Option<T> some(T value); static Option<T> option(T value); abstract Boolean hasValue(); abstract Boolean hasNoValue(); @Override T getValue(); abstract T get(); abstract T getOrElse(T value); abstract T getOrNull(); abstract T getOrCall(NullaryFunction<? extends T> function); abstract T getOrCall(Callable<? extends T> callable); abstract T getOrThrow(E throwable); abstract Option<T> or(Option<? extends T> other); abstract Option<T> or(NullaryFunction<? extends Option<? extends T>> function); Option<T> or(Callable<? extends Option<? extends T>> function); abstract Option<T> orSome(T other); abstract Option<T> orOption(T other); abstract Option<S> map(UnaryFunction<? super T, ? extends S> function); abstract Option<S> flatMap(UnaryFunction<? super T, ? extends Option<? extends S>> function); @Override boolean equals(Object other); @Override int hashCode();  }