<commit_before>package uk.ac.ebi.atlas.profiles;

import uk.ac.ebi.atlas.commons.streams.ObjectInputStream;

import java.util.Iterator;

// Used to make ObjectInputStream iterable
// TODO: implement iterator() on all ObjectInputStream classes then this adapter won't be needed
public class IterableObjectInputStream<T> implements Iterable<T> {

    private final ObjectInputStream<T> inputStream;

    public IterableObjectInputStream(ObjectInputStream<T> inputStream) {
        this.inputStream = inputStream;
    }

    @Override
    public Iterator<T> iterator() {
        return new ObjectInputStreamIterator();
    }

    // buffers next object input stream result so we can
    // provide a hasNext method
    private final class ObjectInputStreamIterator implements Iterator<T> {

        private T next;

        private ObjectInputStreamIterator() {
            storeNext();
        }

        private void storeNext() {
            next = inputStream.readNext();
        }

        @Override
        public boolean hasNext() {
            return (next != null);
        }

        @Override
        public T next() {
            T result = next;
            storeNext();
            return result;
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    }
}<commit_msg>Remove TODO note, this class has value!<commit_after>package uk.ac.ebi.atlas.profiles;

import uk.ac.ebi.atlas.commons.streams.ObjectInputStream;

import java.util.Iterator;

// Used to make ObjectInputStream iterable
public class IterableObjectInputStream<T> implements Iterable<T> {

    private final ObjectInputStream<T> inputStream;

    public IterableObjectInputStream(ObjectInputStream<T> inputStream) {
        this.inputStream = inputStream;
    }

    @Override
    public Iterator<T> iterator() {
        return new ObjectInputStreamIterator();
    }

    // buffers next object input stream result so we can provide a hasNext method
    private final class ObjectInputStreamIterator implements Iterator<T> {

        private T next;

        private ObjectInputStreamIterator() {
            storeNext();
        }

        private void storeNext() {
            next = inputStream.readNext();
        }

        @Override
        public boolean hasNext() {
            return (next != null);
        }

        @Override
        public T next() {
            T result = next;
            storeNext();
            return result;
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    }

}
{'fraction_non_alphanumeric': 0.07993909402360107, 'fraction_numerical': 0.0, 'mean_word_length': 2.2565055762081783, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '5565397', 'n_tokens_mistral': 661, 'n_tokens_neox': 638, 'n_words': 191}