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
@Benchmark | |
public void C3_hugeListStreamPartitioned() { | |
final List<List<Integer>> result = list.stream() | |
.collect(partitioned(chunkSize)); | |
assertThat(result).hasSize(expectedSize); | |
assertThat(result.get(chunkIndex)).isEqualTo(expectedChunk); | |
} | |
@Benchmark |
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
public final class Partition<T> extends AbstractList<List<T>> { | |
private final List<T> list; | |
private final int chunkSize; | |
public Partition(List<T> list, int chunkSize) { | |
this.list = new ArrayList<>(list); | |
this.chunkSize = chunkSize; | |
} |
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
@Benchmark | |
public void A3_smallListStreamPartitioned() { | |
final List<List<Integer>> result = list.stream() | |
.collect(partitioned(chunkSize)); | |
assertThat(result).hasSize(partitionedSize); | |
assertThat(result.get(chunkIndex)).isEqualTo(expectedChunk); | |
} | |
@Benchmark | |
public void A4_smallListToPartition() { |
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
private static final int LIST_SIZE = 20; | |
private int chunkSize; | |
private List<Integer> expectedChunk; | |
private int chunkIndex; | |
private int partitionedSize; | |
private static final List<Integer> list = IntStream.range(0, LIST_SIZE + random.nextInt(13)).boxed().collect(toList()); | |
@Setup(Level.Iteration) | |
public void setup() { |
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 edu.optimization.imageupload.entity.Image; | |
import edu.optimization.imageupload.service.ImageService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.core.env.Environment; | |
import org.springframework.core.io.ByteArrayResource; | |
import org.springframework.core.io.Resource; | |
import org.springframework.http.HttpHeaders; | |
import org.springframework.http.MediaType; | |
import org.springframework.http.ResponseEntity; | |
import org.springframework.web.bind.annotation.*; |
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.upgrad.average; | |
import java.io.IOException; | |
import org.apache.hadoop.io.FloatWritable; | |
import org.apache.hadoop.io.IntWritable; | |
import org.apache.hadoop.io.Text; | |
import org.apache.hadoop.mapreduce.Reducer; | |
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.BitSet; | |
/* | |
* @author: Ankit.Maurya | |
*/ | |
public class BloomFilter { | |
BitSet bitset = null; | |
int numOfHashFun; |
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.Entry; | |
class Record { | |
String name; | |
long number; | |
} | |
public class HashDictionary { |
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.Arrays; | |
public class DemoChild extends DemoConstructor { | |
public DemoChild(int[] array) { | |
super(array); | |
System.out.println("Child" + Arrays.toString(array)); | |
} | |
public static void main(String[] args) { |
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
console.log(new Date().getTime() + (5*60*60*1000)+(30*60*1000)); | |
var d = new Date(new Date().getTime() + (5*60*60*1000)+(30*60*1000)); // Calculationsa are to convert into IST | |
console.log(d.toISOString().replace('T',' ').substring(0,19)); |
NewerOlder