<commit_before>package com.bbcnewsreader;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;

import org.mcsoxford.rss.RSSFeed;
import org.mcsoxford.rss.RSSItem;
import org.mcsoxford.rss.RSSReader;
import org.mcsoxford.rss.RSSReaderException;

import android.util.Log;



public class RSSManager implements Runnable {
	/* constants */
	
	
	/* variables */
	ResourceInterface resourceInterface;
	Thread thread;
	String[] names;
	String[] urls;
	ArrayList<RSSFeed> feeds;
	RSSReader reader;
	boolean keepLoading;
	
	public RSSManager(String[] names, String[] urls, ResourceInterface service){
		this.names = names; //store the names
		this.urls = urls; //store the URLS
		feeds = new ArrayList<RSSFeed>();
		resourceInterface = service;
		keepLoading = true;
		thread = new Thread(this);
		thread.start();
	}
	
	public void stopLoading(){
		keepLoading = false;
	}
	
	public void run(){
		//create a reader
		reader = new RSSReader();
		//load in the feeds
		for(int i = 0; i < urls.length; i++){
			//check we haven't been cancelled
			if(keepLoading){
				RSSFeed feed;
				try {
					feed = reader.load(new URI(urls[i]));
					feeds.add(feed);
					List<RSSItem> items = (List<RSSItem>) feed.getItems();
					//loop through the items and send them to the parent service
					resourceInterface.categoryRssLoaded((RSSItem[])items.toArray(new RSSItem[0]), names[i]);
				} catch (RSSReaderException e) {
					resourceInterface.reportError(true, e.getMessage()); //report a fatal error
				} catch (URISyntaxException e) {
					resourceInterface.reportError(true, e.getMessage());
				}
			}
		}
		//report that the load is complete
		resourceInterface.loadComplete();
	}
}
<commit_msg>Fixed a performance issue stemming from the use of List.toArray()<commit_after>package com.bbcnewsreader;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;

import org.mcsoxford.rss.RSSFeed;
import org.mcsoxford.rss.RSSItem;
import org.mcsoxford.rss.RSSReader;
import org.mcsoxford.rss.RSSReaderException;



public class RSSManager implements Runnable {
	/* constants */
	
	
	/* variables */
	ResourceInterface resourceInterface;
	Thread thread;
	String[] names;
	String[] urls;
	ArrayList<RSSFeed> feeds;
	RSSReader reader;
	boolean keepLoading;
	
	public RSSManager(String[] names, String[] urls, ResourceInterface service){
		this.names = names; //store the names
		this.urls = urls; //store the URLS
		feeds = new ArrayList<RSSFeed>();
		resourceInterface = service;
		keepLoading = true;
		thread = new Thread(this);
		thread.start();
	}
	
	public void stopLoading(){
		keepLoading = false;
	}
	
	public void run(){
		//create a reader
		reader = new RSSReader();
		//load in the feeds
		for(int i = 0; i < urls.length; i++){
			//check we haven't been cancelled
			if(keepLoading){
				RSSFeed feed;
				try {
					feed = reader.load(new URI(urls[i]));
					feeds.add(feed);
					List<RSSItem> items = (List<RSSItem>) feed.getItems();
					//loop through the items and send them to the parent service
					resourceInterface.categoryRssLoaded((RSSItem[])items.toArray(new RSSItem[items.size()]), names[i]);
				} catch (RSSReaderException e) {
					resourceInterface.reportError(true, e.getMessage()); //report a fatal error
				} catch (URISyntaxException e) {
					resourceInterface.reportError(true, e.getMessage());
				}
			}
		}
		//report that the load is complete
		resourceInterface.loadComplete();
	}
}

{'fraction_non_alphanumeric': 0.11579523679167807, 'fraction_numerical': 0.0008212428141253764, 'mean_word_length': 3.283704572098476, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '1197550', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1140, 'n_words': 297}