<commit_before>package io.xchris6041x.devin.commands;

import java.util.ArrayList;
import java.util.List;

public final class CommandUtils {
	
	/**
	 * Divide the book into pages and output one page.
	 * @param book - All the possible lines that could be on a page.
	 * @param pageLength - The length of one page (The max length of the return array).
	 * @param pageNumber - The page number (starting at 0).
	 * @return one page.
	 */
	public static String[] pagination(String[] book, int pageLength, int pageNumber) {
		int maxPages = (int) Math.ceil(book.length / (double) pageLength);
		if(pageNumber < 0) {
			pageNumber = 0;
		}
		else if(pageNumber > maxPages) {
			pageNumber = maxPages;
		}
		
		List<String> page = new ArrayList<String>();
		for(int i = 0; i < pageLength; i++) {
			int index = pageLength * pageNumber + i;
			if(index >= book.length) break;
			
			page.add(book[index]);
		}
		
		return page.toArray(new String[0]);
	}
	
}<commit_msg>Added the option to use a List with pagination.<commit_after>package io.xchris6041x.devin.commands;

import java.util.ArrayList;
import java.util.List;

public final class CommandUtils {
	
	/**
	 * Divide the book into pages and output one page.
	 * @param book - All the possible lines that could be on a page.
	 * @param pageLength - The length of one page (The max length of the return array).
	 * @param pageNumber - The page number (starting at 0).
	 * @return one page.
	 */
	public static String[] pagination(String[] book, int pageLength, int pageNumber) {
		int maxPages = (int) Math.ceil(book.length / (double) pageLength);
		if(pageNumber < 0) {
			pageNumber = 0;
		}
		else if(pageNumber > maxPages) {
			pageNumber = maxPages;
		}
		
		List<String> page = new ArrayList<String>();
		for(int i = 0; i < pageLength; i++) {
			int index = pageLength * pageNumber + i;
			if(index >= book.length) break;
			
			page.add(book[index]);
		}
		
		return page.toArray(new String[0]);
	}
	
	/**
	 * Divide the book into pages and output one page.
	 * @param book - All the possible lines that could be on a page.
	 * @param pageLength - The length of one page (The max length of the return array).
	 * @param pageNumber - The page number (starting at 0).
	 * @return one page.
	 */
	public static String[] pagination(List<String> book, int pageLength, int pageNumber) {
		return pagination(book.toArray(new String[0]), pageLength, pageNumber);
	}
	
}
{'fraction_non_alphanumeric': 0.115527950310559, 'fraction_numerical': 0.008281573498964804, 'mean_word_length': 3.3610108303249095, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '1084225', 'n_tokens_mistral': 840, 'n_tokens_neox': 739, 'n_words': 272}