@Test public void canProcessFailed() { PagedList<String> list = new PagedList<>(); list.addAll(asList( mkRequest("foo"), mkRequest(null), mkRequest("baz") )); final List<String> processed = new ArrayList<>(); list.ifFailure(e -> processed.add(e.getBody())); assertEquals(null, processed.get(0)); }
public PagedList<T> ifFailure(Consumer<HttpResponse<T>> consumer) { stream().filter(r -> !r.isSuccess()).forEach(consumer); return this; }
PagedList extends ArrayList<HttpResponse<T>> { public PagedList<T> ifFailure(Consumer<HttpResponse<T>> consumer) { stream().filter(r -> !r.isSuccess()).forEach(consumer); return this; } }
PagedList extends ArrayList<HttpResponse<T>> { public PagedList<T> ifFailure(Consumer<HttpResponse<T>> consumer) { stream().filter(r -> !r.isSuccess()).forEach(consumer); return this; }  }
PagedList extends ArrayList<HttpResponse<T>> { public PagedList<T> ifFailure(Consumer<HttpResponse<T>> consumer) { stream().filter(r -> !r.isSuccess()).forEach(consumer); return this; }  List<T> getBodies(); PagedList<T> ifSuccess(Consumer<HttpResponse<T>> consumer); PagedList<T> ifFailure(Consumer<HttpResponse<T>> consumer); }
PagedList extends ArrayList<HttpResponse<T>> { public PagedList<T> ifFailure(Consumer<HttpResponse<T>> consumer) { stream().filter(r -> !r.isSuccess()).forEach(consumer); return this; }  List<T> getBodies(); PagedList<T> ifSuccess(Consumer<HttpResponse<T>> consumer); PagedList<T> ifFailure(Consumer<HttpResponse<T>> consumer);  }