http lib | connect timeout (ms) | read timeout | write timeout | concurrency |
---|---|---|---|---|
OkHttp, retrofit, picasso |
10,000 | 10,000 | 10,000 | 64 total, 5 per host |
Volley |
2,500 | 2,500 | 2,500 | 4 |
HttpUrlConnection |
up to few minutes | up to few minutes | n/a | 5 |
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
//Dispatcher.java | |
/** | |
* Policy on when async requests are executed. | |
* | |
* <p>Each dispatcher uses an {@link ExecutorService} to run calls internally. If you supply your | |
* own executor, it should be able to run {@linkplain #getMaxRequests the configured maximum} number | |
* of calls concurrently. | |
*/ | |
public final class Dispatcher { | |
private int maxRequests = 64; |
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 final OkHttpClient client; | |
public ConfigureTimeouts() throws Exception { | |
client = new OkHttpClient.Builder() | |
.connectTimeout(10, TimeUnit.SECONDS) | |
.writeTimeout(10, TimeUnit.SECONDS) | |
.readTimeout(30, TimeUnit.SECONDS) | |
.build(); | |
} |
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
#include <iostream> | |
#include <map> | |
using namespace std; | |
void print(int *a, int num) { | |
for (int i = 0; i < num; i++) { | |
cout << " " << a[i]; | |
} |
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
// Compiled with: g++ -Wall -std=c++14 -pthread | |
#include <iostream> | |
#include <vector> | |
#include <map> | |
using namespace std; | |
//print array | |
void print(int* arr, int n) { |
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
#include <iostream> | |
#include <map> | |
#include <unordered_map> | |
#include <unordered_set> | |
#include <algorithm> | |
#include <sstream> | |
#include <climits> | |
#include <bits/stdc++.h> | |
using namespace std; |
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
#include <iostream> | |
#include <vector> | |
#include <bitset> | |
#include <math.h> | |
#include <climits> | |
using namespace std; | |
/* | |
static string ToBinaryString(float 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
#include <iostream> | |
#include <list> | |
#include <stdlib.h> | |
#include <climits> | |
#include <bits/stdc++.h> | |
using namespace std; | |
class graph { |
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
#include <iostream> | |
using namespace std; | |
typedef struct node { | |
int data; | |
node() : data(0), left(NULL), right(NULL) {} | |
node(int d) { | |
data = d; |
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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
// Max Heap impl | |
struct PriorityQueue { | |
private: | |
vector<int> A; |
OlderNewer