### Question:
Choice { public <R> Choice<R> thenChoose(final Function<? super T, Choice<R>> function) { checkNotNull(function); if (Thread.interrupted()) { throw new RuntimeException(new InterruptedException()); } final Choice<T> thisChoice = this; return new Choice<R>() { @Override protected Iterator<R> iterator() { if (Thread.interrupted()) { throw new RuntimeException(new InterruptedException()); } return Iterators.concat( Iterators.transform(thisChoice.iterator(), (T t) -> function.apply(t).iterator())); } }; } private  Choice(); @SuppressWarnings("unchecked") static Choice<T> none(); static Choice<T> of(final T t); static Choice<T> condition(boolean condition, T t); static Choice<T> fromOptional(Optional<T> optional); static Choice<T> from(final Collection<T> choices); static Choice<T> any(final Collection<Choice<T>> choices); @Override String toString(); Optional<T> first(); Choice<R> thenChoose(final Function<? super T, Choice<R>> function); Choice<R> thenOption(final Function<? super T, Optional<R>> function); Choice<R> transform(final Function<? super T, R> function); Choice<T> or(final Choice<T> other); Choice<T> condition(boolean condition); Choice<T> condition(final Predicate<? super T> predicate);  }### Answer:
@Test public void testThenChoose() { assertThat( Choice.from(ImmutableList.of(1, 2, 3)) .thenChoose( Functions.forMap(ImmutableMap.of(2, Choice.of("foo")), Choice.<String>none())) .asIterable()) .containsExactly("foo"); }