Replace explicit type with <>

This commit is contained in:
Martin Fietz 2018-01-14 17:50:32 +01:00
parent 26b938ce5b
commit cbc3b23753
11 changed files with 39 additions and 39 deletions

View File

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

View File

@ -165,7 +165,7 @@ public class FeedHandlerTest extends InstrumentationTestCase {
Feed feed = new Feed(0, null, "title", "http://example.com", "This is the description",
"http://example.com/payment", "Daniel", "en", null, "http://example.com/feed", image, file.getAbsolutePath(),
"http://example.com/feed", true);
feed.setItems(new ArrayList<FeedItem>());
feed.setItems(new ArrayList<>());
for (int i = 0; i < numItems; i++) {
FeedItem item = new FeedItem(0, "item-" + i, "http://example.com/item-" + i,

View File

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

View File

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

View File

@ -138,7 +138,7 @@ public class DBWriterTest extends InstrumentationTestCase {
image.setOwner(feed);
feed.setImage(image);
List<File> itemFiles = new ArrayList<File>();
List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files
for (int i = 0; i < 10; i++) {
FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed, true);
@ -151,7 +151,7 @@ public class DBWriterTest extends InstrumentationTestCase {
FeedMedia media = new FeedMedia(0, item, 1, 1, 1, "mime_type", enc.getAbsolutePath(), "download_url", true, null, 0, 0);
item.setMedia(media);
item.setChapters(new ArrayList<Chapter>());
item.setChapters(new ArrayList<>());
item.getChapters().add(new SimpleChapter(0, "item " + i, item, "example.com"));
}
@ -207,7 +207,7 @@ public class DBWriterTest extends InstrumentationTestCase {
feed.setImage(null);
List<File> itemFiles = new ArrayList<File>();
List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files
for (int i = 0; i < 10; i++) {
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);
feed.setImage(image);
List<File> itemFiles = new ArrayList<File>();
List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files
for (int i = 0; i < 10; i++) {
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());
adapter.open();
adapter.setQueue(queue);
@ -482,7 +482,7 @@ public class DBWriterTest extends InstrumentationTestCase {
assertNotNull(destFolder);
Feed feed = new Feed("url", null, "title");
feed.setItems(new ArrayList<FeedItem>());
feed.setItems(new ArrayList<>());
// create Feed image
File imgFile = new File(destFolder, "image");
@ -490,7 +490,7 @@ public class DBWriterTest extends InstrumentationTestCase {
image.setOwner(feed);
feed.setImage(image);
List<File> itemFiles = new ArrayList<File>();
List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files
for (int i = 0; i < 10; i++) {
FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed);
@ -539,7 +539,7 @@ public class DBWriterTest extends InstrumentationTestCase {
private FeedMedia playbackHistorySetup(Date playbackCompletionDate) {
final Context context = getInstrumentation().getTargetContext();
Feed feed = new Feed("url", null, "title");
feed.setItems(new ArrayList<FeedItem>());
feed.setItems(new ArrayList<>());
FeedItem item = new FeedItem(0, "title", "id", "link", new Date(), FeedItem.PLAYED, feed);
FeedMedia media = new FeedMedia(0, item, 10, 0, 1, "mime", null, "url", false, playbackCompletionDate, 0, 0);
feed.getItems().add(item);
@ -598,7 +598,7 @@ public class DBWriterTest extends InstrumentationTestCase {
for (FeedItem item : feed.getItems()) {
assertTrue(item.getId() != 0);
}
List<Future<?>> futures = new ArrayList<Future<?>>();
List<Future<?>> futures = new ArrayList<>();
for (FeedItem item : feed.getItems()) {
futures.add(DBWriter.addQueueItem(context, item));
}
@ -791,7 +791,7 @@ public class DBWriterTest extends InstrumentationTestCase {
public void testMarkFeedRead() throws InterruptedException, ExecutionException, TimeoutException {
final int NUM_ITEMS = 10;
Feed feed = new Feed("url", null, "title");
feed.setItems(new ArrayList<FeedItem>());
feed.setItems(new ArrayList<>());
for (int i = 0; i < NUM_ITEMS; i++) {
FeedItem item = new FeedItem(0, "title " + i, "id " + i, "link " + i, new Date(), FeedItem.UNPLAYED, feed);
feed.getItems().add(item);

View File

@ -96,7 +96,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
public void testClickNavDrawer() throws Exception {
uiTestUtils.addLocalFeedData(false);
UserPreferences.setHiddenDrawerItems(new ArrayList<String>());
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
// queue
openNavDrawer();
@ -159,7 +159,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
}
public void testDrawerPreferencesHideSomeElements() {
UserPreferences.setHiddenDrawerItems(new ArrayList<String>());
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
openNavDrawer();
solo.clickLongOnText(solo.getString(R.string.queue_label));
solo.waitForDialogToOpen();
@ -190,7 +190,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
}
public void testDrawerPreferencesHideAllElements() {
UserPreferences.setHiddenDrawerItems(new ArrayList<String>());
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
String[] titles = getInstrumentation().getTargetContext().getResources().getStringArray(R.array.nav_drawer_titles);
openNavDrawer();
@ -209,7 +209,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
}
public void testDrawerPreferencesHideCurrentElement() {
UserPreferences.setHiddenDrawerItems(new ArrayList<String>());
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
openNavDrawer();
String downloads = solo.getString(R.string.downloads_label);

View File

@ -57,7 +57,7 @@ public class UITestUtils {
private File hostedFeedDir;
private File hostedMediaDir;
public List<Feed> hostedFeeds = new ArrayList<Feed>();
public List<Feed> hostedFeeds = new ArrayList<>();
public UITestUtils(Context context) {
this.context = context;
@ -147,7 +147,7 @@ public class UITestUtils {
image.setOwner(feed);
// create items
List<FeedItem> items = new ArrayList<FeedItem>();
List<FeedItem> items = new ArrayList<>();
for (int j = 0; j < NUM_ITEMS_PER_FEED; 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);

View File

@ -49,7 +49,7 @@ public class HTTPBin extends NanoHTTPD {
public HTTPBin() {
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 int myPort;
private ServerSocket myServerSocket;
private Set<Socket> openConnections = new HashSet<Socket>();
private Set<Socket> openConnections = new HashSet<>();
private Thread myThread;
/**
* Pluggable strategy for asynchronously executing requests.
@ -342,7 +342,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).
*/
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) {
StringTokenizer st = new StringTokenizer(queryString, "&");
while (st.hasMoreTokens()) {
@ -350,7 +350,7 @@ public abstract class NanoHTTPD {
int sep = e.indexOf('=');
String propertyName = (sep >= 0) ? decodePercent(e.substring(0, sep)).trim() : decodePercent(e).trim();
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;
if (propertyValue != null) {
@ -484,7 +484,7 @@ public abstract class NanoHTTPD {
public DefaultTempFileManager() {
tmpdir = System.getProperty("java.io.tmpdir");
tempFiles = new ArrayList<TempFile>();
tempFiles = new ArrayList<>();
}
@Override
@ -557,7 +557,7 @@ public abstract class NanoHTTPD {
/**
* 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.
*/
@ -859,7 +859,7 @@ public abstract class NanoHTTPD {
this.inputStream = new PushbackInputStream(inputStream, BUFSIZE);
this.outputStream = outputStream;
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("http-client-ip", remoteIp);
@ -903,16 +903,16 @@ public abstract class NanoHTTPD {
inputStream.unread(buf, splitbyte, rlen - splitbyte);
}
parms = new ArrayMap<String, String>();
parms = new ArrayMap<>();
if(null == headers) {
headers = new ArrayMap<String, String>();
headers = new ArrayMap<>();
}
// Create a BufferedReader for parsing the header.
BufferedReader hin = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(buf, 0, rlen)));
// 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);
method = Method.lookup(pre.get("method"));
@ -1110,7 +1110,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");
}
boundarycount++;
Map<String, String> item = new ArrayMap<String, String>();
Map<String, String> item = new ArrayMap<>();
mpline = in.readLine();
while (mpline != null && mpline.trim().length() > 0) {
int p = mpline.indexOf(':');
@ -1125,7 +1125,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");
}
StringTokenizer st = new StringTokenizer(contentDisposition, ";");
Map<String, String> disposition = new ArrayMap<String, String>();
Map<String, String> disposition = new ArrayMap<>();
while (st.hasMoreTokens()) {
String token = st.nextToken().trim();
int p = token.indexOf('=');
@ -1190,7 +1190,7 @@ public abstract class NanoHTTPD {
private int[] getBoundaryPositions(ByteBuffer b, byte[] boundary) {
int matchcount = 0;
int matchbyte = -1;
List<Integer> matchbytes = new ArrayList<Integer>();
List<Integer> matchbytes = new ArrayList<>();
for (int i = 0; i < b.limit(); i++) {
if (b.get(i) == boundary[matchcount]) {
if (matchcount == 0)
@ -1360,8 +1360,8 @@ public abstract class NanoHTTPD {
* @author LordFokas
*/
public class CookieHandler implements Iterable<String> {
private ArrayMap<String, String> cookies = new ArrayMap<String, String>();
private ArrayList<Cookie> queue = new ArrayList<Cookie>();
private ArrayMap<String, String> cookies = new ArrayMap<>();
private ArrayList<Cookie> queue = new ArrayList<>();
public CookieHandler(Map<String, String> httpHeaders) {
String raw = httpHeaders.get("cookie");

View File

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

View File

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