Commit 827dfb70 authored by Christian MOMON's avatar Christian MOMON
Browse files

Fixed Java 8 compatibility bug about Collections.sort. Improved readers

comparator.
parent dfd518c6
......@@ -41,7 +41,7 @@ public class FileSortingConcatenator implements StringListReader
public static final String DEFAULT_CHARSET_NAME = "UTF-8";
private SingleLineBufferedFileReaders readers;
private Comparator<String> comparator;
private SingleLineBufferedFileReaderComparator comparator;
/**
* Instantiates a new file sorting concatenator.
......@@ -70,7 +70,7 @@ public class FileSortingConcatenator implements StringListReader
{
//
this.readers = new SingleLineBufferedFileReaders(files.size());
this.comparator = comparator;
this.comparator = new SingleLineBufferedFileReaderComparator(comparator);
//
for (File file : files)
......@@ -139,7 +139,7 @@ public class FileSortingConcatenator implements StringListReader
Chronometer chrono = new Chronometer();
while (!ended)
{
if (lineCount % 100000 == 0)
if (lineCount % 1000000 == 0)
{
System.gc();
......
......@@ -43,8 +43,6 @@ public class SingleLineBufferedFileReaderComparator implements Comparator<Single
*/
public SingleLineBufferedFileReaderComparator(final Comparator<String> comparator)
{
super();
this.comparator = comparator;
}
......
......@@ -20,7 +20,6 @@ package org.tip.flatdb4geonames.util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
/**
* The Class SingleLineBufferedFileReaders.
......@@ -56,7 +55,7 @@ public class SingleLineBufferedFileReaders extends ArrayList<SingleLineBufferedF
*/
public void sort()
{
sort(null);
sort(new SingleLineBufferedFileReaderComparator());
}
/**
......@@ -65,9 +64,8 @@ public class SingleLineBufferedFileReaders extends ArrayList<SingleLineBufferedF
* @param comparator
* the comparator
*/
public void sort(final Comparator<String> comparator)
public void sort(final SingleLineBufferedFileReaderComparator comparator)
{
Collections.sort(this, new SingleLineBufferedFileReaderComparator(comparator));
Collections.sort(this, comparator);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment