Last active
September 15, 2015 16:11
-
-
Save mattwigway/230b9589be891a95e7eb to your computer and use it in GitHub Desktop.
StringNPE.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.mapdb.*; | |
import java.util.Collections; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
/** | |
* Created by matthewc on 9/15/15. | |
*/ | |
public class StringNPE { | |
public static void main (String... args) { | |
// make the features | |
List<Fun.Tuple2<String, Integer>> features = IntStream.range(1, 6061) | |
.mapToObj(i -> Fun.t2("job_geomerror." + i, (Integer) i)) | |
.collect(Collectors.toList()); | |
DB db = DBMaker.newTempFileDB().make(); | |
Iterator<Fun.Tuple2<String,Integer>> iter = Pump.sort(features.iterator(), | |
true, 100000, | |
Collections.reverseOrder((Fun.Tuple2 o1, Fun.Tuple2 o2) -> o1.compareTo(o2)), //reverse order comparator | |
db.getDefaultSerializer() | |
); | |
db.createTreeMap("test") | |
.pumpSource(iter) | |
// removing this line causes everything to work fine | |
.keySerializer(BTreeKeySerializer.STRING) | |
.make(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment