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 java.util.HashMap; | |
import java.util.Map; | |
public class Foo { | |
static class Mutable { | |
int value; | |
Mutable(int value) { | |
this.value = value; | |
} |
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
package com.google.common.collect; | |
import com.google.caliper.Runner; | |
import com.google.caliper.SimpleBenchmark; | |
import java.util.Random; | |
public class NullCheck extends SimpleBenchmark { | |
Object[] array = new Object[0x10000]; |
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 com.google.caliper.Runner; | |
import com.google.caliper.SimpleBenchmark; | |
import com.google.common.base.Function; | |
import com.google.common.collect.ImmutableList; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Random; | |
import org.funcito.Funcito; |
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
class Node { | |
public int data; | |
public Node next; | |
public Node(int data, Node next) { | |
this.data = data; this.next = next; | |
} | |
} | |
class LongIntParallelHashMultimap { | |
Node[] l ; |
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
class Test { | |
public static void main(String[] args) { | |
List<Integer> voterA = Arrays.asList(1,2,3,4,5); | |
List<Integer> voterB = Arrays.asList(1,2,3,4,5); | |
List<List<Integer>> votes = Arrays.asList(voterA, voterB); | |
System.out.println( | |
IntStream.range(0, votes.stream().mapToInt(List::size).max().getAsInt()) | |
.mapToInt(i -> votes.stream().mapToInt(voter -> voter.get(i)).sum()) | |
.collect(Collectors.toList())); |