public boolean anyMatch()

in core/src/main/java/com/spotify/metrics/core/OverwritingFixedConcurrentRingBuffer.java [65:82]


    public boolean anyMatch(final Predicate<T> predicate) {
        // Old elements are at the tail, which is just after the head,
        // so start searching there (though the tail keeps moving...)
        final int start = (position.get() & 0x7FFFFFFF) % capacity;
        for (int i = start; i < capacity; i++) {
            if (predicate.test(buffer.get(i))) {
                return true;
            }
        }

        // Scan the skipped part of the buffer too
        for (int i = 0; i < start; i++) {
            if (predicate.test(buffer.get(i))) {
                return true;
            }
        }
        return false;
    }