<commit_before>package com.github.dreamhead.moco;

import com.google.common.base.Predicate;

import static com.google.common.collect.FluentIterable.from;
import static java.lang.String.format;

public final class VerificationData {
    private final Iterable<Request> requests;
    private final RequestMatcher matcher;
    private final String mismatchFormat;

    public VerificationData(final Iterable<Request> requests,
                            final RequestMatcher matcher,
                            final String mismatchFormat) {
        this.requests = requests;
        this.matcher = matcher;
        this.mismatchFormat = mismatchFormat;
    }

    public String mismatchDescription(final int actualSize, final String expected) {
        return format(mismatchFormat, expected, actualSize);
    }

    public int matchedSize() {
        return from(requests).filter(matched()).size();
    }

    private Predicate<Request> matched() {
        return new Predicate<Request>() {
            @Override
            public boolean apply(final Request request) {
                return matcher.match(request);
            }
        };
    }
}
<commit_msg>migrated guava predicate to java 8 predicate in verification data<commit_after>package com.github.dreamhead.moco;

import java.util.stream.StreamSupport;

import static java.lang.String.format;

public final class VerificationData {
    private final Iterable<Request> requests;
    private final RequestMatcher matcher;
    private final String mismatchFormat;

    public VerificationData(final Iterable<Request> requests,
                            final RequestMatcher matcher,
                            final String mismatchFormat) {
        this.requests = requests;
        this.matcher = matcher;
        this.mismatchFormat = mismatchFormat;
    }

    public String mismatchDescription(final int actualSize, final String expected) {
        return format(mismatchFormat, expected, actualSize);
    }

    public int matchedSize() {
        return (int) StreamSupport.stream(requests.spliterator(), false)
                .filter(matcher::match)
                .count();
    }
}

{'fraction_non_alphanumeric': 0.07606679035250463, 'fraction_numerical': 0.00046382189239332097, 'mean_word_length': 2.6374367622259696, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7489005', 'n_tokens_mistral': 546, 'n_tokens_neox': 523, 'n_words': 142}