### Question:
Try { public static <E> Collector<Try<E>, ?, Map<Type, List<Try<E>>>> groupingBySuccess() { return Collectors.groupingBy(t -> t.getType()); }  static Function<I, Try<O>> of(ThrowingFunction<I, O> function); static Function<I, Supplier<Try<O>>> lazyOf(ThrowingFunction<I, O> function); static Collector<Try<E>, ?, Map<Type, List<Try<E>>>> groupingBySuccess(); static TryCollector<E> collect(); abstract Type getType(); boolean isSuccess(); boolean isFailure(); Try<F> map(Function<E, F> mapper); Try<O> flatMap(Function<E, Try<O>> mapper); Optional<E> toOption(); E getOrThrow(); void ifPresent(Consumer<E> consumer); Success<E> asSuccess(); Failure<E> asFailure();  }### Answer:
@Test public void groupingBySuccessTest() { Success<Integer> success = new Success<>(1); Failure<Integer> failure = new Failure<>(exception); List<Try<Integer>> tries = Arrays.asList(success, failure); Map<Try.Type, List<Try<Integer>>> tryMap = tries.stream().collect(Try.groupingBySuccess()); assertEquals(Arrays.asList(success), tryMap.get(Try.Type.SUCCESS)); assertEquals(Arrays.asList(failure), tryMap.get(Try.Type.FAILURE)); }