Merge pull request #2034 from DevFactory/release/The_diamond_operator_should_be_used

squid:S2293 - The diamond operator ("<>") should be used
This commit is contained in:
Martin Fietz 2016-06-23 10:34:09 +02:00 committed by GitHub
commit b47dc10b2a
9 changed files with 31 additions and 31 deletions

View File

@ -38,14 +38,14 @@ public class GPodnetServiceTest extends AndroidTestCase {
public void testUploadSubscription() throws GpodnetServiceException { public void testUploadSubscription() throws GpodnetServiceException {
authenticate(); authenticate();
ArrayList<String> l = new ArrayList<String>(); ArrayList<String> l = new ArrayList<>();
l.add("http://bitsundso.de/feed"); l.add("http://bitsundso.de/feed");
service.uploadSubscriptions(USER, "radio", l); service.uploadSubscriptions(USER, "radio", l);
} }
public void testUploadSubscription2() throws GpodnetServiceException { public void testUploadSubscription2() throws GpodnetServiceException {
authenticate(); authenticate();
ArrayList<String> l = new ArrayList<String>(); ArrayList<String> l = new ArrayList<>();
l.add("http://bitsundso.de/feed"); l.add("http://bitsundso.de/feed");
l.add("http://gamesundso.de/feed"); l.add("http://gamesundso.de/feed");
service.uploadSubscriptions(USER, "radio", l); service.uploadSubscriptions(USER, "radio", l);

View File

@ -145,9 +145,9 @@ public class DBCleanupTests extends InstrumentationTestCase {
final int NUM_ITEMS = EPISODE_CACHE_SIZE * 2; final int NUM_ITEMS = EPISODE_CACHE_SIZE * 2;
Feed feed = new Feed("url", null, "title"); Feed feed = new Feed("url", null, "title");
List<FeedItem> items = new ArrayList<FeedItem>(); List<FeedItem> items = new ArrayList<>();
feed.setItems(items); feed.setItems(items);
List<File> files = new ArrayList<File>(); List<File> files = new ArrayList<>();
populateItems(NUM_ITEMS, feed, items, files, FeedItem.UNPLAYED, false, false); populateItems(NUM_ITEMS, feed, items, files, FeedItem.UNPLAYED, false, false);
DBTasks.performAutoCleanup(context); DBTasks.performAutoCleanup(context);

View File

@ -100,7 +100,7 @@ public class DBTasksTest extends InstrumentationTestCase {
assertTrue(feed.getId() != 0); assertTrue(feed.getId() != 0);
final long feedID = feed.getId(); final long feedID = feed.getId();
feed.setId(0); feed.setId(0);
List<Long> itemIDs = new ArrayList<Long>(); List<Long> itemIDs = new ArrayList<>();
for (FeedItem item : feed.getItems()) { for (FeedItem item : feed.getItems()) {
assertTrue(item.getId() != 0); assertTrue(item.getId() != 0);
itemIDs.add(item.getId()); itemIDs.add(item.getId());

View File

@ -138,7 +138,7 @@ public class DBWriterTest extends InstrumentationTestCase {
image.setOwner(feed); image.setOwner(feed);
feed.setImage(image); feed.setImage(image);
List<File> itemFiles = new ArrayList<File>(); List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files // create items with downloaded media files
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed, true); FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed, true);
@ -207,7 +207,7 @@ public class DBWriterTest extends InstrumentationTestCase {
feed.setImage(null); feed.setImage(null);
List<File> itemFiles = new ArrayList<File>(); List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files // create items with downloaded media files
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed); FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed);
@ -418,7 +418,7 @@ public class DBWriterTest extends InstrumentationTestCase {
image.setOwner(feed); image.setOwner(feed);
feed.setImage(image); feed.setImage(image);
List<File> itemFiles = new ArrayList<File>(); List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files // create items with downloaded media files
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed); FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed);
@ -444,7 +444,7 @@ public class DBWriterTest extends InstrumentationTestCase {
} }
List<FeedItem> queue = new ArrayList<FeedItem>(); List<FeedItem> queue = new ArrayList<>();
queue.addAll(feed.getItems()); queue.addAll(feed.getItems());
adapter.open(); adapter.open();
adapter.setQueue(queue); adapter.setQueue(queue);
@ -482,7 +482,7 @@ public class DBWriterTest extends InstrumentationTestCase {
assertNotNull(destFolder); assertNotNull(destFolder);
Feed feed = new Feed("url", null, "title"); Feed feed = new Feed("url", null, "title");
feed.setItems(new ArrayList<FeedItem>()); feed.setItems(new ArrayList<>());
// create Feed image // create Feed image
File imgFile = new File(destFolder, "image"); File imgFile = new File(destFolder, "image");
@ -490,7 +490,7 @@ public class DBWriterTest extends InstrumentationTestCase {
image.setOwner(feed); image.setOwner(feed);
feed.setImage(image); feed.setImage(image);
List<File> itemFiles = new ArrayList<File>(); List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files // create items with downloaded media files
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed); FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed);
@ -598,7 +598,7 @@ public class DBWriterTest extends InstrumentationTestCase {
for (FeedItem item : feed.getItems()) { for (FeedItem item : feed.getItems()) {
assertTrue(item.getId() != 0); assertTrue(item.getId() != 0);
} }
List<Future<?>> futures = new ArrayList<Future<?>>(); List<Future<?>> futures = new ArrayList<>();
for (FeedItem item : feed.getItems()) { for (FeedItem item : feed.getItems()) {
futures.add(DBWriter.addQueueItem(context, item)); futures.add(DBWriter.addQueueItem(context, item));
} }

View File

@ -59,7 +59,7 @@ public class UITestUtils {
private File hostedFeedDir; private File hostedFeedDir;
private File hostedMediaDir; private File hostedMediaDir;
public List<Feed> hostedFeeds = new ArrayList<Feed>(); public List<Feed> hostedFeeds = new ArrayList<>();
public UITestUtils(Context context) { public UITestUtils(Context context) {
this.context = context; this.context = context;
@ -149,7 +149,7 @@ public class UITestUtils {
image.setOwner(feed); image.setOwner(feed);
// create items // create items
List<FeedItem> items = new ArrayList<FeedItem>(); List<FeedItem> items = new ArrayList<>();
for (int j = 0; j < NUM_ITEMS_PER_FEED; j++) { for (int j = 0; j < NUM_ITEMS_PER_FEED; j++) {
FeedItem item = new FeedItem(j, "Feed " + (i+1) + ": Item " + (j+1), "item" + j, FeedItem item = new FeedItem(j, "Feed " + (i+1) + ": Item " + (j+1), "item" + j,
"http://example.com/feed" + i + "/item/" + j, new Date(), FeedItem.UNPLAYED, feed); "http://example.com/feed" + i + "/item/" + j, new Date(), FeedItem.UNPLAYED, feed);

View File

@ -49,7 +49,7 @@ public class HTTPBin extends NanoHTTPD {
public HTTPBin() { public HTTPBin() {
super(PORT); super(PORT);
this.servedFiles = new ArrayList<File>(); this.servedFiles = new ArrayList<>();
} }
/** /**

View File

@ -104,7 +104,7 @@ public abstract class NanoHTTPD {
private final String hostname; private final String hostname;
private final int myPort; private final int myPort;
private ServerSocket myServerSocket; private ServerSocket myServerSocket;
private Set<Socket> openConnections = new HashSet<Socket>(); private Set<Socket> openConnections = new HashSet<>();
private Thread myThread; private Thread myThread;
/** /**
* Pluggable strategy for asynchronously executing requests. * Pluggable strategy for asynchronously executing requests.
@ -348,7 +348,7 @@ public abstract class NanoHTTPD {
* @return a map of <code>String</code> (parameter name) to <code>List&lt;String&gt;</code> (a list of the values supplied). * @return a map of <code>String</code> (parameter name) to <code>List&lt;String&gt;</code> (a list of the values supplied).
*/ */
protected Map<String, List<String>> decodeParameters(String queryString) { protected Map<String, List<String>> decodeParameters(String queryString) {
Map<String, List<String>> parms = new ArrayMap<String, List<String>>(); Map<String, List<String>> parms = new ArrayMap<>();
if (queryString != null) { if (queryString != null) {
StringTokenizer st = new StringTokenizer(queryString, "&"); StringTokenizer st = new StringTokenizer(queryString, "&");
while (st.hasMoreTokens()) { while (st.hasMoreTokens()) {
@ -356,7 +356,7 @@ public abstract class NanoHTTPD {
int sep = e.indexOf('='); int sep = e.indexOf('=');
String propertyName = (sep >= 0) ? decodePercent(e.substring(0, sep)).trim() : decodePercent(e).trim(); String propertyName = (sep >= 0) ? decodePercent(e.substring(0, sep)).trim() : decodePercent(e).trim();
if (!parms.containsKey(propertyName)) { if (!parms.containsKey(propertyName)) {
parms.put(propertyName, new ArrayList<String>()); parms.put(propertyName, new ArrayList<>());
} }
String propertyValue = (sep >= 0) ? decodePercent(e.substring(sep + 1)) : null; String propertyValue = (sep >= 0) ? decodePercent(e.substring(sep + 1)) : null;
if (propertyValue != null) { if (propertyValue != null) {
@ -490,7 +490,7 @@ public abstract class NanoHTTPD {
public DefaultTempFileManager() { public DefaultTempFileManager() {
tmpdir = System.getProperty("java.io.tmpdir"); tmpdir = System.getProperty("java.io.tmpdir");
tempFiles = new ArrayList<TempFile>(); tempFiles = new ArrayList<>();
} }
@Override @Override
@ -563,7 +563,7 @@ public abstract class NanoHTTPD {
/** /**
* Headers for the HTTP response. Use addHeader() to add lines. * Headers for the HTTP response. Use addHeader() to add lines.
*/ */
private Map<String, String> header = new ArrayMap<String, String>(); private Map<String, String> header = new ArrayMap<>();
/** /**
* The request method that spawned this response. * The request method that spawned this response.
*/ */
@ -865,7 +865,7 @@ public abstract class NanoHTTPD {
this.inputStream = new PushbackInputStream(inputStream, BUFSIZE); this.inputStream = new PushbackInputStream(inputStream, BUFSIZE);
this.outputStream = outputStream; this.outputStream = outputStream;
String remoteIp = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "127.0.0.1" : inetAddress.getHostAddress().toString(); String remoteIp = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "127.0.0.1" : inetAddress.getHostAddress().toString();
headers = new ArrayMap<String, String>(); headers = new ArrayMap<>();
headers.put("remote-addr", remoteIp); headers.put("remote-addr", remoteIp);
headers.put("http-client-ip", remoteIp); headers.put("http-client-ip", remoteIp);
@ -909,16 +909,16 @@ public abstract class NanoHTTPD {
inputStream.unread(buf, splitbyte, rlen - splitbyte); inputStream.unread(buf, splitbyte, rlen - splitbyte);
} }
parms = new ArrayMap<String, String>(); parms = new ArrayMap<>();
if(null == headers) { if(null == headers) {
headers = new ArrayMap<String, String>(); headers = new ArrayMap<>();
} }
// Create a BufferedReader for parsing the header. // Create a BufferedReader for parsing the header.
BufferedReader hin = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(buf, 0, rlen))); BufferedReader hin = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(buf, 0, rlen)));
// Decode the header into parms and header java properties // Decode the header into parms and header java properties
Map<String, String> pre = new ArrayMap<String, String>(); Map<String, String> pre = new ArrayMap<>();
decodeHeader(hin, pre, parms, headers); decodeHeader(hin, pre, parms, headers);
method = Method.lookup(pre.get("method")); method = Method.lookup(pre.get("method"));
@ -1116,7 +1116,7 @@ public abstract class NanoHTTPD {
throw new ResponseException(Response.Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but next chunk does not start with boundary. Usage: GET /example/file.html"); throw new ResponseException(Response.Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but next chunk does not start with boundary. Usage: GET /example/file.html");
} }
boundarycount++; boundarycount++;
Map<String, String> item = new ArrayMap<String, String>(); Map<String, String> item = new ArrayMap<>();
mpline = in.readLine(); mpline = in.readLine();
while (mpline != null && mpline.trim().length() > 0) { while (mpline != null && mpline.trim().length() > 0) {
int p = mpline.indexOf(':'); int p = mpline.indexOf(':');
@ -1131,7 +1131,7 @@ public abstract class NanoHTTPD {
throw new ResponseException(Response.Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but no content-disposition info found. Usage: GET /example/file.html"); throw new ResponseException(Response.Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but no content-disposition info found. Usage: GET /example/file.html");
} }
StringTokenizer st = new StringTokenizer(contentDisposition, ";"); StringTokenizer st = new StringTokenizer(contentDisposition, ";");
Map<String, String> disposition = new ArrayMap<String, String>(); Map<String, String> disposition = new ArrayMap<>();
while (st.hasMoreTokens()) { while (st.hasMoreTokens()) {
String token = st.nextToken().trim(); String token = st.nextToken().trim();
int p = token.indexOf('='); int p = token.indexOf('=');
@ -1196,7 +1196,7 @@ public abstract class NanoHTTPD {
private int[] getBoundaryPositions(ByteBuffer b, byte[] boundary) { private int[] getBoundaryPositions(ByteBuffer b, byte[] boundary) {
int matchcount = 0; int matchcount = 0;
int matchbyte = -1; int matchbyte = -1;
List<Integer> matchbytes = new ArrayList<Integer>(); List<Integer> matchbytes = new ArrayList<>();
for (int i = 0; i < b.limit(); i++) { for (int i = 0; i < b.limit(); i++) {
if (b.get(i) == boundary[matchcount]) { if (b.get(i) == boundary[matchcount]) {
if (matchcount == 0) if (matchcount == 0)
@ -1366,8 +1366,8 @@ public abstract class NanoHTTPD {
* @author LordFokas * @author LordFokas
*/ */
public class CookieHandler implements Iterable<String> { public class CookieHandler implements Iterable<String> {
private ArrayMap<String, String> cookies = new ArrayMap<String, String>(); private ArrayMap<String, String> cookies = new ArrayMap<>();
private ArrayList<Cookie> queue = new ArrayList<Cookie>(); private ArrayList<Cookie> queue = new ArrayList<>();
public CookieHandler(Map<String, String> httpHeaders) { public CookieHandler(Map<String, String> httpHeaders) {
String raw = httpHeaders.get("cookie"); String raw = httpHeaders.get("cookie");

View File

@ -99,7 +99,7 @@ public class OpmlFeedChooserActivity extends AppCompatActivity {
} }
private List<String> getTitleList() { private List<String> getTitleList() {
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<>();
if (OpmlImportHolder.getReadElements() != null) { if (OpmlImportHolder.getReadElements() != null) {
for (OpmlElement element : OpmlImportHolder.getReadElements()) { for (OpmlElement element : OpmlImportHolder.getReadElements()) {
result.add(element.getText()); result.add(element.getText());

View File

@ -118,7 +118,7 @@ public class FlattrUtils {
public static List<Flattr> retrieveFlattredThings() public static List<Flattr> retrieveFlattredThings()
throws FlattrException { throws FlattrException {
ArrayList<Flattr> myFlattrs = new ArrayList<Flattr>(); ArrayList<Flattr> myFlattrs = new ArrayList<>();
if (hasToken()) { if (hasToken()) {
FlattrService fs = FlattrServiceCreator.getService(retrieveToken()); FlattrService fs = FlattrServiceCreator.getService(retrieveToken());