Skip to content

Commit 3574326

Browse files
committed
Language level compatibility
1 parent 23dbea6 commit 3574326

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

library/src/main/java/com/loopj/android/http/AsyncHttpClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ public AsyncHttpClient(SchemeRegistry schemeRegistry) {
211211
ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry);
212212

213213
threadPool = Executors.newCachedThreadPool();
214-
requestMap = new WeakHashMap<Context, List<RequestHandle>>();
215-
clientHeaderMap = new HashMap<String, String>();
214+
requestMap = new WeakHashMap<>();
215+
clientHeaderMap = new HashMap<>();
216216

217217
httpContext = new SyncBasicHttpContext(new BasicHttpContext());
218218
httpClient = new DefaultHttpClient(cm, httpParams);
@@ -930,7 +930,7 @@ protected RequestHandle sendRequest(DefaultHttpClient client, HttpContext httpCo
930930
// Add request to request map
931931
List<RequestHandle> requestList = requestMap.get(context);
932932
if (requestList == null) {
933-
requestList = new LinkedList<RequestHandle>();
933+
requestList = new LinkedList<>();
934934
requestMap.put(context, requestList);
935935
}
936936

library/src/main/java/com/loopj/android/http/JsonStreamerEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ class JsonStreamerEntity implements HttpEntity {
7373

7474
// K/V objects to be uploaded.
7575
private final Map<String, Object> kvParams =
76-
new HashMap<String, Object>();
76+
new HashMap<>();
7777

7878
// Streams and their associated meta-data to be uploaded.
7979
private final Map<String, RequestParams.StreamWrapper> streamParams =
80-
new HashMap<String, RequestParams.StreamWrapper>();
80+
new HashMap<>();
8181

8282
// Whether to use gzip compression while uploading
8383
private final Header contentEncoding;

library/src/main/java/com/loopj/android/http/PersistentCookieStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class PersistentCookieStore implements CookieStore {
5959
*/
6060
public PersistentCookieStore(Context context) {
6161
cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, 0);
62-
cookies = new ConcurrentHashMap<String, Cookie>();
62+
cookies = new ConcurrentHashMap<>();
6363

6464
// Load any previously stored cookies into the store
6565
String storedCookieNames = cookiePrefs.getString(COOKIE_NAME_STORE, null);
@@ -143,7 +143,7 @@ public boolean clearExpired(Date date) {
143143

144144
@Override
145145
public List<Cookie> getCookies() {
146-
return new ArrayList<Cookie>(cookies.values());
146+
return new ArrayList<>(cookies.values());
147147
}
148148

149149
/**

library/src/main/java/com/loopj/android/http/RequestHandle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class RequestHandle {
99
private final WeakReference<AsyncHttpRequest> request;
1010

1111
public RequestHandle(AsyncHttpRequest request) {
12-
this.request = new WeakReference<AsyncHttpRequest>(request);
12+
this.request = new WeakReference<>(request);
1313
}
1414

1515
/**

library/src/main/java/com/loopj/android/http/RequestParams.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ public class RequestParams {
9393
protected final static String LOG_TAG = "RequestParams";
9494
protected boolean isRepeatable;
9595
protected boolean useJsonStreamer;
96-
protected ConcurrentHashMap<String, String> urlParams = new ConcurrentHashMap<String, String>();
97-
protected ConcurrentHashMap<String, StreamWrapper> streamParams = new ConcurrentHashMap<String, StreamWrapper>();
98-
protected ConcurrentHashMap<String, FileWrapper> fileParams = new ConcurrentHashMap<String, FileWrapper>();
99-
protected ConcurrentHashMap<String, Object> urlParamsWithObjects = new ConcurrentHashMap<String, Object>();
96+
protected ConcurrentHashMap<String, String> urlParams = new ConcurrentHashMap<>();
97+
protected ConcurrentHashMap<String, StreamWrapper> streamParams = new ConcurrentHashMap<>();
98+
protected ConcurrentHashMap<String, FileWrapper> fileParams = new ConcurrentHashMap<>();
99+
protected ConcurrentHashMap<String, Object> urlParamsWithObjects = new ConcurrentHashMap<>();
100100
protected String contentEncoding = HTTP.UTF_8;
101101

102102
/**
@@ -458,7 +458,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle
458458
}
459459

460460
protected List<BasicNameValuePair> getParamsList() {
461-
List<BasicNameValuePair> lparams = new LinkedList<BasicNameValuePair>();
461+
List<BasicNameValuePair> lparams = new LinkedList<>();
462462

463463
for (ConcurrentHashMap.Entry<String, String> entry : urlParams.entrySet()) {
464464
lparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
@@ -470,7 +470,7 @@ protected List<BasicNameValuePair> getParamsList() {
470470
}
471471

472472
private List<BasicNameValuePair> getParamsList(String key, Object value) {
473-
List<BasicNameValuePair> params = new LinkedList<BasicNameValuePair>();
473+
List<BasicNameValuePair> params = new LinkedList<>();
474474
if (value instanceof Map) {
475475
Map map = (Map) value;
476476
List list = new ArrayList<Object>(map.keySet());

library/src/main/java/com/loopj/android/http/RetryHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
import javax.net.ssl.SSLException;
4141

4242
class RetryHandler implements HttpRequestRetryHandler {
43-
private final static HashSet<Class<?>> exceptionWhitelist = new HashSet<Class<?>>();
44-
private final static HashSet<Class<?>> exceptionBlacklist = new HashSet<Class<?>>();
43+
private final static HashSet<Class<?>> exceptionWhitelist = new HashSet<>();
44+
private final static HashSet<Class<?>> exceptionBlacklist = new HashSet<>();
4545

4646
static {
4747
// Retry if the server dropped connection on us

library/src/main/java/com/loopj/android/http/SimpleMultipartEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class SimpleMultipartEntity implements HttpEntity {
6161
private final byte[] boundaryEnd;
6262
private boolean isRepeatable;
6363

64-
private final List<FilePart> fileParts = new ArrayList<FilePart>();
64+
private final List<FilePart> fileParts = new ArrayList<>();
6565

6666
// The buffer we use for building the message excluding files and the last
6767
// boundary

sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void onClick(View v) {
8383
};
8484

8585
protected Header[] getRequestHeaders() {
86-
List<Header> headers = new ArrayList<Header>();
86+
List<Header> headers = new ArrayList<>();
8787
String headersRaw = headersEditText.getText() == null ? null : headersEditText.getText().toString();
8888

8989
if (headersRaw != null && headersRaw.length() > 3) {

sample/src/main/java/com/loopj/android/http/sample/WaypointsActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class WaypointsActivity extends ListActivity {
1414
@Override
1515
protected void onCreate(Bundle savedInstanceState) {
1616
super.onCreate(savedInstanceState);
17-
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, samples));
17+
setListAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, samples));
1818
}
1919

2020
@Override

0 commit comments

Comments
 (0)