<commit_before>package com.alexrnl.commons.utils;

import java.util.Iterator;
import java.util.Objects;
import java.util.logging.Logger;

/**
 * Utilities on collections.<br />
 * @author Alex
 */
public final class CollectionUtils {
	/** Logger */
	private static Logger	lg	= Logger.getLogger(CollectionUtils.class.getName());
	
	/**
	 * Constructor #1.<br />
	 * Default private constructor.
	 */
	private CollectionUtils () {
		super();
	}
	
	/**
	 * Check if a collection is sorted.<br />
	 * @param collection
	 *        the collection to check.
	 * @return <code>true</code> if the collection is sorted.
	 */
	public static <T extends Comparable<? super T>> boolean isSorted (final Iterable<T> collection) {
		Objects.requireNonNull(collection);
		final Iterator<T> it = collection.iterator();
		
		while (it.hasNext()) {
			final T current = it.next();
			if (it.hasNext() && current.compareTo(it.next()) > 0) {
				return false;
			}
		}
		
		return true;<commit_msg>Use logger is method isSorted<commit_after>package com.alexrnl.commons.utils;

import java.util.Iterator;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Utilities on collections.<br />
 * @author Alex
 */
public final class CollectionUtils {
	/** Logger */
	private static Logger	lg	= Logger.getLogger(CollectionUtils.class.getName());
	
	/**
	 * Constructor #1.<br />
	 * Default private constructor.
	 */
	private CollectionUtils () {
		super();
	}
	
	/**
	 * Check if a collection is sorted.<br />
	 * @param collection
	 *        the collection to check.
	 * @return <code>true</code> if the collection is sorted.
	 */
	public static <T extends Comparable<? super T>> boolean isSorted (final Iterable<T> collection) {
		Objects.requireNonNull(collection);
		final Iterator<T> it = collection.iterator();
		
		while (it.hasNext()) {
			final T current = it.next();
			if (it.hasNext() && current.compareTo(it.next()) > 0) {
				if (lg.isLoggable(Level.INFO)) {
					lg.info("Collection is unordered at element " + current);
				}
				return false;
			}
		}
		
		return true;
{'fraction_non_alphanumeric': 0.13925855513307986, 'fraction_numerical': 0.0019011406844106464, 'mean_word_length': 3.3854166666666665, 'pattern_counts': {'":': 0, '<': 21, '<?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': '1888177', 'n_tokens_mistral': 706, 'n_tokens_neox': 626, 'n_words': 175}