@Override
  public boolean matches(Pair<Request, Response> requestResponse) {
    Request request = requestResponse.first();
    Response response = requestResponse.second();

    return (response.status().isSuccessful() || response.status().equals(NOT_MODIFIED))
        && isAcceptableMediaType(response)
        && !internalRequestMarker.isInternal(request);
  }
Exemple #2
0
 public static <K, V> TreeMap<K, V> treeMap(
     final TreeFactory factory,
     final Comparator<K> comparator,
     final List<Pair<K, V>> sortedList) {
   if (sortedList.size() == 0) return factory.create(comparator);
   int middle = sortedList.size() / 2;
   Pair<K, V> pair = sortedList.get(middle);
   TreeMap<K, V> left = treeMap(factory, comparator, sortedList.subList(0, middle));
   TreeMap<K, V> right =
       treeMap(factory, comparator, sortedList.subList(middle + 1, sortedList.size()));
   return factory.create(comparator, pair.first(), pair.second(), left, right);
 }