<commit_before>package com.jnape.palatable.lambda.staticfactory;

import com.jnape.palatable.lambda.iterators.ImmutableIterator;

import java.util.Iterator;

import static java.util.Arrays.asList;

public class IterableFactory {

    public static <A> Iterable<A> iterable(final Iterator<A> iterator) {
        return new Iterable<A>() {
            @Override
            public Iterator<A> iterator() {
                return new ImmutableIterator<A>() {
                    @Override
                    public boolean hasNext() {
                        return iterator.hasNext();
                    }

                    @Override
                    public A next() {
                        return iterator.next();
                    }
                };
            }
        };
    }

    public static <A> Iterable<A> iterable(final A... as) {
        return new Iterable<A>() {
            @Override
            public Iterator<A> iterator() {
                final Iterator<A> asIterator = asList(as).iterator();
                return new ImmutableIterator<A>() {
                    @Override
                    public boolean hasNext() {
                        return asIterator.hasNext();
                    }

                    @Override
                    public A next() {
                        return asIterator.next();
                    }
                };
            }
        };
    }
}<commit_msg>IterableFactory: simplifying<commit_after>package com.jnape.palatable.lambda.staticfactory;

import com.jnape.palatable.lambda.iterators.ImmutableIterator;

import java.util.Iterator;

import static java.util.Arrays.asList;

public class IterableFactory {

    public static <A> Iterable<A> iterable(final Iterator<A> iterator) {
        return new Iterable<A>() {
            @Override
            public Iterator<A> iterator() {
                return new ImmutableIterator<A>() {
                    @Override
                    public boolean hasNext() {
                        return iterator.hasNext();
                    }

                    @Override
                    public A next() {
                        return iterator.next();
                    }
                };
            }
        };
    }

    public static <A> Iterable<A> iterable(final A... as) {
        return asList(as);
    }
}
{'fraction_non_alphanumeric': 0.09268707482993198, 'fraction_numerical': 0.0, 'mean_word_length': 1.2734299516908212, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '1091369', 'n_tokens_mistral': 593, 'n_tokens_neox': 555, 'n_words': 125}