aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cgeo-calendar/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--cgeo-calendar/src/cgeo/calendar/CalendarActivity.java4
-rw-r--r--cgeo-contacts/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--cgeo-contacts/src/cgeo/contacts/ContactsActivity.java6
-rw-r--r--main/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--main/src/cgeo/geocaching/CacheCache.java4
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java8
-rw-r--r--main/src/cgeo/geocaching/CacheListActivity.java8
-rw-r--r--main/src/cgeo/geocaching/CompassActivity.java2
-rw-r--r--main/src/cgeo/geocaching/DataStore.java46
-rw-r--r--main/src/cgeo/geocaching/EditWaypointActivity.java10
-rw-r--r--main/src/cgeo/geocaching/Geocache.java30
-rw-r--r--main/src/cgeo/geocaching/ImagesActivity.java2
-rw-r--r--main/src/cgeo/geocaching/LogCacheActivity.java8
-rw-r--r--main/src/cgeo/geocaching/LogEntry.java4
-rw-r--r--main/src/cgeo/geocaching/LogTrackableActivity.java2
-rw-r--r--main/src/cgeo/geocaching/MainActivity.java6
-rw-r--r--main/src/cgeo/geocaching/SearchResult.java18
-rw-r--r--main/src/cgeo/geocaching/SelectMapfileActivity.java2
-rw-r--r--main/src/cgeo/geocaching/StaticMapsActivity.java2
-rw-r--r--main/src/cgeo/geocaching/StaticMapsProvider.java4
-rw-r--r--main/src/cgeo/geocaching/Trackable.java4
-rw-r--r--main/src/cgeo/geocaching/TrackableActivity.java2
-rw-r--r--main/src/cgeo/geocaching/Waypoint.java4
-rw-r--r--main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java6
-rw-r--r--main/src/cgeo/geocaching/apps/AbstractLocusApp.java4
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java8
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java2
-rw-r--r--main/src/cgeo/geocaching/concurrent/BlockingThreadPool.java2
-rw-r--r--main/src/cgeo/geocaching/connector/AbstractConnector.java6
-rw-r--r--main/src/cgeo/geocaching/connector/ConnectorFactory.java4
-rw-r--r--main/src/cgeo/geocaching/connector/ec/ECApi.java2
-rw-r--r--main/src/cgeo/geocaching/connector/ec/ECConnector.java2
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCLogin.java2
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCMap.java16
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCParser.java28
-rw-r--r--main/src/cgeo/geocaching/connector/gc/Tile.java4
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OkapiClient.java18
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheAttribute.java4
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheSize.java2
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheType.java6
-rw-r--r--main/src/cgeo/geocaching/enumerations/LogType.java4
-rw-r--r--main/src/cgeo/geocaching/enumerations/WaypointType.java4
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java4
-rw-r--r--main/src/cgeo/geocaching/export/GpxSerializer.java6
-rw-r--r--main/src/cgeo/geocaching/files/AbstractFileListActivity.java8
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java10
-rw-r--r--main/src/cgeo/geocaching/files/LocParser.java6
-rw-r--r--main/src/cgeo/geocaching/files/LocalStorage.java2
-rw-r--r--main/src/cgeo/geocaching/files/SimpleDirChooser.java2
-rw-r--r--main/src/cgeo/geocaching/filter/AbstractFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/AttributeFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/DifficultyFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/DistanceFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/FilterUserInterface.java6
-rw-r--r--main/src/cgeo/geocaching/filter/OriginFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/PopularityFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/PopularityRatioFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/SizeFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/StateFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/TerrainFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/TypeFilter.java2
-rw-r--r--main/src/cgeo/geocaching/gcvote/GCVote.java6
-rw-r--r--main/src/cgeo/geocaching/geopoint/Units.java2
-rw-r--r--main/src/cgeo/geocaching/list/AbstractList.java2
-rw-r--r--main/src/cgeo/geocaching/list/StoredList.java6
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java44
-rw-r--r--main/src/cgeo/geocaching/maps/CachesOverlay.java6
-rw-r--r--main/src/cgeo/geocaching/maps/MapProviderFactory.java4
-rw-r--r--main/src/cgeo/geocaching/maps/PositionDrawer.java2
-rw-r--r--main/src/cgeo/geocaching/maps/PositionHistory.java2
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java2
-rw-r--r--main/src/cgeo/geocaching/network/HtmlImage.java12
-rw-r--r--main/src/cgeo/geocaching/network/OAuth.java2
-rw-r--r--main/src/cgeo/geocaching/settings/CheckECCredentialsPreference.java2
-rw-r--r--main/src/cgeo/geocaching/settings/OCPreferenceKeys.java6
-rw-r--r--main/src/cgeo/geocaching/settings/Settings.java14
-rw-r--r--main/src/cgeo/geocaching/sorting/DateComparator.java2
-rw-r--r--main/src/cgeo/geocaching/sorting/SortActionProvider.java2
-rw-r--r--main/src/cgeo/geocaching/ui/AbstractUserClickListener.java2
-rw-r--r--main/src/cgeo/geocaching/ui/AddressListAdapter.java2
-rw-r--r--main/src/cgeo/geocaching/ui/CacheDetailsCreator.java2
-rw-r--r--main/src/cgeo/geocaching/ui/CacheListAdapter.java20
-rw-r--r--main/src/cgeo/geocaching/ui/CompassView.java2
-rw-r--r--main/src/cgeo/geocaching/ui/Formatter.java8
-rw-r--r--main/src/cgeo/geocaching/ui/ImagesList.java4
-rw-r--r--main/src/cgeo/geocaching/ui/LoggingUI.java4
-rw-r--r--main/src/cgeo/geocaching/ui/WeakReferenceHandler.java2
-rw-r--r--main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java4
-rw-r--r--main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java3
-rw-r--r--main/src/cgeo/geocaching/utils/HtmlUtils.java2
-rw-r--r--main/src/cgeo/geocaching/utils/LazyInitializedList.java2
-rw-r--r--main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java8
-rw-r--r--main/src/cgeo/geocaching/utils/LogTemplateProvider.java2
-rw-r--r--main/src/cgeo/geocaching/utils/SimpleCancellableHandler.java4
-rw-r--r--main/src/cgeo/geocaching/utils/SimpleHandler.java4
-rw-r--r--tests/.settings/org.eclipse.jdt.core.prefs7
98 files changed, 294 insertions, 292 deletions
diff --git a/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs b/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs
index 4295a0b..6ae8f9e 100644
--- a/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs
+++ b/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs
@@ -6,9 +6,10 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -96,7 +97,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java b/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java
index ad54bab..2fbfd05 100644
--- a/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java
+++ b/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java
@@ -43,7 +43,7 @@ public final class CalendarActivity extends Activity {
/**
* Adds the cache to the Android-calendar if it is an event.
- *
+ *
* @param entry
*/
private void selectCalendarForAdding(final CalendarEntry entry) {
@@ -58,7 +58,7 @@ public final class CalendarActivity extends Activity {
return;
}
- final SparseArray<String> calendars = new SparseArray<String>();
+ final SparseArray<String> calendars = new SparseArray<>();
cursor.moveToFirst();
final int indexId = cursor.getColumnIndex("_id");
diff --git a/cgeo-contacts/.settings/org.eclipse.jdt.core.prefs b/cgeo-contacts/.settings/org.eclipse.jdt.core.prefs
index e08a777..90a6f5b 100644
--- a/cgeo-contacts/.settings/org.eclipse.jdt.core.prefs
+++ b/cgeo-contacts/.settings/org.eclipse.jdt.core.prefs
@@ -6,9 +6,10 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -96,7 +97,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/cgeo-contacts/src/cgeo/contacts/ContactsActivity.java b/cgeo-contacts/src/cgeo/contacts/ContactsActivity.java
index 098f5b9..bbda493 100644
--- a/cgeo-contacts/src/cgeo/contacts/ContactsActivity.java
+++ b/cgeo-contacts/src/cgeo/contacts/ContactsActivity.java
@@ -73,7 +73,7 @@ public final class ContactsActivity extends Activity {
}
private void selectContact(final List<Pair<Integer, String>> contacts) {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
for (Pair<Integer, String> p : contacts) {
list.add(p.second);
}
@@ -105,13 +105,13 @@ public final class ContactsActivity extends Activity {
final String[] selectionArgs = new String[] { like ? "%" + searchName + "%" : searchName };
Cursor cursor = null;
- List<Pair<Integer, String>> result = new ArrayList<Pair<Integer, String>>();
+ List<Pair<Integer, String>> result = new ArrayList<>();
try {
cursor = getContentResolver().query(uri, projection, selection, selectionArgs, null);
while (cursor != null && cursor.moveToNext()) {
int foundId = cursor.getInt(0);
String foundName = cursor.getString(1);
- result.add(new Pair<Integer, String>(foundId, foundName));
+ result.add(new Pair<>(foundId, foundName));
}
} catch (Exception e) {
Log.e(LOG_TAG, "ContactsActivity.getContactId", e);
diff --git a/main/.settings/org.eclipse.jdt.core.prefs b/main/.settings/org.eclipse.jdt.core.prefs
index 18acc66..0de28b5 100644
--- a/main/.settings/org.eclipse.jdt.core.prefs
+++ b/main/.settings/org.eclipse.jdt.core.prefs
@@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -122,7 +122,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.processAnnotations=enabled
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/main/src/cgeo/geocaching/CacheCache.java b/main/src/cgeo/geocaching/CacheCache.java
index cb4e14c..1913d3c 100644
--- a/main/src/cgeo/geocaching/CacheCache.java
+++ b/main/src/cgeo/geocaching/CacheCache.java
@@ -23,7 +23,7 @@ public class CacheCache {
final private LeastRecentlyUsedMap<String, Geocache> cachesCache;
public CacheCache() {
- cachesCache = new LeastRecentlyUsedMap.LruCache<String, Geocache>(MAX_CACHED_CACHES);
+ cachesCache = new LeastRecentlyUsedMap.LruCache<>(MAX_CACHED_CACHES);
cachesCache.setRemoveHandler(new CacheRemoveHandler());
}
@@ -79,7 +79,7 @@ public class CacheCache {
}
public synchronized Set<String> getInViewport(final Viewport viewport, final CacheType cacheType) {
- final Set<String> geocodes = new HashSet<String>();
+ final Set<String> geocodes = new HashSet<>();
for (final Geocache cache : cachesCache.values()) {
if (cache.getCoords() == null) {
// FIXME: this kludge must be removed, it is only present to help us debug the cases where
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 4b14930..7d044e7 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -475,7 +475,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
private final WeakReference<CacheDetailActivity> activityRef;
public CacheDetailsGeoDirHandler(final CacheDetailActivity activity) {
- this.activityRef = new WeakReference<CacheDetailActivity>(activity);
+ this.activityRef = new WeakReference<>(activity);
}
@Override
@@ -1685,7 +1685,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
}
// sort waypoints: PP, Sx, FI, OWN
- final List<Waypoint> sortedWaypoints = new ArrayList<Waypoint>(cache.getWaypoints());
+ final List<Waypoint> sortedWaypoints = new ArrayList<>(cache.getWaypoints());
Collections.sort(sortedWaypoints, Waypoint.WAYPOINT_COMPARATOR);
view = (ListView) getLayoutInflater().inflate(R.layout.cachedetail_waypoints_page, parentView, false);
@@ -1852,7 +1852,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
// TODO: fix layout, then switch back to Android-resource and delete copied one
// this copy is modified to respect the text color
- view.setAdapter(new ArrayAdapter<Trackable>(CacheDetailActivity.this, R.layout.simple_list_item_1, cache.getInventory()));
+ view.setAdapter(new ArrayAdapter<>(CacheDetailActivity.this, R.layout.simple_list_item_1, cache.getInventory()));
view.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(final AdapterView<?> arg0, final View arg1, final int arg2, final long arg3) {
@@ -2133,7 +2133,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
@Override
protected Pair<List<? extends Page>, Integer> getOrderedPages() {
- final ArrayList<Page> pages = new ArrayList<Page>();
+ final ArrayList<Page> pages = new ArrayList<>();
pages.add(Page.WAYPOINTS);
pages.add(Page.DETAILS);
final int detailsIndex = pages.size() - 1;
diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java
index 8c77891..7f628d3 100644
--- a/main/src/cgeo/geocaching/CacheListActivity.java
+++ b/main/src/cgeo/geocaching/CacheListActivity.java
@@ -121,7 +121,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
private Geopoint coords = null;
private SearchResult search = null;
/** The list of shown caches shared with Adapter. Don't manipulate outside of main thread only with Handler */
- private final List<Geocache> cacheList = new ArrayList<Geocache>();
+ private final List<Geocache> cacheList = new ArrayList<>();
private CacheListAdapter adapter = null;
private View listFooter = null;
private TextView listFooterText = null;
@@ -762,7 +762,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
}
private SearchResult getFilteredSearch() {
- final Set<String> geocodes = new HashSet<String>();
+ final Set<String> geocodes = new HashSet<>();
for (final Geocache cache : adapter.getFilteredList()) {
geocodes.add(cache.getGeocode());
}
@@ -770,7 +770,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
}
public void deletePastEvents() {
- final List<Geocache> deletion = new ArrayList<Geocache>();
+ final List<Geocache> deletion = new ArrayList<>();
for (final Geocache cache : adapter.getCheckedOrAllCaches()) {
if (DateUtils.isPastEvent(cache)) {
deletion.add(cache);
@@ -1726,7 +1726,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
* @return
*/
private CharSequence getCurrentSubtitle() {
- final ArrayList<String> numbers = new ArrayList<String>();
+ final ArrayList<String> numbers = new ArrayList<>();
if (adapter.isFiltered()) {
numbers.add(getCacheNumberString(getResources(), adapter.getCount()));
}
diff --git a/main/src/cgeo/geocaching/CompassActivity.java b/main/src/cgeo/geocaching/CompassActivity.java
index ef70837..14b33b6 100644
--- a/main/src/cgeo/geocaching/CompassActivity.java
+++ b/main/src/cgeo/geocaching/CompassActivity.java
@@ -56,7 +56,7 @@ public class CompassActivity extends AbstractActionBarActivity {
private static final String EXTRAS_NAME = "name";
private static final String EXTRAS_GEOCODE = "geocode";
private static final String EXTRAS_CACHE_INFO = "cacheinfo";
- private static final List<IWaypoint> coordinates = new ArrayList<IWaypoint>();
+ private static final List<IWaypoint> coordinates = new ArrayList<>();
/**
* Destination of the compass, or null (if the compass is used for a waypoint only).
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java
index c368586..e236f8f 100644
--- a/main/src/cgeo/geocaching/DataStore.java
+++ b/main/src/cgeo/geocaching/DataStore.java
@@ -872,7 +872,7 @@ public class DataStore {
if (ArrayUtils.isNotEmpty(files)) {
final Pattern oldFilePattern = Pattern.compile("^[GC|TB|EC|GK|O][A-Z0-9]{4,7}$");
final SQLiteStatement select = db.compileStatement("select count(*) from " + dbTableCaches + " where geocode = ?");
- final ArrayList<File> toRemove = new ArrayList<File>(files.length);
+ final ArrayList<File> toRemove = new ArrayList<>(files.length);
for (final File file : files) {
if (file.isDirectory()) {
final String geocode = file.getName();
@@ -1086,8 +1086,8 @@ public class DataStore {
if (CollectionUtils.isEmpty(caches)) {
return;
}
- final ArrayList<String> cachesFromDatabase = new ArrayList<String>();
- final HashMap<String, Geocache> existingCaches = new HashMap<String, Geocache>();
+ final ArrayList<String> cachesFromDatabase = new ArrayList<>();
+ final HashMap<String, Geocache> existingCaches = new HashMap<>();
// first check which caches are in the memory cache
for (final Geocache cache : caches) {
@@ -1106,7 +1106,7 @@ public class DataStore {
existingCaches.put(cacheFromDatabase.getGeocode(), cacheFromDatabase);
}
- final ArrayList<Geocache> toBeStored = new ArrayList<Geocache>();
+ final ArrayList<Geocache> toBeStored = new ArrayList<>();
// Merge with the data already stored in the CacheCache or in the database if
// the cache had not been loaded before, and update the CacheCache.
// Also, a DB update is required if the merge data comes from the CacheCache
@@ -1282,7 +1282,7 @@ public class DataStore {
final List<Waypoint> waypoints = cache.getWaypoints();
if (CollectionUtils.isNotEmpty(waypoints)) {
- final ArrayList<String> currentWaypointIds = new ArrayList<String>();
+ final ArrayList<String> currentWaypointIds = new ArrayList<>();
final ContentValues values = new ContentValues();
final long timeStamp = System.currentTimeMillis();
for (final Waypoint oneWaypoint : waypoints) {
@@ -1559,14 +1559,14 @@ public class DataStore {
*/
public static Set<Geocache> loadCaches(final Collection<String> geocodes, final EnumSet<LoadFlag> loadFlags) {
if (CollectionUtils.isEmpty(geocodes)) {
- return new HashSet<Geocache>();
+ return new HashSet<>();
}
- final Set<Geocache> result = new HashSet<Geocache>();
- final Set<String> remaining = new HashSet<String>(geocodes);
+ final Set<Geocache> result = new HashSet<>();
+ final Set<String> remaining = new HashSet<>(geocodes);
if (loadFlags.contains(LoadFlag.CACHE_BEFORE)) {
- for (final String geocode : new HashSet<String>(remaining)) {
+ for (final String geocode : new HashSet<>(remaining)) {
final Geocache cache = cacheCache.getCacheFromCache(geocode);
if (cache != null) {
result.add(cache);
@@ -1591,7 +1591,7 @@ public class DataStore {
}
if (loadFlags.contains(LoadFlag.CACHE_AFTER)) {
- for (final String geocode : new HashSet<String>(remaining)) {
+ for (final String geocode : new HashSet<>(remaining)) {
final Geocache cache = cacheCache.getCacheFromCache(geocode);
if (cache != null) {
result.add(cache);
@@ -1636,7 +1636,7 @@ public class DataStore {
final Cursor cursor = database.rawQuery(query.toString(), null);
try {
- final Set<Geocache> caches = new HashSet<Geocache>();
+ final Set<Geocache> caches = new HashSet<>();
int logIndex = -1;
while (cursor.moveToNext()) {
@@ -1926,7 +1926,7 @@ public class DataStore {
*/
@NonNull
public static List<LogEntry> loadLogs(final String geocode) {
- final List<LogEntry> logs = new ArrayList<LogEntry>();
+ final List<LogEntry> logs = new ArrayList<>();
if (StringUtils.isBlank(geocode)) {
return logs;
@@ -1970,7 +1970,7 @@ public class DataStore {
init();
- final Map<LogType, Integer> logCounts = new HashMap<LogType, Integer>();
+ final Map<LogType, Integer> logCounts = new HashMap<>();
final Cursor cursor = database.query(
dbTableLogCount,
@@ -1998,7 +1998,7 @@ public class DataStore {
init();
- final List<Trackable> trackables = new ArrayList<Trackable>();
+ final List<Trackable> trackables = new ArrayList<>();
final Cursor cursor = database.query(
dbTableTrackables,
@@ -2265,7 +2265,7 @@ public class DataStore {
* @return Set with geocodes
*/
private static SearchResult loadInViewport(final boolean stored, final Viewport viewport, final CacheType cacheType) {
- final Set<String> geocodes = new HashSet<String>();
+ final Set<String> geocodes = new HashSet<>();
// if not stored only, get codes from CacheCache as well
if (!stored) {
@@ -2319,7 +2319,7 @@ public class DataStore {
Log.d("Database clean: started");
try {
- Set<String> geocodes = new HashSet<String>();
+ Set<String> geocodes = new HashSet<>();
if (more) {
queryToColl(dbTableCaches,
new String[]{"geocode"},
@@ -2420,7 +2420,7 @@ public class DataStore {
if (removeFlags.contains(RemoveFlag.DB)) {
// Drop caches from the database
- final ArrayList<String> quotedGeocodes = new ArrayList<String>(geocodes.size());
+ final ArrayList<String> quotedGeocodes = new ArrayList<>(geocodes.size());
for (final String geocode : geocodes) {
quotedGeocodes.add(DatabaseUtils.sqlEscapeString(geocode));
}
@@ -2528,7 +2528,7 @@ public class DataStore {
init();
- final Set<String> geocodes = new HashSet<String>(caches.size());
+ final Set<String> geocodes = new HashSet<>(caches.size());
for (final Geocache cache : caches) {
geocodes.add(cache.getGeocode());
cache.setLogOffline(false);
@@ -2583,7 +2583,7 @@ public class DataStore {
init();
final Resources res = CgeoApplication.getInstance().getResources();
- final List<StoredList> lists = new ArrayList<StoredList>();
+ final List<StoredList> lists = new ArrayList<>();
lists.add(new StoredList(StoredList.STANDARD_LIST_ID, res.getString(R.string.list_inbox), (int) PreparedStatements.getCountCachesOnStandardList().simpleQueryForLong()));
try {
@@ -2919,7 +2919,7 @@ public class DataStore {
private static class PreparedStatements {
- private static HashMap<String, SQLiteStatement> statements = new HashMap<String, SQLiteStatement>();
+ private static HashMap<String, SQLiteStatement> statements = new HashMap<>();
public static SQLiteStatement getMoveToStandardList() {
return getStatement("MoveToStandardList", "UPDATE " + dbTableCaches + " SET reason = " + StoredList.STANDARD_LIST_ID + " WHERE reason = ?");
@@ -3054,7 +3054,7 @@ public class DataStore {
public static Set<String> getCachedMissingFromSearch(final SearchResult searchResult, final Set<Tile> tiles, final IConnector connector, final int maxZoom) {
// get cached CacheListActivity
- final Set<String> cachedGeocodes = new HashSet<String>();
+ final Set<String> cachedGeocodes = new HashSet<>();
for (final Tile tile : tiles) {
cachedGeocodes.addAll(cacheCache.getInViewport(tile.getViewport(), CacheType.ALL));
}
@@ -3062,7 +3062,7 @@ public class DataStore {
cachedGeocodes.removeAll(searchResult.getGeocodes());
// check remaining against viewports
- final Set<String> missingFromSearch = new HashSet<String>();
+ final Set<String> missingFromSearch = new HashSet<>();
for (final String geocode : cachedGeocodes) {
if (connector.canHandle(geocode)) {
final Geocache geocache = cacheCache.getCacheFromCache(geocode);
@@ -3179,7 +3179,7 @@ public class DataStore {
final Set<Geocache> cachesSet = DataStore.loadCaches(geocodes, LoadFlags.LOAD_CACHE_OR_DB);
// order result set by time again
- final ArrayList<Geocache> caches = new ArrayList<Geocache>(cachesSet);
+ final ArrayList<Geocache> caches = new ArrayList<>(cachesSet);
Collections.sort(caches, new Comparator<Geocache>() {
@Override
diff --git a/main/src/cgeo/geocaching/EditWaypointActivity.java b/main/src/cgeo/geocaching/EditWaypointActivity.java
index ccb25f5..73cb477 100644
--- a/main/src/cgeo/geocaching/EditWaypointActivity.java
+++ b/main/src/cgeo/geocaching/EditWaypointActivity.java
@@ -49,7 +49,7 @@ import java.util.List;
@EActivity
public class EditWaypointActivity extends AbstractActionBarActivity implements CoordinatesInputDialog.CoordinateUpdate {
- private static final ArrayList<WaypointType> POSSIBLE_WAYPOINT_TYPES = new ArrayList<WaypointType>(WaypointType.ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL);
+ private static final ArrayList<WaypointType> POSSIBLE_WAYPOINT_TYPES = new ArrayList<>(WaypointType.ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL);
@ViewById(R.id.buttonLatitude) protected Button buttonLat;
@ViewById(R.id.buttonLongitude) protected Button buttonLon;
@@ -159,11 +159,11 @@ public class EditWaypointActivity extends AbstractActionBarActivity implements C
addWaypoint.setOnClickListener(new SaveWaypointListener());
- List<String> wayPointNames = new ArrayList<String>();
+ List<String> wayPointNames = new ArrayList<>();
for (WaypointType wpt : WaypointType.ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL) {
wayPointNames.add(wpt.getL10n());
}
- ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, wayPointNames);
+ ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, wayPointNames);
waypointName.setAdapter(adapter);
if (savedInstanceState != null) {
@@ -205,7 +205,7 @@ public class EditWaypointActivity extends AbstractActionBarActivity implements C
}
private void initializeWaypointTypeSelector() {
- ArrayAdapter<WaypointType> wpAdapter = new ArrayAdapter<WaypointType>(this, android.R.layout.simple_spinner_item, POSSIBLE_WAYPOINT_TYPES.toArray(new WaypointType[POSSIBLE_WAYPOINT_TYPES.size()]));
+ ArrayAdapter<WaypointType> wpAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, POSSIBLE_WAYPOINT_TYPES.toArray(new WaypointType[POSSIBLE_WAYPOINT_TYPES.size()]));
wpAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
waypointTypeSelector.setAdapter(wpAdapter);
@@ -247,7 +247,7 @@ public class EditWaypointActivity extends AbstractActionBarActivity implements C
}
private void initializeDistanceUnitSelector() {
- distanceUnits = new ArrayList<String>(Arrays.asList(res.getStringArray(R.array.distance_units)));
+ distanceUnits = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.distance_units)));
if (initViews) {
distanceUnitSelector.setSelection(Settings.isUseImperialUnits() ? 2 : 0); //0:m, 2:ft
}
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index 8e7f419..489c70c 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -93,7 +93,7 @@ public class Geocache implements ICache, IWaypoint {
private String geocode = "";
private String cacheId = "";
private String guid = "";
- private UncertainProperty<CacheType> cacheType = new UncertainProperty<CacheType>(CacheType.UNKNOWN, Tile.ZOOMLEVEL_MIN - 1);
+ private UncertainProperty<CacheType> cacheType = new UncertainProperty<>(CacheType.UNKNOWN, Tile.ZOOMLEVEL_MIN - 1);
private String name = "";
private String ownerDisplayName = "";
private String ownerUserId = "";
@@ -111,7 +111,7 @@ public class Geocache implements ICache, IWaypoint {
* lazy initialized
*/
private String location = null;
- private UncertainProperty<Geopoint> coords = new UncertainProperty<Geopoint>(null);
+ private UncertainProperty<Geopoint> coords = new UncertainProperty<>(null);
private boolean reliableLatLon = false;
private String personalNote = null;
/**
@@ -149,7 +149,7 @@ public class Geocache implements ICache, IWaypoint {
private List<Image> spoilers = null;
private List<Trackable> inventory = null;
- private Map<LogType, Integer> logCounts = new HashMap<LogType, Integer>();
+ private Map<LogType, Integer> logCounts = new HashMap<>();
private boolean userModifiedCoords = false;
// temporary values
private boolean statusChecked = false;
@@ -336,7 +336,7 @@ public class Geocache implements ICache, IWaypoint {
this.setWaypoints(other.waypoints, false);
}
else {
- final ArrayList<Waypoint> newPoints = new ArrayList<Waypoint>(waypoints);
+ final ArrayList<Waypoint> newPoints = new ArrayList<>(waypoints);
Waypoint.mergeWayPoints(newPoints, other.waypoints, false);
this.setWaypoints(newPoints, false);
}
@@ -787,7 +787,7 @@ public class Geocache implements ICache, IWaypoint {
public void addSpoiler(final Image spoiler) {
if (spoilers == null) {
- spoilers = new ArrayList<Image>();
+ spoilers = new ArrayList<>();
}
spoilers.add(spoiler);
}
@@ -912,7 +912,7 @@ public class Geocache implements ICache, IWaypoint {
* @param coords
*/
public void setCoords(final Geopoint coords) {
- this.coords = new UncertainProperty<Geopoint>(coords);
+ this.coords = new UncertainProperty<>(coords);
}
/**
@@ -922,7 +922,7 @@ public class Geocache implements ICache, IWaypoint {
* @param zoomlevel
*/
public void setCoords(final Geopoint coords, final int zoomlevel) {
- this.coords = new UncertainProperty<Geopoint>(coords, zoomlevel);
+ this.coords = new UncertainProperty<>(coords, zoomlevel);
}
/**
@@ -1036,7 +1036,7 @@ public class Geocache implements ICache, IWaypoint {
*/
@NonNull
public List<LogEntry> getFriendsLogs() {
- final ArrayList<LogEntry> friendLogs = new ArrayList<LogEntry>();
+ final ArrayList<LogEntry> friendLogs = new ArrayList<>();
for (final LogEntry log : getLogs()) {
if (log.friend) {
friendLogs.add(log);
@@ -1169,14 +1169,14 @@ public class Geocache implements ICache, IWaypoint {
if (cacheType == null || CacheType.ALL == cacheType) {
throw new IllegalArgumentException("Illegal cache type");
}
- this.cacheType = new UncertainProperty<CacheType>(cacheType);
+ this.cacheType = new UncertainProperty<>(cacheType);
}
public void setType(final CacheType cacheType, final int zoomlevel) {
if (cacheType == null || CacheType.ALL == cacheType) {
throw new IllegalArgumentException("Illegal cache type");
}
- this.cacheType = new UncertainProperty<CacheType>(cacheType, zoomlevel);
+ this.cacheType = new UncertainProperty<>(cacheType, zoomlevel);
}
public boolean hasDifficulty() {
@@ -1243,7 +1243,7 @@ public class Geocache implements ICache, IWaypoint {
*/
private void assignUniquePrefix(final Waypoint waypoint) {
// gather existing prefixes
- final Set<String> assignedPrefixes = new HashSet<String>();
+ final Set<String> assignedPrefixes = new HashSet<>();
for (final Waypoint wp : waypoints) {
assignedPrefixes.add(wp.getPrefix());
}
@@ -1661,7 +1661,7 @@ public class Geocache implements ICache, IWaypoint {
}
final String hourLocalized = CgeoApplication.getInstance().getString(R.string.cache_time_full_hours);
- final ArrayList<Pattern> patterns = new ArrayList<Pattern>();
+ final ArrayList<Pattern> patterns = new ArrayList<>();
// 12:34
patterns.add(Pattern.compile("\\b(\\d{1,2})\\:(\\d\\d)\\b"));
@@ -1721,7 +1721,7 @@ public class Geocache implements ICache, IWaypoint {
};
private void addDescriptionImagesUrls(final Collection<Image> images) {
- final Set<String> urls = new LinkedHashSet<String>();
+ final Set<String> urls = new LinkedHashSet<>();
for (final Image image : images) {
urls.add(image.getUrl());
}
@@ -1738,13 +1738,13 @@ public class Geocache implements ICache, IWaypoint {
}
public Collection<Image> getImages() {
- final LinkedList<Image> result = new LinkedList<Image>();
+ final LinkedList<Image> result = new LinkedList<>();
result.addAll(getSpoilers());
addLocalSpoilersTo(result);
for (final LogEntry log : getLogs()) {
result.addAll(log.getLogImages());
}
- final Set<String> urls = new HashSet<String>(result.size());
+ final Set<String> urls = new HashSet<>(result.size());
for (final Image image : result) {
urls.add(image.getUrl());
}
diff --git a/main/src/cgeo/geocaching/ImagesActivity.java b/main/src/cgeo/geocaching/ImagesActivity.java
index bc2616b..b75e5eb 100644
--- a/main/src/cgeo/geocaching/ImagesActivity.java
+++ b/main/src/cgeo/geocaching/ImagesActivity.java
@@ -90,7 +90,7 @@ public class ImagesActivity extends AbstractActionBarActivity {
.putExtra(Intents.EXTRA_TYPE, imageType);
// avoid forcing the array list as parameter type
- final ArrayList<Image> arrayList = new ArrayList<Image>(logImages);
+ final ArrayList<Image> arrayList = new ArrayList<>(logImages);
logImgIntent.putParcelableArrayListExtra(Intents.EXTRA_IMAGES, arrayList);
fromActivity.startActivity(logImgIntent);
}
diff --git a/main/src/cgeo/geocaching/LogCacheActivity.java b/main/src/cgeo/geocaching/LogCacheActivity.java
index d64301b..09f76b5 100644
--- a/main/src/cgeo/geocaching/LogCacheActivity.java
+++ b/main/src/cgeo/geocaching/LogCacheActivity.java
@@ -67,7 +67,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
private Geocache cache = null;
private String geocode = null;
private String text = null;
- private List<LogType> possibleLogTypes = new ArrayList<LogType>();
+ private List<LogType> possibleLogTypes = new ArrayList<>();
private List<TrackableLog> trackables = null;
private CheckBox tweetCheck = null;
private LinearLayout tweetBox = null;
@@ -136,7 +136,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
if (inflater == null) {
inflater = getLayoutInflater();
}
- actionButtons = new SparseArray<TrackableLog>();
+ actionButtons = new SparseArray<>();
final LinearLayout inventoryView = (LinearLayout) findViewById(R.id.inventory);
inventoryView.removeAllViews();
@@ -428,7 +428,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
DataStore.saveChangedCache(cache);
// update logs in DB
- final ArrayList<LogEntry> newLogs = new ArrayList<LogEntry>(cache.getLogs());
+ final ArrayList<LogEntry> newLogs = new ArrayList<>(cache.getLogs());
final LogEntry logNow = new LogEntry(date.getTimeInMillis(), typeSelected, log);
logNow.friend = true;
newLogs.add(0, logNow);
@@ -536,7 +536,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
private void selectLogType() {
// use a local copy of the possible types, as that one might be modified in the background by the loader
- final ArrayList<LogType> possible = new ArrayList<LogType>(possibleLogTypes);
+ final ArrayList<LogType> possible = new ArrayList<>(possibleLogTypes);
final Builder alert = new AlertDialog.Builder(this);
final String[] choices = new String[possible.size()];
diff --git a/main/src/cgeo/geocaching/LogEntry.java b/main/src/cgeo/geocaching/LogEntry.java
index ca4a3d1..b4b346c 100644
--- a/main/src/cgeo/geocaching/LogEntry.java
+++ b/main/src/cgeo/geocaching/LogEntry.java
@@ -68,7 +68,7 @@ public final class LogEntry {
public void addLogImage(final Image image) {
if (logImages == null) {
- logImages = new ArrayList<Image>();
+ logImages = new ArrayList<>();
}
logImages.add(image);
}
@@ -88,7 +88,7 @@ public final class LogEntry {
}
public CharSequence getImageTitles() {
- final List<String> titles = new ArrayList<String>(5);
+ final List<String> titles = new ArrayList<>(5);
for (Image image : getLogImages()) {
if (StringUtils.isNotBlank(image.getTitle())) {
titles.add(HtmlUtils.extractText(image.getTitle()));
diff --git a/main/src/cgeo/geocaching/LogTrackableActivity.java b/main/src/cgeo/geocaching/LogTrackableActivity.java
index ad4ed0e..a531130 100644
--- a/main/src/cgeo/geocaching/LogTrackableActivity.java
+++ b/main/src/cgeo/geocaching/LogTrackableActivity.java
@@ -47,7 +47,7 @@ public class LogTrackableActivity extends AbstractLoggingActivity implements Dat
@InjectView(R.id.tweet) protected CheckBox tweetCheck;
@InjectView(R.id.tweet_box) protected LinearLayout tweetBox;
- private List<LogType> possibleLogTypes = new ArrayList<LogType>();
+ private List<LogType> possibleLogTypes = new ArrayList<>();
private ProgressDialog waitDialog = null;
private String guid = null;
private String geocode = null;
diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java
index b2fc96a..a3be760 100644
--- a/main/src/cgeo/geocaching/MainActivity.java
+++ b/main/src/cgeo/geocaching/MainActivity.java
@@ -127,7 +127,7 @@ public class MainActivity extends AbstractActionBarActivity {
};
private static String formatAddress(final Address address) {
- final ArrayList<String> addressParts = new ArrayList<String>();
+ final ArrayList<String> addressParts = new ArrayList<>();
final String countryName = address.getCountryName();
if (countryName != null) {
@@ -451,7 +451,7 @@ public class MainActivity extends AbstractActionBarActivity {
}
protected void selectGlobalTypeFilter() {
- final List<CacheType> cacheTypes = new ArrayList<CacheType>();
+ final List<CacheType> cacheTypes = new ArrayList<>();
//first add the most used types
cacheTypes.add(CacheType.ALL);
@@ -460,7 +460,7 @@ public class MainActivity extends AbstractActionBarActivity {
cacheTypes.add(CacheType.MYSTERY);
// then add all other cache types sorted alphabetically
- final List<CacheType> sorted = new ArrayList<CacheType>();
+ final List<CacheType> sorted = new ArrayList<>();
sorted.addAll(Arrays.asList(CacheType.values()));
sorted.removeAll(cacheTypes);
diff --git a/main/src/cgeo/geocaching/SearchResult.java b/main/src/cgeo/geocaching/SearchResult.java
index 088b682..74cc59d 100644
--- a/main/src/cgeo/geocaching/SearchResult.java
+++ b/main/src/cgeo/geocaching/SearchResult.java
@@ -75,8 +75,8 @@ public class SearchResult implements Parcelable {
* @param searchResult the original search result, which cannot be null
*/
public SearchResult(final SearchResult searchResult) {
- geocodes = new HashSet<String>(searchResult.geocodes);
- filteredGeocodes = new HashSet<String>(searchResult.filteredGeocodes);
+ geocodes = new HashSet<>(searchResult.geocodes);
+ filteredGeocodes = new HashSet<>(searchResult.filteredGeocodes);
error = searchResult.error;
url = searchResult.url;
viewstates = searchResult.viewstates;
@@ -93,9 +93,9 @@ public class SearchResult implements Parcelable {
* from a web page)
*/
public SearchResult(final Collection<String> geocodes, final int totalCountGC) {
- this.geocodes = new HashSet<String>(geocodes.size());
+ this.geocodes = new HashSet<>(geocodes.size());
this.geocodes.addAll(geocodes);
- this.filteredGeocodes = new HashSet<String>();
+ this.filteredGeocodes = new HashSet<>();
this.setTotalCountGC(totalCountGC);
}
@@ -109,12 +109,12 @@ public class SearchResult implements Parcelable {
}
public SearchResult(final Parcel in) {
- final ArrayList<String> list = new ArrayList<String>();
+ final ArrayList<String> list = new ArrayList<>();
in.readStringList(list);
- geocodes = new HashSet<String>(list);
- final ArrayList<String> filteredList = new ArrayList<String>();
+ geocodes = new HashSet<>(list);
+ final ArrayList<String> filteredList = new ArrayList<>();
in.readStringList(filteredList);
- filteredGeocodes = new HashSet<String>(filteredList);
+ filteredGeocodes = new HashSet<>(filteredList);
error = (StatusCode) in.readSerializable();
url = in.readString();
final int length = in.readInt();
@@ -224,7 +224,7 @@ public class SearchResult implements Parcelable {
SearchResult result = new SearchResult(this);
result.geocodes.clear();
- final ArrayList<Geocache> includedCaches = new ArrayList<Geocache>();
+ final ArrayList<Geocache> includedCaches = new ArrayList<>();
final Set<Geocache> caches = DataStore.loadCaches(geocodes, LoadFlags.LOAD_CACHE_OR_DB);
int excluded = 0;
for (Geocache cache : caches) {
diff --git a/main/src/cgeo/geocaching/SelectMapfileActivity.java b/main/src/cgeo/geocaching/SelectMapfileActivity.java
index b2cdf17..dc898d7 100644
--- a/main/src/cgeo/geocaching/SelectMapfileActivity.java
+++ b/main/src/cgeo/geocaching/SelectMapfileActivity.java
@@ -83,7 +83,7 @@ public class SelectMapfileActivity extends AbstractFileListActivity<FileSelectio
@Override
protected List<File> getBaseFolders() {
- List<File> folders = new ArrayList<File>();
+ List<File> folders = new ArrayList<>();
for (File dir : LocalStorage.getStorages()) {
folders.add(new File(dir, "mfmaps"));
folders.add(new File(new File(dir, "Locus"), "mapsVector"));
diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java
index dd578a2..ceceab9 100644
--- a/main/src/cgeo/geocaching/StaticMapsActivity.java
+++ b/main/src/cgeo/geocaching/StaticMapsActivity.java
@@ -35,7 +35,7 @@ public class StaticMapsActivity extends AbstractActionBarActivity {
@Extra(EXTRAS_WAYPOINT) Integer waypointId = null;
@Extra(EXTRAS_GEOCODE) String geocode = null;
- private final List<Bitmap> maps = new ArrayList<Bitmap>();
+ private final List<Bitmap> maps = new ArrayList<>();
private LayoutInflater inflater = null;
private ProgressDialog waitDialog = null;
private LinearLayout smapsView = null;
diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java
index 79f2fb5..030c379 100644
--- a/main/src/cgeo/geocaching/StaticMapsProvider.java
+++ b/main/src/cgeo/geocaching/StaticMapsProvider.java
@@ -115,7 +115,7 @@ public final class StaticMapsProvider {
// TODO Check if this is also OK, was width -25
final Point displaySize = Compatibility.getDisplaySize();
- final List<Observable<String>> downloaders = new LinkedList<Observable<String>>();
+ final List<Observable<String>> downloaders = new LinkedList<>();
if (Settings.isStoreOfflineMaps() && cache.getCoords() != null) {
downloaders.add(storeCachePreviewMap(cache));
@@ -145,7 +145,7 @@ public final class StaticMapsProvider {
*/
private static Observable<String> refreshAllWpStaticMaps(final Geocache cache, final int width, final int height) {
LocalStorage.deleteFilesWithPrefix(cache.getGeocode(), MAP_FILENAME_PREFIX + WAYPOINT_PREFIX);
- final List<Observable<String>> downloaders = new LinkedList<Observable<String>>();
+ final List<Observable<String>> downloaders = new LinkedList<>();
for (final Waypoint waypoint : cache.getWaypoints()) {
downloaders.add(storeWaypointStaticMap(cache.getGeocode(), width, height, waypoint));
}
diff --git a/main/src/cgeo/geocaching/Trackable.java b/main/src/cgeo/geocaching/Trackable.java
index d532cda..9c2b044 100644
--- a/main/src/cgeo/geocaching/Trackable.java
+++ b/main/src/cgeo/geocaching/Trackable.java
@@ -35,7 +35,7 @@ public class Trackable implements ILogable {
private String goal = null;
private String details = null;
private String image = null;
- private List<LogEntry> logs = new ArrayList<LogEntry>();
+ private List<LogEntry> logs = new ArrayList<>();
private String trackingcode = null;
public String getUrl() {
@@ -215,7 +215,7 @@ public class Trackable implements ILogable {
}
static public List<LogType> getPossibleLogTypes() {
- final List<LogType> logTypes = new ArrayList<LogType>();
+ final List<LogType> logTypes = new ArrayList<>();
logTypes.add(LogType.RETRIEVED_IT);
logTypes.add(LogType.GRABBED_IT);
logTypes.add(LogType.NOTE);
diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java
index e8d16ca..6cc7374 100644
--- a/main/src/cgeo/geocaching/TrackableActivity.java
+++ b/main/src/cgeo/geocaching/TrackableActivity.java
@@ -354,7 +354,7 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
@Override
protected Pair<List<? extends Page>, Integer> getOrderedPages() {
- final List<Page> pages = new ArrayList<TrackableActivity.Page>();
+ final List<Page> pages = new ArrayList<>();
pages.add(Page.DETAILS);
if (!trackable.getLogs().isEmpty()) {
pages.add(Page.LOGS);
diff --git a/main/src/cgeo/geocaching/Waypoint.java b/main/src/cgeo/geocaching/Waypoint.java
index 18b055b..7381aab 100644
--- a/main/src/cgeo/geocaching/Waypoint.java
+++ b/main/src/cgeo/geocaching/Waypoint.java
@@ -89,7 +89,7 @@ public class Waypoint implements IWaypoint {
public static void mergeWayPoints(final List<Waypoint> newPoints, final List<Waypoint> oldPoints, final boolean forceMerge) {
// Build a map of new waypoints for faster subsequent lookups
- final Map<String, Waypoint> newPrefixes = new HashMap<String, Waypoint>(newPoints.size());
+ final Map<String, Waypoint> newPrefixes = new HashMap<>(newPoints.size());
for (final Waypoint waypoint : newPoints) {
newPrefixes.put(waypoint.getPrefix(), waypoint);
}
@@ -302,7 +302,7 @@ public class Waypoint implements IWaypoint {
* @return a collection of found waypoints
*/
public static Collection<Waypoint> parseWaypointsFromNote(@NonNull final String initialNote) {
- final List<Waypoint> waypoints = new LinkedList<Waypoint>();
+ final List<Waypoint> waypoints = new LinkedList<>();
final Pattern COORDPATTERN = Pattern.compile("\\b[nNsS]{1}\\s*\\d"); // begin of coordinates
String note = initialNote;
diff --git a/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java b/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java
index d34204d..64186a0 100644
--- a/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java
+++ b/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java
@@ -38,17 +38,17 @@ public abstract class AbstractViewPagerActivity<Page extends Enum<Page>> extends
*
* TODO Move to adapter
*/
- private final List<Page> pageOrder = new ArrayList<Page>();
+ private final List<Page> pageOrder = new ArrayList<>();
/**
* Instances of all {@link PageViewCreator}.
*/
- private final Map<Page, PageViewCreator> viewCreators = new HashMap<Page, PageViewCreator>();
+ private final Map<Page, PageViewCreator> viewCreators = new HashMap<>();
/**
* Store the states of the page views to be able to persist them when destroyed and reinstantiated again
*/
- private final Map<Page, Bundle> viewStates = new HashMap<Page, Bundle>();
+ private final Map<Page, Bundle> viewStates = new HashMap<>();
/**
* The {@link ViewPager} for this activity.
*/
diff --git a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java
index 8e9181d..baf36a4 100644
--- a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java
+++ b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java
@@ -77,7 +77,7 @@ public abstract class AbstractLocusApp extends AbstractApp {
if (pd.getPoints().size() <= 1000) {
DisplayData.sendData(activity, pd, export);
} else {
- final ArrayList<PointsData> data = new ArrayList<PointsData>();
+ final ArrayList<PointsData> data = new ArrayList<>();
data.add(pd);
DisplayData.sendDataCursor(activity, data,
"content://" + LocusDataStorageProvider.class.getCanonicalName().toLowerCase(Locale.US),
@@ -140,7 +140,7 @@ public abstract class AbstractLocusApp extends AbstractApp {
pg.found = cache.isFound();
if (withWaypoints && cache.hasWaypoints()) {
- pg.waypoints = new ArrayList<PointGeocachingDataWaypoint>();
+ pg.waypoints = new ArrayList<>();
for (Waypoint waypoint : cache.getWaypoints()) {
if (waypoint == null || waypoint.getCoords() == null) {
continue;
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
index 6120116..e24c055 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
@@ -140,7 +140,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
public static void showNavigationMenu(final Activity activity,
final Geocache cache, final Waypoint waypoint, final Geopoint destination,
final boolean showInternalMap, final boolean showDefaultNavigation) {
- final List<NavigationAppsEnum> items = new ArrayList<NavigationAppFactory.NavigationAppsEnum>();
+ final List<NavigationAppsEnum> items = new ArrayList<>();
final int defaultNavigationTool = Settings.getDefaultNavigationTool();
for (final NavigationAppsEnum navApp : getInstalledNavigationApps()) {
if ((showInternalMap || !(navApp.app instanceof InternalMap)) &&
@@ -172,7 +172,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
* Using an ArrayAdapter with list of NavigationAppsEnum items avoids
* handling between mapping list positions allows us to do dynamic filtering of the list based on use case.
*/
- final ArrayAdapter<NavigationAppsEnum> adapter = new ArrayAdapter<NavigationAppsEnum>(activity, android.R.layout.select_dialog_item, items);
+ final ArrayAdapter<NavigationAppsEnum> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, items);
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.cache_menu_navigate);
@@ -193,7 +193,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
* @return
*/
public static List<NavigationAppsEnum> getInstalledNavigationApps() {
- final List<NavigationAppsEnum> installedNavigationApps = new ArrayList<NavigationAppsEnum>();
+ final List<NavigationAppsEnum> installedNavigationApps = new ArrayList<>();
for (final NavigationAppsEnum appEnum : NavigationAppsEnum.values()) {
if (appEnum.app.isInstalled()) {
installedNavigationApps.add(appEnum);
@@ -208,7 +208,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
* @return
*/
public static List<NavigationAppsEnum> getInstalledDefaultNavigationApps() {
- final List<NavigationAppsEnum> installedNavigationApps = new ArrayList<NavigationAppsEnum>();
+ final List<NavigationAppsEnum> installedNavigationApps = new ArrayList<>();
for (final NavigationAppsEnum appEnum : NavigationAppsEnum.values()) {
if (appEnum.app.isInstalled() && appEnum.app.isUsableAsDefaultNavigationApp()) {
installedNavigationApps.add(appEnum);
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
index 82d144e..4dbb46c 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
@@ -25,7 +25,7 @@ class RMapsApp extends AbstractPointNavigationApp {
}
private static void navigate(Activity activity, Geopoint coords, String code, String name) {
- final ArrayList<String> locations = new ArrayList<String>();
+ final ArrayList<String> locations = new ArrayList<>();
locations.add(coords.format(Format.LAT_LON_DECDEGREE_COMMA) + ";" + code + ";" + name);
final Intent intent = new Intent(INTENT);
intent.putStringArrayListExtra("locations", locations);
diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java
index 8212111..5886168 100644
--- a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java
@@ -51,7 +51,7 @@ public final class CacheListAppFactory extends AbstractAppFactory {
}
private static List<CacheListApp> getActiveApps() {
- final List<CacheListApp> activeApps = new ArrayList<CacheListApp>(LazyHolder.apps.length);
+ final List<CacheListApp> activeApps = new ArrayList<>(LazyHolder.apps.length);
for (final CacheListApp app : LazyHolder.apps) {
if (app.isInstalled()) {
activeApps.add(app);
diff --git a/main/src/cgeo/geocaching/concurrent/BlockingThreadPool.java b/main/src/cgeo/geocaching/concurrent/BlockingThreadPool.java
index 8e60d44..a6d7e9b 100644
--- a/main/src/cgeo/geocaching/concurrent/BlockingThreadPool.java
+++ b/main/src/cgeo/geocaching/concurrent/BlockingThreadPool.java
@@ -27,7 +27,7 @@ public class BlockingThreadPool {
*/
public BlockingThreadPool(int poolSize, int priority) {
ThreadFactory threadFactory = new PriorityThreadFactory(priority);
- this.queue = new ArrayBlockingQueue<Runnable>(poolSize, true);
+ this.queue = new ArrayBlockingQueue<>(poolSize, true);
this.executor = new ThreadPoolExecutor(0, poolSize, 5, TimeUnit.SECONDS, this.queue);
this.executor.setThreadFactory(threadFactory);
}
diff --git a/main/src/cgeo/geocaching/connector/AbstractConnector.java b/main/src/cgeo/geocaching/connector/AbstractConnector.java
index 6d8d79e..7e1ca13 100644
--- a/main/src/cgeo/geocaching/connector/AbstractConnector.java
+++ b/main/src/cgeo/geocaching/connector/AbstractConnector.java
@@ -160,7 +160,7 @@ public abstract class AbstractConnector implements IConnector {
@Override
public List<LogType> getPossibleLogTypes(Geocache geocache) {
- final List<LogType> logTypes = new ArrayList<LogType>();
+ final List<LogType> logTypes = new ArrayList<>();
if (geocache.isEventCache()) {
logTypes.add(LogType.WILL_ATTEND);
logTypes.add(LogType.ATTENDED);
@@ -214,7 +214,7 @@ public abstract class AbstractConnector implements IConnector {
@Override
public final Collection<String> getCapabilities() {
- ArrayList<String> list = new ArrayList<String>();
+ ArrayList<String> list = new ArrayList<>();
addCapability(list, ISearchByViewPort.class, R.string.feature_search_live_map);
addCapability(list, ISearchByKeyword.class, R.string.feature_search_keyword);
addCapability(list, ISearchByCenter.class, R.string.feature_search_center);
@@ -281,7 +281,7 @@ public abstract class AbstractConnector implements IConnector {
*/
static @NonNull
public List<UserAction> getDefaultUserActions() {
- final ArrayList<UserAction> actions = new ArrayList<UserAction>();
+ final ArrayList<UserAction> actions = new ArrayList<>();
if (ContactsAddon.isAvailable()) {
actions.add(new UserAction(R.string.user_menu_open_contact, new Action1<UserAction.Context>() {
diff --git a/main/src/cgeo/geocaching/connector/ConnectorFactory.java b/main/src/cgeo/geocaching/connector/ConnectorFactory.java
index a6deba9..e6ef829 100644
--- a/main/src/cgeo/geocaching/connector/ConnectorFactory.java
+++ b/main/src/cgeo/geocaching/connector/ConnectorFactory.java
@@ -89,7 +89,7 @@ public final class ConnectorFactory {
@SuppressWarnings("unchecked")
private static <T extends IConnector> Collection<T> getMatchingConnectors(final Class<T> clazz) {
- final List<T> matching = new ArrayList<T>();
+ final List<T> matching = new ArrayList<>();
for (final IConnector connector : CONNECTORS) {
if (clazz.isInstance(connector)) {
matching.add((T) connector);
@@ -119,7 +119,7 @@ public final class ConnectorFactory {
}
public static ILogin[] getActiveLiveConnectors() {
- final List<ILogin> liveConns = new ArrayList<ILogin>();
+ final List<ILogin> liveConns = new ArrayList<>();
for (final IConnector conn : CONNECTORS) {
if (conn instanceof ILogin && conn.isActive()) {
liveConns.add((ILogin) conn);
diff --git a/main/src/cgeo/geocaching/connector/ec/ECApi.java b/main/src/cgeo/geocaching/connector/ec/ECApi.java
index 5202184..421d112 100644
--- a/main/src/cgeo/geocaching/connector/ec/ECApi.java
+++ b/main/src/cgeo/geocaching/connector/ec/ECApi.java
@@ -177,7 +177,7 @@ public class ECApi {
}
final JSONArray json = new JSONArray(data);
final int len = json.length();
- final List<Geocache> caches = new ArrayList<Geocache>(len);
+ final List<Geocache> caches = new ArrayList<>(len);
for (int i = 0; i < len; i++) {
final Geocache cache = parseCache(json.getJSONObject(i));
if (cache != null) {
diff --git a/main/src/cgeo/geocaching/connector/ec/ECConnector.java b/main/src/cgeo/geocaching/connector/ec/ECConnector.java
index 71716fe..a266eee 100644
--- a/main/src/cgeo/geocaching/connector/ec/ECConnector.java
+++ b/main/src/cgeo/geocaching/connector/ec/ECConnector.java
@@ -198,7 +198,7 @@ public class ECConnector extends AbstractConnector implements ISearchByGeocode,
@Override
public List<LogType> getPossibleLogTypes(Geocache geocache) {
- final List<LogType> logTypes = new ArrayList<LogType>();
+ final List<LogType> logTypes = new ArrayList<>();
if (geocache.isEventCache()) {
logTypes.add(LogType.WILL_ATTEND);
logTypes.add(LogType.ATTENDED);
diff --git a/main/src/cgeo/geocaching/connector/gc/GCLogin.java b/main/src/cgeo/geocaching/connector/gc/GCLogin.java
index 250b0b2..70d20c71 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCLogin.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCLogin.java
@@ -50,7 +50,7 @@ public class GCLogin extends AbstractLogin {
"dd/MM/yyyy"
};
- final Map<String, SimpleDateFormat> map = new HashMap<String, SimpleDateFormat>();
+ final Map<String, SimpleDateFormat> map = new HashMap<>();
for (final String format : formats) {
map.put(format, new SimpleDateFormat(format, Locale.ENGLISH));
diff --git a/main/src/cgeo/geocaching/connector/gc/GCMap.java b/main/src/cgeo/geocaching/connector/gc/GCMap.java
index 0e74946..1ab642e 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCMap.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCMap.java
@@ -74,7 +74,7 @@ public class GCMap {
throw new JSONException("No data inside JSON");
}
- final ArrayList<Geocache> caches = new ArrayList<Geocache>();
+ final ArrayList<Geocache> caches = new ArrayList<>();
for (int j = 0; j < dataArray.length(); j++) {
final Geocache cache = new Geocache();
@@ -122,7 +122,7 @@ public class GCMap {
try {
- final LeastRecentlyUsedMap<String, String> nameCache = new LeastRecentlyUsedMap.LruCache<String, String>(2000); // JSON id, cache name
+ final LeastRecentlyUsedMap<String, String> nameCache = new LeastRecentlyUsedMap.LruCache<>(2000); // JSON id, cache name
if (StringUtils.isEmpty(data)) {
throw new JSONException("No page given");
@@ -150,8 +150,8 @@ public class GCMap {
}
// iterate over the data and construct all caches in this tile
- Map<String, List<UTFGridPosition>> positions = new HashMap<String, List<UTFGridPosition>>(); // JSON id as key
- Map<String, List<UTFGridPosition>> singlePositions = new HashMap<String, List<UTFGridPosition>>(); // JSON id as key
+ Map<String, List<UTFGridPosition>> positions = new HashMap<>(); // JSON id as key
+ Map<String, List<UTFGridPosition>> singlePositions = new HashMap<>(); // JSON id as key
for (int i = 1; i < keys.length(); i++) { // index 0 is empty
String key = keys.getString(i);
@@ -167,9 +167,9 @@ public class GCMap {
List<UTFGridPosition> singleListOfPositions = singlePositions.get(id);
if (listOfPositions == null) {
- listOfPositions = new ArrayList<UTFGridPosition>();
+ listOfPositions = new ArrayList<>();
positions.put(id, listOfPositions);
- singleListOfPositions = new ArrayList<UTFGridPosition>();
+ singleListOfPositions = new ArrayList<>();
singlePositions.put(id, singleListOfPositions);
}
@@ -182,7 +182,7 @@ public class GCMap {
}
}
- final ArrayList<Geocache> caches = new ArrayList<Geocache>();
+ final ArrayList<Geocache> caches = new ArrayList<>();
for (Entry<String, List<UTFGridPosition>> entry : positions.entrySet()) {
String id = entry.getKey();
List<UTFGridPosition> pos = entry.getValue();
@@ -378,7 +378,7 @@ public class GCMap {
* 8 = mystery, 1858 = whereigo
*/
private static String getCacheTypeFilter(CacheType typeToDisplay) {
- Set<String> filterTypes = new HashSet<String>();
+ Set<String> filterTypes = new HashSet<>();
// Put all types in set, remove what should be visible in a second step
filterTypes.addAll(Arrays.asList("2", "9", "5", "3", "6", "453", "13", "1304", "4", "11", "137", "8", "1858"));
switch (typeToDisplay) {
diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java
index 26c8175..148c8f6 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCParser.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java
@@ -82,7 +82,7 @@ public abstract class GCParser {
return null;
}
- final List<String> cids = new ArrayList<String>();
+ final List<String> cids = new ArrayList<>();
String page = pageContent;
final SearchResult searchResult = new SearchResult();
@@ -129,7 +129,7 @@ public abstract class GCParser {
final int rows_count = rows.length;
int excludedCaches = 0;
- final ArrayList<Geocache> caches = new ArrayList<Geocache>();
+ final ArrayList<Geocache> caches = new ArrayList<>();
for (int z = 1; z < rows_count; z++) {
final Geocache cache = new Geocache();
final String row = rows[z];
@@ -552,7 +552,7 @@ public abstract class GCParser {
if (null != attributesPre) {
final MatcherWrapper matcherAttributesInside = new MatcherWrapper(GCConstants.PATTERN_ATTRIBUTESINSIDE, attributesPre);
- final ArrayList<String> attributes = new ArrayList<String>();
+ final ArrayList<String> attributes = new ArrayList<>();
while (matcherAttributesInside.find()) {
if (matcherAttributesInside.groupCount() > 1 && !matcherAttributesInside.group(2).equalsIgnoreCase("blank")) {
// by default, use the tooltip of the attribute
@@ -798,7 +798,7 @@ public abstract class GCParser {
}
// search results don't need to be filtered so load GCVote ratings here
- GCVote.loadRatings(new ArrayList<Geocache>(searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB)));
+ GCVote.loadRatings(new ArrayList<>(searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB)));
// save to application
search.setError(searchResult.getError());
@@ -1002,7 +1002,7 @@ public abstract class GCParser {
return Collections.emptyList();
}
- List<PocketQueryList> list = new ArrayList<PocketQueryList>();
+ List<PocketQueryList> list = new ArrayList<>();
final MatcherWrapper matcherPocket = new MatcherWrapper(GCConstants.PATTERN_LIST_PQ, subPage);
@@ -1037,12 +1037,12 @@ public abstract class GCParser {
final String log, final List<TrackableLog> trackables) {
if (GCLogin.isEmpty(viewstates)) {
Log.e("GCParser.postLog: No viewstate given");
- return new ImmutablePair<StatusCode, String>(StatusCode.LOG_POST_ERROR, "");
+ return new ImmutablePair<>(StatusCode.LOG_POST_ERROR, "");
}
if (StringUtils.isBlank(log)) {
Log.e("GCParser.postLog: No log text given");
- return new ImmutablePair<StatusCode, String>(StatusCode.NO_LOG_TEXT, "");
+ return new ImmutablePair<>(StatusCode.NO_LOG_TEXT, "");
}
final String logInfo = log.replace("\n", "\r\n").trim(); // windows' eol and remove leading and trailing whitespaces
@@ -1089,7 +1089,7 @@ public abstract class GCParser {
String page = GCLogin.getInstance().postRequestLogged(uri, params);
if (!GCLogin.getInstance().getLoginStatus(page)) {
Log.e("GCParser.postLog: Cannot log in geocaching");
- return new ImmutablePair<StatusCode, String>(StatusCode.NOT_LOGGED_IN, "");
+ return new ImmutablePair<>(StatusCode.NOT_LOGGED_IN, "");
}
// maintenance, archived needs to be confirmed
@@ -1102,7 +1102,7 @@ public abstract class GCParser {
if (GCLogin.isEmpty(viewstatesConfirm)) {
Log.e("GCParser.postLog: No viewstate for confirm log");
- return new ImmutablePair<StatusCode, String>(StatusCode.LOG_POST_ERROR, "");
+ return new ImmutablePair<>(StatusCode.LOG_POST_ERROR, "");
}
params.clear();
@@ -1159,14 +1159,14 @@ public abstract class GCParser {
final String logID = TextUtils.getMatch(page, GCConstants.PATTERN_LOG_IMAGE_UPLOAD, "");
- return new ImmutablePair<StatusCode, String>(StatusCode.NO_ERROR, logID);
+ return new ImmutablePair<>(StatusCode.NO_ERROR, logID);
}
} catch (final Exception e) {
Log.e("GCParser.postLog.check", e);
}
Log.e("GCParser.postLog: Failed to post log because of unknown error");
- return new ImmutablePair<StatusCode, String>(StatusCode.LOG_POST_ERROR, "");
+ return new ImmutablePair<>(StatusCode.LOG_POST_ERROR, "");
}
/**
@@ -1188,7 +1188,7 @@ public abstract class GCParser {
final String page = GCLogin.getInstance().getRequestLogged(uri, null);
if (StringUtils.isBlank(page)) {
Log.e("GCParser.uploadLogImage: No data from server");
- return new ImmutablePair<StatusCode, String>(StatusCode.UNKNOWN_ERROR, null);
+ return new ImmutablePair<>(StatusCode.UNKNOWN_ERROR, null);
}
assert page != null;
@@ -1780,7 +1780,7 @@ public abstract class GCParser {
return Collections.emptyList();
}
- final List<LogType> types = new ArrayList<LogType>();
+ final List<LogType> types = new ArrayList<>();
final MatcherWrapper typeBoxMatcher = new MatcherWrapper(GCConstants.PATTERN_TYPEBOX, page);
if (typeBoxMatcher.find() && typeBoxMatcher.groupCount() > 0) {
@@ -1824,7 +1824,7 @@ public abstract class GCParser {
return null;
}
- final List<TrackableLog> trackableLogs = new ArrayList<TrackableLog>();
+ final List<TrackableLog> trackableLogs = new ArrayList<>();
final MatcherWrapper trackableMatcher = new MatcherWrapper(GCConstants.PATTERN_TRACKABLE, page);
while (trackableMatcher.find()) {
diff --git a/main/src/cgeo/geocaching/connector/gc/Tile.java b/main/src/cgeo/geocaching/connector/gc/Tile.java
index 44c425d..18fe65c 100644
--- a/main/src/cgeo/geocaching/connector/gc/Tile.java
+++ b/main/src/cgeo/geocaching/connector/gc/Tile.java
@@ -298,7 +298,7 @@ public class Tile {
* @return
*/
protected static Set<Tile> getTilesForViewport(final Viewport viewport, final int tilesOnAxis, final int minZoom) {
- Set<Tile> tiles = new HashSet<Tile>();
+ Set<Tile> tiles = new HashSet<>();
int zoom = Math.max(
Math.min(Tile.calcZoomLon(viewport.bottomLeft, viewport.topRight, tilesOnAxis),
Tile.calcZoomLat(viewport.bottomLeft, viewport.topRight, tilesOnAxis)),
@@ -331,7 +331,7 @@ public class Tile {
}
public void removeFromTileCache(@NonNull final ICoordinates point) {
- for (final Tile tile : new ArrayList<Tile>(this)) {
+ for (final Tile tile : new ArrayList<>(this)) {
if (tile.containsPoint(point)) {
remove(tile);
}
diff --git a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
index 910654d..3df62aa 100644
--- a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
+++ b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
@@ -151,7 +151,7 @@ final class OkapiClient {
public static List<Geocache> getCachesAround(final Geopoint center, final OCApiConnector connector) {
final String centerString = GeopointFormatter.format(GeopointFormatter.Format.LAT_DECDEGREE_RAW, center) + SEPARATOR + GeopointFormatter.format(GeopointFormatter.Format.LON_DECDEGREE_RAW, center);
final Parameters params = new Parameters("search_method", METHOD_SEARCH_NEAREST);
- final Map<String, String> valueMap = new LinkedHashMap<String, String>();
+ final Map<String, String> valueMap = new LinkedHashMap<>();
valueMap.put("center", centerString);
valueMap.put("limit", "20");
valueMap.put("radius", "200");
@@ -169,7 +169,7 @@ final class OkapiClient {
private static List<Geocache> getCachesByUser(final String username, final OCApiConnector connector, final String userRequestParam) {
final Parameters params = new Parameters("search_method", METHOD_SEARCH_ALL);
- final Map<String, String> valueMap = new LinkedHashMap<String, String>();
+ final Map<String, String> valueMap = new LinkedHashMap<>();
final @Nullable
String uuid = getUserUUID(connector, username);
if (StringUtils.isEmpty(uuid)) {
@@ -181,7 +181,7 @@ final class OkapiClient {
}
public static List<Geocache> getCachesNamed(final Geopoint center, final String namePart, final OCApiConnector connector) {
- final Map<String, String> valueMap = new LinkedHashMap<String, String>();
+ final Map<String, String> valueMap = new LinkedHashMap<>();
final Parameters params;
// search around current position, if there is a position
@@ -234,7 +234,7 @@ final class OkapiClient {
+ SEPARATOR + GeopointFormatter.format(GeopointFormatter.Format.LAT_DECDEGREE_RAW, viewport.topRight)
+ SEPARATOR + GeopointFormatter.format(GeopointFormatter.Format.LON_DECDEGREE_RAW, viewport.topRight);
final Parameters params = new Parameters("search_method", METHOD_SEARCH_BBOX);
- final Map<String, String> valueMap = new LinkedHashMap<String, String>();
+ final Map<String, String> valueMap = new LinkedHashMap<>();
valueMap.put("bbox", bboxString);
return requestCaches(connector, params, valueMap, false);
@@ -297,7 +297,7 @@ final class OkapiClient {
// Get and iterate result list
final JSONObject cachesResponse = response.getJSONObject("results");
if (cachesResponse != null) {
- final List<Geocache> caches = new ArrayList<Geocache>(cachesResponse.length());
+ final List<Geocache> caches = new ArrayList<>(cachesResponse.length());
final Iterator<?> keys = cachesResponse.keys();
while (keys.hasNext()) {
final Object next = keys.next();
@@ -462,7 +462,7 @@ final class OkapiClient {
parseLogType(logResponse.getString(LOG_TYPE)),
logResponse.getString(LOG_COMMENT).trim());
if (result == null) {
- result = new ArrayList<LogEntry>();
+ result = new ArrayList<>();
}
result.add(log);
} catch (final JSONException e) {
@@ -486,7 +486,7 @@ final class OkapiClient {
wpt.setCoords(pt);
}
if (result == null) {
- result = new ArrayList<Waypoint>();
+ result = new ArrayList<>();
}
wpt.setPrefix(wpt.getName());
result.add(wpt);
@@ -501,7 +501,7 @@ final class OkapiClient {
if (trackablesJson.length() == 0) {
return Collections.emptyList();
}
- final List<Trackable> result = new ArrayList<Trackable>();
+ final List<Trackable> result = new ArrayList<>();
for (int i = 0; i < trackablesJson.length(); i++) {
try {
final JSONObject trackableResponse = trackablesJson.getJSONObject(i);
@@ -599,7 +599,7 @@ final class OkapiClient {
private static List<String> parseAttributes(final JSONArray nameList, final JSONArray acodeList) {
- final List<String> result = new ArrayList<String>();
+ final List<String> result = new ArrayList<>();
for (int i = 0; i < nameList.length(); i++) {
try {
diff --git a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
index 0703c3c..1fdb0ac 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
@@ -164,9 +164,9 @@ public enum CacheAttribute {
}
private final static Map<String, CacheAttribute> FIND_BY_GCRAWNAME;
- private final static SparseArray<CacheAttribute> FIND_BY_OCACODE = new SparseArray<CacheAttribute>();
+ private final static SparseArray<CacheAttribute> FIND_BY_OCACODE = new SparseArray<>();
static {
- final HashMap<String, CacheAttribute> mapGcRawNames = new HashMap<String, CacheAttribute>();
+ final HashMap<String, CacheAttribute> mapGcRawNames = new HashMap<>();
for (CacheAttribute attr : values()) {
mapGcRawNames.put(attr.rawName, attr);
if (attr.ocacode != NO_ID) {
diff --git a/main/src/cgeo/geocaching/enumerations/CacheSize.java b/main/src/cgeo/geocaching/enumerations/CacheSize.java
index 1255455..c4e2831 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheSize.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheSize.java
@@ -40,7 +40,7 @@ public enum CacheSize {
final private static Map<String, CacheSize> FIND_BY_ID;
static {
- final HashMap<String, CacheSize> mapping = new HashMap<String, CacheSize>();
+ final HashMap<String, CacheSize> mapping = new HashMap<>();
for (final CacheSize cs : values()) {
mapping.put(cs.id.toLowerCase(Locale.US), cs);
mapping.put(cs.ocSize2.toLowerCase(Locale.US), cs);
diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java
index e36f1fd..16677da 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheType.java
@@ -60,9 +60,9 @@ public enum CacheType {
private final static Map<String, CacheType> FIND_BY_PATTERN;
private final static Map<String, CacheType> FIND_BY_GUID;
static {
- final HashMap<String, CacheType> mappingId = new HashMap<String, CacheType>();
- final HashMap<String, CacheType> mappingPattern = new HashMap<String, CacheType>();
- final HashMap<String, CacheType> mappingGuid = new HashMap<String, CacheType>();
+ final HashMap<String, CacheType> mappingId = new HashMap<>();
+ final HashMap<String, CacheType> mappingPattern = new HashMap<>();
+ final HashMap<String, CacheType> mappingGuid = new HashMap<>();
for (CacheType ct : values()) {
mappingId.put(ct.id, ct);
mappingPattern.put(ct.pattern.toLowerCase(Locale.US), ct);
diff --git a/main/src/cgeo/geocaching/enumerations/LogType.java b/main/src/cgeo/geocaching/enumerations/LogType.java
index fa65b71..84ab7b9 100644
--- a/main/src/cgeo/geocaching/enumerations/LogType.java
+++ b/main/src/cgeo/geocaching/enumerations/LogType.java
@@ -68,8 +68,8 @@ public enum LogType {
private final static Map<String, LogType> FIND_BY_ICONNAME;
private final static Map<String, LogType> FIND_BY_TYPE;
static {
- final HashMap<String, LogType> mappingPattern = new HashMap<String, LogType>();
- final HashMap<String, LogType> mappingType = new HashMap<String, LogType>();
+ final HashMap<String, LogType> mappingPattern = new HashMap<>();
+ final HashMap<String, LogType> mappingType = new HashMap<>();
for (LogType lt : values()) {
if (lt.iconName != null) {
mappingPattern.put(lt.iconName, lt);
diff --git a/main/src/cgeo/geocaching/enumerations/WaypointType.java b/main/src/cgeo/geocaching/enumerations/WaypointType.java
index 272b2f2..1805635 100644
--- a/main/src/cgeo/geocaching/enumerations/WaypointType.java
+++ b/main/src/cgeo/geocaching/enumerations/WaypointType.java
@@ -37,9 +37,9 @@ public enum WaypointType {
* non public so that <code>null</code> handling can be handled centrally in the enum type itself
*/
private static final Map<String, WaypointType> FIND_BY_ID;
- public static final Set<WaypointType> ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL = new HashSet<WaypointType>();
+ public static final Set<WaypointType> ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL = new HashSet<>();
static {
- final HashMap<String, WaypointType> mapping = new HashMap<String, WaypointType>();
+ final HashMap<String, WaypointType> mapping = new HashMap<>();
for (WaypointType wt : values()) {
mapping.put(wt.id, wt);
if (wt != WaypointType.OWN && wt != WaypointType.ORIGINAL) {
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index 26e96b3..61d03bc 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -98,7 +98,7 @@ public class GpxExport extends AbstractExport {
}
private static String[] getGeocodes(final List<Geocache> caches) {
- final ArrayList<String> allGeocodes = new ArrayList<String>(caches.size());
+ final ArrayList<String> allGeocodes = new ArrayList<>(caches.size());
for (final Geocache geocache : caches) {
allGeocodes.add(geocache.getGeocode());
}
@@ -132,7 +132,7 @@ public class GpxExport extends AbstractExport {
return null;
}
- final List<String> allGeocodes = new ArrayList<String>(Arrays.asList(geocodes));
+ final List<String> allGeocodes = new ArrayList<>(Arrays.asList(geocodes));
setMessage(CgeoApplication.getInstance().getResources().getQuantityString(R.plurals.cache_counts, allGeocodes.size(), allGeocodes.size()));
diff --git a/main/src/cgeo/geocaching/export/GpxSerializer.java b/main/src/cgeo/geocaching/export/GpxSerializer.java
index b2587aa..b24eb4c 100644
--- a/main/src/cgeo/geocaching/export/GpxSerializer.java
+++ b/main/src/cgeo/geocaching/export/GpxSerializer.java
@@ -57,7 +57,7 @@ public final class GpxSerializer {
public void writeGPX(List<String> allGeocodesIn, Writer writer, final ProgressListener progressListener) throws IOException {
// create a copy of the geocode list, as we need to modify it, but it might be immutable
- final ArrayList<String> allGeocodes = new ArrayList<String>(allGeocodesIn);
+ final ArrayList<String> allGeocodes = new ArrayList<>(allGeocodesIn);
this.progressListener = progressListener;
gpx.setOutput(writer);
@@ -184,8 +184,8 @@ public final class GpxSerializer {
private void writeWaypoints(final Geocache cache) throws IOException {
final List<Waypoint> waypoints = cache.getWaypoints();
- final List<Waypoint> ownWaypoints = new ArrayList<Waypoint>(waypoints.size());
- final List<Waypoint> originWaypoints = new ArrayList<Waypoint>(waypoints.size());
+ final List<Waypoint> ownWaypoints = new ArrayList<>(waypoints.size());
+ final List<Waypoint> originWaypoints = new ArrayList<>(waypoints.size());
int maxPrefix = 0;
for (final Waypoint wp : cache.getWaypoints()) {
diff --git a/main/src/cgeo/geocaching/files/AbstractFileListActivity.java b/main/src/cgeo/geocaching/files/AbstractFileListActivity.java
index 07b4fb4..2a05cbc 100644
--- a/main/src/cgeo/geocaching/files/AbstractFileListActivity.java
+++ b/main/src/cgeo/geocaching/files/AbstractFileListActivity.java
@@ -27,7 +27,7 @@ import java.util.List;
public abstract class AbstractFileListActivity<T extends ArrayAdapter<File>> extends AbstractListActivity {
private static final int MSG_SEARCH_WHOLE_SD_CARD = 1;
- private final List<File> files = new ArrayList<File>();
+ private final List<File> files = new ArrayList<>();
private T adapter = null;
private ProgressDialog waitDialog = null;
private SearchFilesThread searchingThread = null;
@@ -51,7 +51,7 @@ public abstract class AbstractFileListActivity<T extends ArrayAdapter<File>> ext
}
private String getDefaultFolders() {
- final ArrayList<String> names = new ArrayList<String>();
+ final ArrayList<String> names = new ArrayList<>();
for (File dir : getExistingBaseFolders()) {
names.add(dir.getPath());
}
@@ -152,7 +152,7 @@ public abstract class AbstractFileListActivity<T extends ArrayAdapter<File>> ext
@Override
public void run() {
- final List<File> list = new ArrayList<File>();
+ final List<File> list = new ArrayList<>();
try {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
@@ -213,7 +213,7 @@ public abstract class AbstractFileListActivity<T extends ArrayAdapter<File>> ext
}
protected List<File> getExistingBaseFolders() {
- ArrayList<File> result = new ArrayList<File>();
+ ArrayList<File> result = new ArrayList<>();
for (final File dir : getBaseFolders()) {
if (dir.exists() && dir.isDirectory()) {
result.add(dir);
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index d42c377..89ee887 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -105,12 +105,12 @@ public abstract class GPXParser extends FileParser {
private String parentCacheCode = null;
private boolean wptVisited = false;
private boolean wptUserDefined = false;
- private List<LogEntry> logs = new ArrayList<LogEntry>();
+ private List<LogEntry> logs = new ArrayList<>();
/**
* Parser result. Maps geocode to cache.
*/
- private final Set<String> result = new HashSet<String>(100);
+ private final Set<String> result = new HashSet<>(100);
private ProgressInputStream progressStream;
/**
* URL contained in the header of the GPX file. Used to guess where the file is coming from.
@@ -381,10 +381,10 @@ public abstract class GPXParser extends FileParser {
waypoint.setCoords(cache.getCoords());
waypoint.setNote(cache.getDescription());
waypoint.setVisited(wptVisited);
- final ArrayList<Waypoint> mergedWayPoints = new ArrayList<Waypoint>();
+ final ArrayList<Waypoint> mergedWayPoints = new ArrayList<>();
mergedWayPoints.addAll(cacheForWaypoint.getWaypoints());
- final ArrayList<Waypoint> newPoints = new ArrayList<Waypoint>();
+ final ArrayList<Waypoint> newPoints = new ArrayList<>();
newPoints.add(waypoint);
Waypoint.mergeWayPoints(newPoints, mergedWayPoints, true);
cacheForWaypoint.setWaypoints(newPoints, false);
@@ -1001,7 +1001,7 @@ public abstract class GPXParser extends FileParser {
parentCacheCode = null;
wptVisited = false;
wptUserDefined = false;
- logs = new ArrayList<LogEntry>();
+ logs = new ArrayList<>();
cache = new Geocache(this);
diff --git a/main/src/cgeo/geocaching/files/LocParser.java b/main/src/cgeo/geocaching/files/LocParser.java
index 223fb5a..2871d77 100644
--- a/main/src/cgeo/geocaching/files/LocParser.java
+++ b/main/src/cgeo/geocaching/files/LocParser.java
@@ -55,7 +55,7 @@ public final class LocParser extends FileParser {
final Map<String, Geocache> cidCoords = parseCoordinates(fileContent);
// save found cache coordinates
- final HashSet<String> contained = new HashSet<String>();
+ final HashSet<String> contained = new HashSet<>();
for (String geocode : searchResult.getGeocodes()) {
if (cidCoords.containsKey(geocode)) {
contained.add(geocode);
@@ -82,7 +82,7 @@ public final class LocParser extends FileParser {
}
static Map<String, Geocache> parseCoordinates(final String fileContent) {
- final Map<String, Geocache> coords = new HashMap<String, Geocache>();
+ final Map<String, Geocache> coords = new HashMap<>();
if (StringUtils.isBlank(fileContent)) {
return coords;
}
@@ -122,7 +122,7 @@ public final class LocParser extends FileParser {
final String streamContent = readStream(stream, null).toString();
final int maxSize = streamContent.length();
final Map<String, Geocache> coords = parseCoordinates(streamContent);
- final List<Geocache> caches = new ArrayList<Geocache>();
+ final List<Geocache> caches = new ArrayList<>();
for (Entry<String, Geocache> entry : coords.entrySet()) {
Geocache coord = entry.getValue();
if (StringUtils.isBlank(coord.getGeocode()) || StringUtils.isBlank(coord.getName())) {
diff --git a/main/src/cgeo/geocaching/files/LocalStorage.java b/main/src/cgeo/geocaching/files/LocalStorage.java
index 01c090b..63a1844 100644
--- a/main/src/cgeo/geocaching/files/LocalStorage.java
+++ b/main/src/cgeo/geocaching/files/LocalStorage.java
@@ -431,7 +431,7 @@ public final class LocalStorage {
public static List<File> getStorages() {
String extStorage = Environment.getExternalStorageDirectory().getAbsolutePath();
- List<File> storages = new ArrayList<File>();
+ List<File> storages = new ArrayList<>();
storages.add(new File(extStorage));
File file = new File(FILE_SYSTEM_TABLE_PATH);
if (file.canRead()) {
diff --git a/main/src/cgeo/geocaching/files/SimpleDirChooser.java b/main/src/cgeo/geocaching/files/SimpleDirChooser.java
index 009c18a..2aadf16 100644
--- a/main/src/cgeo/geocaching/files/SimpleDirChooser.java
+++ b/main/src/cgeo/geocaching/files/SimpleDirChooser.java
@@ -137,7 +137,7 @@ public class SimpleDirChooser extends AbstractListActivity {
final EditText path = (EditText) findViewById(R.id.simple_dir_chooser_path);
path.setText(this.getResources().getString(R.string.simple_dir_chooser_current_path) + " " + dir.getAbsolutePath());
final File[] dirs = dir.listFiles(new DirOnlyFilenameFilter());
- final List<Option> listDirs = new ArrayList<Option>();
+ final List<Option> listDirs = new ArrayList<>();
try {
for (final File currentDir : dirs) {
listDirs.add(new Option(currentDir.getName(), currentDir.getAbsolutePath(), currentDir.canWrite()));
diff --git a/main/src/cgeo/geocaching/filter/AbstractFilter.java b/main/src/cgeo/geocaching/filter/AbstractFilter.java
index 6bd8587..e602b0f 100644
--- a/main/src/cgeo/geocaching/filter/AbstractFilter.java
+++ b/main/src/cgeo/geocaching/filter/AbstractFilter.java
@@ -14,7 +14,7 @@ abstract class AbstractFilter implements IFilter {
@Override
public void filter(final List<Geocache> list) {
- final List<Geocache> itemsToRemove = new ArrayList<Geocache>();
+ final List<Geocache> itemsToRemove = new ArrayList<>();
for (Geocache item : list) {
if (!accepts(item)) {
itemsToRemove.add(item);
diff --git a/main/src/cgeo/geocaching/filter/AttributeFilter.java b/main/src/cgeo/geocaching/filter/AttributeFilter.java
index 552a48c..b59ab29 100644
--- a/main/src/cgeo/geocaching/filter/AttributeFilter.java
+++ b/main/src/cgeo/geocaching/filter/AttributeFilter.java
@@ -36,7 +36,7 @@ class AttributeFilter extends AbstractFilter {
final String packageName = CgeoApplication.getInstance().getBaseContext().getPackageName();
final Resources res = CgeoApplication.getInstance().getResources();
- final List<IFilter> filters = new LinkedList<IFilter>();
+ final List<IFilter> filters = new LinkedList<>();
for (final String id: res.getStringArray(R.array.attribute_ids)) {
filters.add(new AttributeFilter(getName("attribute_" + id, res, packageName), id));
}
diff --git a/main/src/cgeo/geocaching/filter/DifficultyFilter.java b/main/src/cgeo/geocaching/filter/DifficultyFilter.java
index 438c25a..175ad75 100644
--- a/main/src/cgeo/geocaching/filter/DifficultyFilter.java
+++ b/main/src/cgeo/geocaching/filter/DifficultyFilter.java
@@ -25,7 +25,7 @@ class DifficultyFilter extends AbstractRangeFilter {
@Override
public List<IFilter> getFilters() {
- final ArrayList<IFilter> filters = new ArrayList<IFilter>(DIFFICULTY_MAX);
+ final ArrayList<IFilter> filters = new ArrayList<>(DIFFICULTY_MAX);
for (int difficulty = DIFFICULTY_MIN; difficulty <= DIFFICULTY_MAX; difficulty++) {
filters.add(new DifficultyFilter(difficulty));
}
diff --git a/main/src/cgeo/geocaching/filter/DistanceFilter.java b/main/src/cgeo/geocaching/filter/DistanceFilter.java
index c217e7c..3328c72 100644
--- a/main/src/cgeo/geocaching/filter/DistanceFilter.java
+++ b/main/src/cgeo/geocaching/filter/DistanceFilter.java
@@ -40,7 +40,7 @@ class DistanceFilter extends AbstractFilter {
@Override
public List<IFilter> getFilters() {
- final List<IFilter> filters = new ArrayList<IFilter>(KILOMETERS.length);
+ final List<IFilter> filters = new ArrayList<>(KILOMETERS.length);
for (int i = 0; i < KILOMETERS.length; i++) {
final int minRange = KILOMETERS[i];
final int maxRange;
diff --git a/main/src/cgeo/geocaching/filter/FilterUserInterface.java b/main/src/cgeo/geocaching/filter/FilterUserInterface.java
index b6eaa78..9f1d563 100644
--- a/main/src/cgeo/geocaching/filter/FilterUserInterface.java
+++ b/main/src/cgeo/geocaching/filter/FilterUserInterface.java
@@ -44,7 +44,7 @@ public final class FilterUserInterface {
this.activity = activity;
this.res = CgeoApplication.getInstance().getResources();
- registry = new ArrayList<FactoryEntry>();
+ registry = new ArrayList<>();
if (Settings.getCacheType() == CacheType.ALL) {
register(R.string.caches_filter_type, TypeFilter.Factory.class);
}
@@ -82,7 +82,7 @@ public final class FilterUserInterface {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.caches_filter_title);
- final ArrayAdapter<FactoryEntry> adapter = new ArrayAdapter<FactoryEntry>(activity, android.R.layout.select_dialog_item, registry);
+ final ArrayAdapter<FactoryEntry> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, registry);
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
@Override
@@ -116,7 +116,7 @@ public final class FilterUserInterface {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(menuTitle);
- final ArrayAdapter<IFilter> adapter = new ArrayAdapter<IFilter>(activity, android.R.layout.select_dialog_item, filters);
+ final ArrayAdapter<IFilter> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, filters);
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int item) {
diff --git a/main/src/cgeo/geocaching/filter/OriginFilter.java b/main/src/cgeo/geocaching/filter/OriginFilter.java
index 8c54a4c..99d1c05 100644
--- a/main/src/cgeo/geocaching/filter/OriginFilter.java
+++ b/main/src/cgeo/geocaching/filter/OriginFilter.java
@@ -27,7 +27,7 @@ public class OriginFilter extends AbstractFilter {
@Override
public List<OriginFilter> getFilters() {
- final ArrayList<OriginFilter> filters = new ArrayList<OriginFilter>();
+ final ArrayList<OriginFilter> filters = new ArrayList<>();
for (IConnector connector : ConnectorFactory.getConnectors()) {
filters.add(new OriginFilter(connector));
}
diff --git a/main/src/cgeo/geocaching/filter/PopularityFilter.java b/main/src/cgeo/geocaching/filter/PopularityFilter.java
index d4f54ef..a0244b9 100644
--- a/main/src/cgeo/geocaching/filter/PopularityFilter.java
+++ b/main/src/cgeo/geocaching/filter/PopularityFilter.java
@@ -28,7 +28,7 @@ class PopularityFilter extends AbstractFilter {
@Override
public List<IFilter> getFilters() {
- final List<IFilter> filters = new ArrayList<IFilter>(FAVORITES.length);
+ final List<IFilter> filters = new ArrayList<>(FAVORITES.length);
for (int i = 0; i < FAVORITES.length; i++) {
final int minRange = FAVORITES[i];
final int maxRange = Integer.MAX_VALUE;
diff --git a/main/src/cgeo/geocaching/filter/PopularityRatioFilter.java b/main/src/cgeo/geocaching/filter/PopularityRatioFilter.java
index 5bfab28..a04f219 100644
--- a/main/src/cgeo/geocaching/filter/PopularityRatioFilter.java
+++ b/main/src/cgeo/geocaching/filter/PopularityRatioFilter.java
@@ -52,7 +52,7 @@ class PopularityRatioFilter extends AbstractFilter {
@Override
public List<IFilter> getFilters() {
- final List<IFilter> filters = new ArrayList<IFilter>(RATIOS.length);
+ final List<IFilter> filters = new ArrayList<>(RATIOS.length);
for (int i = 0; i < RATIOS.length; i++) {
final int minRange = RATIOS[i];
final int maxRange = Integer.MAX_VALUE;
diff --git a/main/src/cgeo/geocaching/filter/SizeFilter.java b/main/src/cgeo/geocaching/filter/SizeFilter.java
index 13c1d87..f02874c 100644
--- a/main/src/cgeo/geocaching/filter/SizeFilter.java
+++ b/main/src/cgeo/geocaching/filter/SizeFilter.java
@@ -29,7 +29,7 @@ class SizeFilter extends AbstractFilter {
@Override
public List<IFilter> getFilters() {
final CacheSize[] cacheSizes = CacheSize.values();
- final List<IFilter> filters = new LinkedList<IFilter>();
+ final List<IFilter> filters = new LinkedList<>();
for (CacheSize cacheSize : cacheSizes) {
if (cacheSize != CacheSize.UNKNOWN) {
filters.add(new SizeFilter(cacheSize));
diff --git a/main/src/cgeo/geocaching/filter/StateFilter.java b/main/src/cgeo/geocaching/filter/StateFilter.java
index fd14b69..ebe133c 100644
--- a/main/src/cgeo/geocaching/filter/StateFilter.java
+++ b/main/src/cgeo/geocaching/filter/StateFilter.java
@@ -126,7 +126,7 @@ abstract class StateFilter extends AbstractFilter {
@Override
public List<StateFilter> getFilters() {
- final List<StateFilter> filters = new ArrayList<StateFilter>(6);
+ final List<StateFilter> filters = new ArrayList<>(6);
filters.add(new StateFoundFilter());
filters.add(new StateNotFoundFilter());
filters.add(new StateArchivedFilter());
diff --git a/main/src/cgeo/geocaching/filter/TerrainFilter.java b/main/src/cgeo/geocaching/filter/TerrainFilter.java
index f14313c..7da6a19 100644
--- a/main/src/cgeo/geocaching/filter/TerrainFilter.java
+++ b/main/src/cgeo/geocaching/filter/TerrainFilter.java
@@ -24,7 +24,7 @@ class TerrainFilter extends AbstractRangeFilter {
@Override
public List<IFilter> getFilters() {
- final ArrayList<IFilter> filters = new ArrayList<IFilter>(TERRAIN_MAX);
+ final ArrayList<IFilter> filters = new ArrayList<>(TERRAIN_MAX);
for (int terrain = TERRAIN_MIN; terrain <= TERRAIN_MAX; terrain++) {
filters.add(new TerrainFilter(terrain));
}
diff --git a/main/src/cgeo/geocaching/filter/TypeFilter.java b/main/src/cgeo/geocaching/filter/TypeFilter.java
index ea0ccff..d363d39 100644
--- a/main/src/cgeo/geocaching/filter/TypeFilter.java
+++ b/main/src/cgeo/geocaching/filter/TypeFilter.java
@@ -29,7 +29,7 @@ class TypeFilter extends AbstractFilter {
@Override
public List<IFilter> getFilters() {
final CacheType[] types = CacheType.values();
- final List<IFilter> filters = new LinkedList<IFilter>();
+ final List<IFilter> filters = new LinkedList<>();
for (CacheType cacheType : types) {
if (cacheType != CacheType.ALL) {
filters.add(new TypeFilter(cacheType));
diff --git a/main/src/cgeo/geocaching/gcvote/GCVote.java b/main/src/cgeo/geocaching/gcvote/GCVote.java
index d77a4e6..8de3edc 100644
--- a/main/src/cgeo/geocaching/gcvote/GCVote.java
+++ b/main/src/cgeo/geocaching/gcvote/GCVote.java
@@ -35,7 +35,7 @@ public final class GCVote {
private static final Pattern PATTERN_VOTE_ELEMENT = Pattern.compile("<vote ([^>]+)>", Pattern.CASE_INSENSITIVE);
private static final int MAX_CACHED_RATINGS = 1000;
- private static final LeastRecentlyUsedMap<String, GCVoteRating> RATINGS_CACHE = new LeastRecentlyUsedMap.LruCache<String, GCVoteRating>(MAX_CACHED_RATINGS);
+ private static final LeastRecentlyUsedMap<String, GCVoteRating> RATINGS_CACHE = new LeastRecentlyUsedMap.LruCache<>(MAX_CACHED_RATINGS);
private static final float MIN_RATING = 1;
private static final float MAX_RATING = 5;
@@ -76,7 +76,7 @@ public final class GCVote {
return null;
}
- final Map<String, GCVoteRating> ratings = new HashMap<String, GCVoteRating>();
+ final Map<String, GCVoteRating> ratings = new HashMap<>();
try {
final Parameters params = new Parameters();
@@ -261,7 +261,7 @@ public final class GCVote {
*/
private static @NonNull
ArrayList<String> getVotableGeocodes(final @NonNull Collection<Geocache> caches) {
- final ArrayList<String> geocodes = new ArrayList<String>(caches.size());
+ final ArrayList<String> geocodes = new ArrayList<>(caches.size());
for (final Geocache cache : caches) {
String geocode = cache.getGeocode();
if (StringUtils.isNotBlank(geocode) && cache.supportsGCVote()) {
diff --git a/main/src/cgeo/geocaching/geopoint/Units.java b/main/src/cgeo/geocaching/geopoint/Units.java
index d00e075..018216d 100644
--- a/main/src/cgeo/geocaching/geopoint/Units.java
+++ b/main/src/cgeo/geocaching/geopoint/Units.java
@@ -28,7 +28,7 @@ public class Units {
units = "m";
}
}
- return new ImmutablePair<Double, String>(distance, units);
+ return new ImmutablePair<>(distance, units);
}
public static String getDistanceFromKilometers(final Float distanceKilometers) {
diff --git a/main/src/cgeo/geocaching/list/AbstractList.java b/main/src/cgeo/geocaching/list/AbstractList.java
index 06f44a2..9b57b3a 100644
--- a/main/src/cgeo/geocaching/list/AbstractList.java
+++ b/main/src/cgeo/geocaching/list/AbstractList.java
@@ -8,7 +8,7 @@ public abstract class AbstractList {
public final int id;
public final String title;
- private static SparseArray<AbstractList> LISTS = new SparseArray<AbstractList>();
+ private static SparseArray<AbstractList> LISTS = new SparseArray<>();
public AbstractList(final int id, final String title) {
this.id = id;
diff --git a/main/src/cgeo/geocaching/list/StoredList.java b/main/src/cgeo/geocaching/list/StoredList.java
index 6dac1a7..53632a0 100644
--- a/main/src/cgeo/geocaching/list/StoredList.java
+++ b/main/src/cgeo/geocaching/list/StoredList.java
@@ -64,7 +64,7 @@ public final class StoredList extends AbstractList {
private final Resources res;
public UserInterface(final @NonNull Activity activity) {
- this.activityRef = new WeakReference<Activity>(activity);
+ this.activityRef = new WeakReference<>(activity);
app = CgeoApplication.getInstance();
res = app.getResources();
}
@@ -80,7 +80,7 @@ public final class StoredList extends AbstractList {
public void promptForListSelection(final int titleId, @NonNull final Action1<Integer> runAfterwards, final boolean onlyConcreteLists, final int exceptListId, final String newListName) {
final List<AbstractList> lists = getMenuLists(onlyConcreteLists, exceptListId);
- final List<CharSequence> listsTitle = new ArrayList<CharSequence>();
+ final List<CharSequence> listsTitle = new ArrayList<>();
for (AbstractList list : lists) {
listsTitle.add(list.getTitleAndCount());
}
@@ -107,7 +107,7 @@ public final class StoredList extends AbstractList {
}
public static List<AbstractList> getMenuLists(boolean onlyConcreteLists, int exceptListId) {
- final List<AbstractList> lists = new ArrayList<AbstractList>();
+ final List<AbstractList> lists = new ArrayList<>();
lists.addAll(getSortedLists());
if (exceptListId > StoredList.TEMPORARY_LIST_ID) {
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index fc94ad4..da76c4c 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -180,13 +180,13 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
private static final int[][] INSET_USERMODIFIEDCOORDS = { { 21, 28, 0, 0 }, { 19, 25, 0, 0 }, { 25, 33, 0, 0 } }; // bottom right, 12x12 / 26x26 / 35x35
private static final int[][] INSET_PERSONALNOTE = { { 0, 28, 21, 0 }, { 0, 25, 19, 0 }, { 0, 33, 25, 0 } }; // bottom left, 12x12 / 26x26 / 35x35
- private final SparseArray<LayerDrawable> overlaysCache = new SparseArray<LayerDrawable>();
+ private final SparseArray<LayerDrawable> overlaysCache = new SparseArray<>();
/** Count of caches currently visible */
private int cachesCnt = 0;
/** List of caches in the viewport */
private LeastRecentlyUsedSet<Geocache> caches = null;
/** List of waypoints in the viewport */
- private final LeastRecentlyUsedSet<Waypoint> waypoints = new LeastRecentlyUsedSet<Waypoint>(MAX_CACHES);
+ private final LeastRecentlyUsedSet<Waypoint> waypoints = new LeastRecentlyUsedSet<>(MAX_CACHES);
// storing for offline
private ProgressDialog waitDialog = null;
private int detailTotal = 0;
@@ -203,18 +203,18 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
private boolean markersInvalidated = false; // previous state for loadTimer
private boolean centered = false; // if map is already centered
private boolean alreadyCentered = false; // -""- for setting my location
- private static final Set<String> dirtyCaches = new HashSet<String>();
+ private static final Set<String> dirtyCaches = new HashSet<>();
/**
* if live map is enabled, this is the minimum zoom level, independent of the stored setting
*/
private static final int MIN_LIVEMAP_ZOOM = 12;
// Thread pooling
- private static BlockingQueue<Runnable> displayQueue = new ArrayBlockingQueue<Runnable>(1);
+ private static BlockingQueue<Runnable> displayQueue = new ArrayBlockingQueue<>(1);
private static ThreadPoolExecutor displayExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, displayQueue, new ThreadPoolExecutor.DiscardOldestPolicy());
- private static BlockingQueue<Runnable> downloadQueue = new ArrayBlockingQueue<Runnable>(1);
+ private static BlockingQueue<Runnable> downloadQueue = new ArrayBlockingQueue<>(1);
private static ThreadPoolExecutor downloadExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, downloadQueue, new ThreadPoolExecutor.DiscardOldestPolicy());
- private static BlockingQueue<Runnable> loadQueue = new ArrayBlockingQueue<Runnable>(1);
+ private static BlockingQueue<Runnable> loadQueue = new ArrayBlockingQueue<>(1);
private static ThreadPoolExecutor loadExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, loadQueue, new ThreadPoolExecutor.DiscardOldestPolicy());
// handlers
@@ -224,7 +224,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
private final WeakReference<CGeoMap> mapRef;
public DisplayHandler(@NonNull final CGeoMap map) {
- this.mapRef = new WeakReference<CGeoMap>(map);
+ this.mapRef = new WeakReference<>(map);
}
@Override
@@ -296,7 +296,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
@NonNull private final WeakReference<CGeoMap> mapRef;
public ShowProgressHandler(@NonNull final CGeoMap map) {
- this.mapRef = new WeakReference<CGeoMap>(map);
+ this.mapRef = new WeakReference<>(map);
}
@Override
@@ -437,7 +437,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
app = (CgeoApplication) activity.getApplication();
final int countBubbleCnt = DataStore.getAllCachesCount();
- caches = new LeastRecentlyUsedSet<Geocache>(MAX_CACHES + countBubbleCnt);
+ caches = new LeastRecentlyUsedSet<>(MAX_CACHES + countBubbleCnt);
final MapProvider mapProvider = Settings.getMapProvider();
mapItemFactory = mapProvider.getMapItemFactory();
@@ -718,7 +718,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
case R.id.menu_store_caches:
if (!isLoading()) {
final Set<String> geocodesInViewport = getGeocodesForCachesInViewport();
- final List<String> geocodes = new ArrayList<String>();
+ final List<String> geocodes = new ArrayList<>();
for (final String geocode : geocodesInViewport) {
if (!DataStore.isOffline(geocode, null)) {
@@ -815,7 +815,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
currentTheme = currentThemeFile.getName();
}
- final List<String> names = new ArrayList<String>();
+ final List<String> names = new ArrayList<>();
names.add(res.getString(R.string.map_theme_builtin));
int currentItem = 0;
for (final File file : themeFiles) {
@@ -856,7 +856,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
* @return a non-null Set of geocodes corresponding to the caches that are shown on screen.
*/
private Set<String> getGeocodesForCachesInViewport() {
- final Set<String> geocodes = new HashSet<String>();
+ final Set<String> geocodes = new HashSet<>();
final List<Geocache> cachesProtected = caches.getAsList();
final Viewport viewport = mapView.getViewport();
@@ -980,7 +980,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
private final WeakReference<CGeoMap> map;
public UpdateLoc(final CGeoMap map) {
- this.map = new WeakReference<CGeoMap>(map);
+ this.map = new WeakReference<>(map);
}
@Override
@@ -1091,7 +1091,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
@NonNull private final WeakReference<CGeoMap> mapRef;
public LoadTimerAction(@NonNull final CGeoMap map) {
- this.mapRef = new WeakReference<CGeoMap>(map);
+ this.mapRef = new WeakReference<>(map);
}
@Override
@@ -1331,8 +1331,8 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
// display caches
final List<Geocache> cachesToDisplay = caches.getAsList();
- final List<Waypoint> waypointsToDisplay = new ArrayList<Waypoint>(waypoints);
- final List<CachesOverlayItemImpl> itemsToDisplay = new ArrayList<CachesOverlayItemImpl>();
+ final List<Waypoint> waypointsToDisplay = new ArrayList<>(waypoints);
+ final List<CachesOverlayItemImpl> itemsToDisplay = new ArrayList<>();
if (!cachesToDisplay.isEmpty()) {
// Only show waypoints for single view or setting
@@ -1389,7 +1389,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
private final WeakReference<CGeoMap> mapRef;
protected DoRunnable(@NonNull final CGeoMap map) {
- mapRef = new WeakReference<CGeoMap>(map);
+ mapRef = new WeakReference<>(map);
}
protected @Nullable
@@ -1494,7 +1494,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
final boolean excludeMine = Settings.isExcludeMyCaches();
final boolean excludeDisabled = Settings.isExcludeDisabledCaches();
- final List<Geocache> removeList = new ArrayList<Geocache>();
+ final List<Geocache> removeList = new ArrayList<>();
for (final Geocache cache : caches) {
if ((excludeMine && cache.isFound()) || (excludeMine && cache.isOwner()) || (excludeDisabled && cache.isDisabled()) || (excludeDisabled && cache.isArchived())) {
removeList.add(cache);
@@ -1596,7 +1596,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
private final WeakReference<CGeoMap> mapRef;
public MyLocationListener(@NonNull final CGeoMap map) {
- mapRef = new WeakReference<CGeoMap>(map);
+ mapRef = new WeakReference<>(map);
}
@Override
@@ -1618,7 +1618,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
private final WeakReference<CGeoMap> mapRef;
public MapDragListener(@NonNull final CGeoMap map) {
- mapRef = new WeakReference<CGeoMap>(map);
+ mapRef = new WeakReference<>(map);
}
@Override
@@ -1726,8 +1726,8 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
private LayerDrawable createCacheItem(final Geocache cache, final int hashcode) {
// Set initial capacities to the maximum of layers and insets to avoid dynamic reallocation
- final ArrayList<Drawable> layers = new ArrayList<Drawable>(9);
- final ArrayList<int[]> insets = new ArrayList<int[]>(8);
+ final ArrayList<Drawable> layers = new ArrayList<>(9);
+ final ArrayList<int[]> insets = new ArrayList<>(8);
// background: disabled or not
final Drawable marker = getResources().getDrawable(cache.getMapMarkerId());
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java
index 8607c88..3c6109e 100644
--- a/main/src/cgeo/geocaching/maps/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java
@@ -40,7 +40,7 @@ import java.util.List;
public class CachesOverlay extends AbstractItemizedOverlay {
- private List<CachesOverlayItemImpl> items = new ArrayList<CachesOverlayItemImpl>();
+ private List<CachesOverlayItemImpl> items = new ArrayList<>();
private Context context = null;
private boolean displayCircles = false;
private Progress progress = new Progress();
@@ -61,7 +61,7 @@ public class CachesOverlay extends AbstractItemizedOverlay {
}
void updateItems(CachesOverlayItemImpl item) {
- List<CachesOverlayItemImpl> itemsPre = new ArrayList<CachesOverlayItemImpl>();
+ List<CachesOverlayItemImpl> itemsPre = new ArrayList<>();
itemsPre.add(item);
updateItems(itemsPre);
@@ -79,7 +79,7 @@ public class CachesOverlay extends AbstractItemizedOverlay {
// ensure no interference between the draw and content changing routines
getOverlayImpl().lock();
try {
- items = new ArrayList<CachesOverlayItemImpl>(itemsPre);
+ items = new ArrayList<>(itemsPre);
setLastFocusedItemIndex(-1); // to reset tap during data change
populate();
diff --git a/main/src/cgeo/geocaching/maps/MapProviderFactory.java b/main/src/cgeo/geocaching/maps/MapProviderFactory.java
index 890274d..b31ba1e 100644
--- a/main/src/cgeo/geocaching/maps/MapProviderFactory.java
+++ b/main/src/cgeo/geocaching/maps/MapProviderFactory.java
@@ -21,7 +21,7 @@ import java.util.List;
public class MapProviderFactory {
- private final static ArrayList<MapSource> mapSources = new ArrayList<MapSource>();
+ private final static ArrayList<MapSource> mapSources = new ArrayList<>();
static {
// add GoogleMapProvider only if google api is available in order to support x86 android emulator
@@ -108,7 +108,7 @@ public class MapProviderFactory {
* remove offline map sources after changes of the settings
*/
public static void deleteOfflineMapSources() {
- final ArrayList<MapSource> deletion = new ArrayList<MapSource>();
+ final ArrayList<MapSource> deletion = new ArrayList<>();
for (MapSource mapSource : mapSources) {
if (mapSource instanceof MapsforgeMapProvider.OfflineMapSource) {
deletion.add(mapSource);
diff --git a/main/src/cgeo/geocaching/maps/PositionDrawer.java b/main/src/cgeo/geocaching/maps/PositionDrawer.java
index 0e20e7c..08244ef 100644
--- a/main/src/cgeo/geocaching/maps/PositionDrawer.java
+++ b/main/src/cgeo/geocaching/maps/PositionDrawer.java
@@ -103,7 +103,7 @@ public class PositionDrawer {
if (Settings.isMapTrail()) {
// always add current position to drawn history to have a closed connection
- final ArrayList<Location> paintHistory = new ArrayList<Location>(positionHistory.getHistory());
+ final ArrayList<Location> paintHistory = new ArrayList<>(positionHistory.getHistory());
paintHistory.add(coordinates);
int size = paintHistory.size();
diff --git a/main/src/cgeo/geocaching/maps/PositionHistory.java b/main/src/cgeo/geocaching/maps/PositionHistory.java
index bc6779e..af13740 100644
--- a/main/src/cgeo/geocaching/maps/PositionHistory.java
+++ b/main/src/cgeo/geocaching/maps/PositionHistory.java
@@ -19,7 +19,7 @@ public class PositionHistory {
*/
private static final int MAX_POSITIONS = 700;
- private ArrayList<Location> history = new ArrayList<Location>();
+ private ArrayList<Location> history = new ArrayList<>();
/**
* Adds the current position to the trail history to be able to show the trail on the map.
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
index 9f09991..01b10ec 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
@@ -59,7 +59,7 @@ public final class MapsforgeMapProvider extends AbstractMapProvider {
File directory = new File(directoryPath);
if (directory.isDirectory()) {
try {
- ArrayList<String> mapFileList = new ArrayList<String>();
+ ArrayList<String> mapFileList = new ArrayList<>();
final File[] files = directory.listFiles();
if (ArrayUtils.isNotEmpty(files)) {
for (File file : files) {
diff --git a/main/src/cgeo/geocaching/network/HtmlImage.java b/main/src/cgeo/geocaching/network/HtmlImage.java
index 7a5851a..f05483b 100644
--- a/main/src/cgeo/geocaching/network/HtmlImage.java
+++ b/main/src/cgeo/geocaching/network/HtmlImage.java
@@ -171,7 +171,7 @@ public class HtmlImage implements Html.ImageGetter {
private Pair<BitmapDrawable, Boolean> loadFromDisk() {
final Pair<Bitmap, Boolean> loadResult = loadImageFromStorage(url, pseudoGeocode, shared);
final Bitmap bitmap = loadResult.getLeft();
- return new ImmutablePair<BitmapDrawable, Boolean>(bitmap != null ?
+ return new ImmutablePair<>(bitmap != null ?
ImageUtils.scaleBitmapToFitDisplay(bitmap) :
null,
loadResult.getRight()
@@ -300,7 +300,7 @@ public class HtmlImage implements Html.ImageGetter {
} catch (Exception e) {
Log.w("HtmlImage.loadImageFromStorage", e);
}
- return new ImmutablePair<Bitmap, Boolean>(null, false);
+ return new ImmutablePair<>(null, false);
}
@Nullable
@@ -342,7 +342,7 @@ public class HtmlImage implements Html.ImageGetter {
if (file.exists()) {
final boolean freshEnough = listId >= StoredList.STANDARD_LIST_ID || file.lastModified() > (new Date().getTime() - (24 * 60 * 60 * 1000)) || forceKeep;
if (onlySave) {
- return new ImmutablePair<Bitmap, Boolean>(null, true);
+ return new ImmutablePair<>(null, true);
}
final BitmapFactory.Options bfOptions = new BitmapFactory.Options();
bfOptions.inTempStorage = new byte[16 * 1024];
@@ -351,12 +351,12 @@ public class HtmlImage implements Html.ImageGetter {
final Bitmap image = BitmapFactory.decodeFile(file.getPath(), bfOptions);
if (image == null) {
Log.e("Cannot decode bitmap from " + file.getPath());
- return new ImmutablePair<Bitmap, Boolean>(null, false);
+ return new ImmutablePair<>(null, false);
}
- return new ImmutablePair<Bitmap, Boolean>(image,
+ return new ImmutablePair<>(image,
freshEnough);
}
- return new ImmutablePair<Bitmap, Boolean>(null, false);
+ return new ImmutablePair<>(null, false);
}
private void setSampleSize(final File file, final BitmapFactory.Options bfOptions) {
diff --git a/main/src/cgeo/geocaching/network/OAuth.java b/main/src/cgeo/geocaching/network/OAuth.java
index fa376af..cfc62fc 100644
--- a/main/src/cgeo/geocaching/network/OAuth.java
+++ b/main/src/cgeo/geocaching/network/OAuth.java
@@ -31,7 +31,7 @@ public class OAuth {
"oauth_version", "1.0");
params.sort();
- final List<String> paramsEncoded = new ArrayList<String>();
+ final List<String> paramsEncoded = new ArrayList<>();
for (final NameValuePair nameValue : params) {
paramsEncoded.add(nameValue.getName() + "=" + OAuth.percentEncode(nameValue.getValue()));
}
diff --git a/main/src/cgeo/geocaching/settings/CheckECCredentialsPreference.java b/main/src/cgeo/geocaching/settings/CheckECCredentialsPreference.java
index c1cf740..027858e 100644
--- a/main/src/cgeo/geocaching/settings/CheckECCredentialsPreference.java
+++ b/main/src/cgeo/geocaching/settings/CheckECCredentialsPreference.java
@@ -27,6 +27,6 @@ public class CheckECCredentialsPreference extends AbstractCheckCredentialsPrefer
@Override
protected ImmutablePair<StatusCode, Drawable> login() {
- return new ImmutablePair<StatusCode, Drawable>(ECLogin.getInstance().login(), null);
+ return new ImmutablePair<>(ECLogin.getInstance().login(), null);
}
}
diff --git a/main/src/cgeo/geocaching/settings/OCPreferenceKeys.java b/main/src/cgeo/geocaching/settings/OCPreferenceKeys.java
index 39d4776..66a798a 100644
--- a/main/src/cgeo/geocaching/settings/OCPreferenceKeys.java
+++ b/main/src/cgeo/geocaching/settings/OCPreferenceKeys.java
@@ -49,9 +49,9 @@ public enum OCPreferenceKeys {
private static final SparseArray<OCPreferenceKeys> FIND_BY_AUTH_PREF_ID;
static {
- FIND_BY_ISACTIVE_ID = new SparseArray<OCPreferenceKeys>(values().length);
- FIND_BY_AUTH_PREF_ID = new SparseArray<OCPreferenceKeys>(values().length);
- final Map<String, OCPreferenceKeys> byIsactiveKey = new HashMap<String, OCPreferenceKeys>();
+ FIND_BY_ISACTIVE_ID = new SparseArray<>(values().length);
+ FIND_BY_AUTH_PREF_ID = new SparseArray<>(values().length);
+ final Map<String, OCPreferenceKeys> byIsactiveKey = new HashMap<>();
for (final OCPreferenceKeys key : values()) {
FIND_BY_ISACTIVE_ID.put(key.isActivePrefId, key);
FIND_BY_AUTH_PREF_ID.put(key.authPrefId, key);
diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java
index 6101db0..0c5acae 100644
--- a/main/src/cgeo/geocaching/settings/Settings.java
+++ b/main/src/cgeo/geocaching/settings/Settings.java
@@ -297,10 +297,10 @@ public class Settings {
final String password = getString(connector.getPasswordPreferenceKey(), null);
if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
- return new ImmutablePair<String, String>(StringUtils.EMPTY, StringUtils.EMPTY);
+ return new ImmutablePair<>(StringUtils.EMPTY, StringUtils.EMPTY);
}
- return new ImmutablePair<String, String>(username, password);
+ return new ImmutablePair<>(username, password);
}
public static String getUsername() {
@@ -336,7 +336,7 @@ public class Settings {
}
public static ImmutablePair<String, String> getTokenPair(final int tokenPublicPrefKey, final int tokenSecretPrefKey) {
- return new ImmutablePair<String, String>(getString(tokenPublicPrefKey, null), getString(tokenSecretPrefKey, null));
+ return new ImmutablePair<>(getString(tokenPublicPrefKey, null), getString(tokenSecretPrefKey, null));
}
public static void setTokens(final int tokenPublicPrefKey, @Nullable final String tokenPublic, final int tokenSecretPrefKey, @Nullable final String tokenSecret) {
@@ -376,7 +376,7 @@ public class Settings {
return null;
}
- return new ImmutablePair<String, String>(username, password);
+ return new ImmutablePair<>(username, password);
}
public static String getSignature() {
@@ -790,7 +790,7 @@ public class Settings {
public static ImmutablePair<String, String> getTempToken() {
final String tokenPublic = getString(R.string.pref_temp_twitter_token_public, null);
final String tokenSecret = getString(R.string.pref_temp_twitter_token_secret, null);
- return new ImmutablePair<String, String>(tokenPublic, tokenSecret);
+ return new ImmutablePair<>(tokenPublic, tokenSecret);
}
public static int getVersion() {
@@ -901,7 +901,7 @@ public class Settings {
public static File[] getMapThemeFiles() {
final File directory = new File(Settings.getCustomRenderThemeBaseFolder());
- final List<File> result = new ArrayList<File>();
+ final List<File> result = new ArrayList<>();
FileUtils.listDir(result, directory, new ExtensionsBasedFileSelector(new String[] { "xml" }), null);
return result.toArray(new File[result.size()]);
@@ -1030,7 +1030,7 @@ public class Settings {
}
public static void addCacheToHistory(@NonNull final String geocode) {
- final ArrayList<String> history = new ArrayList<String>(getLastOpenedCaches());
+ final ArrayList<String> history = new ArrayList<>(getLastOpenedCaches());
// bring entry to front, if it already existed
history.remove(geocode);
history.add(0, geocode);
diff --git a/main/src/cgeo/geocaching/sorting/DateComparator.java b/main/src/cgeo/geocaching/sorting/DateComparator.java
index 9df70f9..7913941 100644
--- a/main/src/cgeo/geocaching/sorting/DateComparator.java
+++ b/main/src/cgeo/geocaching/sorting/DateComparator.java
@@ -19,7 +19,7 @@ public class DateComparator extends AbstractCacheComparator {
final int dateDifference = date1.compareTo(date2);
// for equal dates, sort by distance
if (dateDifference == 0) {
- final ArrayList<Geocache> list = new ArrayList<Geocache>();
+ final ArrayList<Geocache> list = new ArrayList<>();
list.add(cache1);
list.add(cache2);
final DistanceComparator distanceComparator = new DistanceComparator(CgeoApplication.getInstance().currentGeo().getCoords(), list);
diff --git a/main/src/cgeo/geocaching/sorting/SortActionProvider.java b/main/src/cgeo/geocaching/sorting/SortActionProvider.java
index 8663391..e9e65a0 100644
--- a/main/src/cgeo/geocaching/sorting/SortActionProvider.java
+++ b/main/src/cgeo/geocaching/sorting/SortActionProvider.java
@@ -26,7 +26,7 @@ public class SortActionProvider extends ActionProvider implements OnMenuItemClic
private static final int MENU_GROUP = 1;
private final Context mContext;
- private final ArrayList<ComparatorEntry> registry = new ArrayList<ComparatorEntry>(20);
+ private final ArrayList<ComparatorEntry> registry = new ArrayList<>(20);
/**
* Callback triggered on selecting a new sort order.
*/
diff --git a/main/src/cgeo/geocaching/ui/AbstractUserClickListener.java b/main/src/cgeo/geocaching/ui/AbstractUserClickListener.java
index 2a78f07..f26cb53 100644
--- a/main/src/cgeo/geocaching/ui/AbstractUserClickListener.java
+++ b/main/src/cgeo/geocaching/ui/AbstractUserClickListener.java
@@ -45,7 +45,7 @@ abstract class AbstractUserClickListener implements View.OnClickListener {
final AbstractActivity activity = (AbstractActivity) view.getContext();
final Resources res = activity.getResources();
- ArrayList<String> labels = new ArrayList<String>(userActions.size());
+ ArrayList<String> labels = new ArrayList<>(userActions.size());
for (UserAction action : userActions) {
labels.add(res.getString(action.displayResourceId));
}
diff --git a/main/src/cgeo/geocaching/ui/AddressListAdapter.java b/main/src/cgeo/geocaching/ui/AddressListAdapter.java
index 5d16df5..81b6c23 100644
--- a/main/src/cgeo/geocaching/ui/AddressListAdapter.java
+++ b/main/src/cgeo/geocaching/ui/AddressListAdapter.java
@@ -81,7 +81,7 @@ public class AddressListAdapter extends ArrayAdapter<Address> {
private static CharSequence getAddressText(final Address address) {
final int maxIndex = address.getMaxAddressLineIndex();
- final ArrayList<String> lines = new ArrayList<String>();
+ final ArrayList<String> lines = new ArrayList<>();
for (int i = 0; i <= maxIndex; i++) {
final String line = address.getAddressLine(i);
if (StringUtils.isNotBlank(line)) {
diff --git a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
index afd3666..8a7f167 100644
--- a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
+++ b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
@@ -101,7 +101,7 @@ public final class CacheDetailsCreator {
public void addCacheState(final Geocache cache) {
if (cache.isLogOffline() || cache.isArchived() || cache.isDisabled() || cache.isPremiumMembersOnly() || cache.isFound()) {
- final List<String> states = new ArrayList<String>(5);
+ final List<String> states = new ArrayList<>(5);
if (cache.isLogOffline()) {
states.add(res.getString(R.string.cache_status_offline_log));
}
diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
index f132bda..5b1bd61 100644
--- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java
+++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
@@ -66,8 +66,8 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
private List<Geocache> originalList = null;
private final boolean isLiveList = Settings.isLiveList();
- final private Set<CompassMiniView> compasses = new LinkedHashSet<CompassMiniView>();
- final private Set<DistanceView> distances = new LinkedHashSet<DistanceView>();
+ final private Set<CompassMiniView> compasses = new LinkedHashSet<>();
+ final private Set<DistanceView> distances = new LinkedHashSet<>();
final private CacheListType cacheListType;
final private Resources res;
/** Resulting list of caches */
@@ -77,7 +77,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
private static final int SWIPE_MIN_DISTANCE = 60;
private static final int SWIPE_MAX_OFF_PATH = 100;
- private static final SparseArray<Drawable> gcIconDrawables = new SparseArray<Drawable>();
+ private static final SparseArray<Drawable> gcIconDrawables = new SparseArray<>();
/**
* time in milliseconds after which the list may be resorted due to position updates
*/
@@ -200,7 +200,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
public void reFilter() {
if (currentFilter != null) {
// Back up the list again
- originalList = new ArrayList<Geocache>(list);
+ originalList = new ArrayList<>(list);
currentFilter.filter(list);
}
@@ -212,7 +212,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
public void setFilter(final IFilter filter) {
// Backup current caches list if it isn't backed up yet
if (originalList == null) {
- originalList = new ArrayList<Geocache>(list);
+ originalList = new ArrayList<>(list);
}
// If there is already a filter in place, this is a request to change or clear the filter, so we have to
@@ -319,7 +319,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
if (coords == null) {
return;
}
- final ArrayList<Geocache> oldList = new ArrayList<Geocache>(list);
+ final ArrayList<Geocache> oldList = new ArrayList<>(list);
Collections.sort(list, getPotentialInversion(new DistanceComparator(coords, list)));
// avoid an update if the list has not changed due to location update
@@ -547,7 +547,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
public TouchListener(final Geocache cache, final @NonNull CacheListAdapter adapter) {
this.cache = cache;
gestureDetector = new GestureDetector(adapter.getContext(), new FlingGesture(cache, adapter));
- adapterRef = new WeakReference<CacheListAdapter>(adapter);
+ adapterRef = new WeakReference<>(adapter);
}
// Tap on item
@@ -588,7 +588,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
public FlingGesture(final Geocache cache, final @NonNull CacheListAdapter adapter) {
this.cache = cache;
- adapterRef = new WeakReference<CacheListAdapter>(adapter);
+ adapterRef = new WeakReference<>(adapter);
}
@Override
@@ -631,7 +631,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
}
public List<Geocache> getCheckedCaches() {
- final ArrayList<Geocache> result = new ArrayList<Geocache>();
+ final ArrayList<Geocache> result = new ArrayList<>();
for (final Geocache cache : list) {
if (cache.isStatusChecked()) {
result.add(cache);
@@ -645,7 +645,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
if (!result.isEmpty()) {
return result;
}
- return new ArrayList<Geocache>(list);
+ return new ArrayList<>(list);
}
public int getCheckedOrAllCount() {
diff --git a/main/src/cgeo/geocaching/ui/CompassView.java b/main/src/cgeo/geocaching/ui/CompassView.java
index b503d6c..240afcf 100644
--- a/main/src/cgeo/geocaching/ui/CompassView.java
+++ b/main/src/cgeo/geocaching/ui/CompassView.java
@@ -62,7 +62,7 @@ public class CompassView extends View {
private final WeakReference<CompassView> compassViewRef;
private UpdateAction(final CompassView view) {
- this.compassViewRef = new WeakReference<CompassView>(view);
+ this.compassViewRef = new WeakReference<>(view);
}
@Override
diff --git a/main/src/cgeo/geocaching/ui/Formatter.java b/main/src/cgeo/geocaching/ui/Formatter.java
index 9242b9a..4720e31 100644
--- a/main/src/cgeo/geocaching/ui/Formatter.java
+++ b/main/src/cgeo/geocaching/ui/Formatter.java
@@ -121,7 +121,7 @@ public abstract class Formatter {
}
public static String formatCacheInfoLong(Geocache cache, CacheListType cacheListType) {
- final ArrayList<String> infos = new ArrayList<String>();
+ final ArrayList<String> infos = new ArrayList<>();
if (StringUtils.isNotBlank(cache.getGeocode())) {
infos.add(cache.getGeocode());
}
@@ -138,7 +138,7 @@ public abstract class Formatter {
}
public static String formatCacheInfoShort(Geocache cache) {
- final ArrayList<String> infos = new ArrayList<String>();
+ final ArrayList<String> infos = new ArrayList<>();
addShortInfos(cache, infos);
return StringUtils.join(infos, Formatter.SEPARATOR);
}
@@ -163,7 +163,7 @@ public abstract class Formatter {
}
public static String formatCacheInfoHistory(Geocache cache) {
- final ArrayList<String> infos = new ArrayList<String>(3);
+ final ArrayList<String> infos = new ArrayList<>(3);
infos.add(StringUtils.upperCase(cache.getGeocode()));
infos.add(Formatter.formatDate(cache.getVisitedDate()));
infos.add(Formatter.formatTime(cache.getVisitedDate()));
@@ -171,7 +171,7 @@ public abstract class Formatter {
}
public static String formatWaypointInfo(Waypoint waypoint) {
- final List<String> infos = new ArrayList<String>(3);
+ final List<String> infos = new ArrayList<>(3);
WaypointType waypointType = waypoint.getWaypointType();
if (waypointType != WaypointType.OWN && waypointType != null) {
infos.add(waypointType.getL10n());
diff --git a/main/src/cgeo/geocaching/ui/ImagesList.java b/main/src/cgeo/geocaching/ui/ImagesList.java
index fbf6f8b..8bd4ac2 100644
--- a/main/src/cgeo/geocaching/ui/ImagesList.java
+++ b/main/src/cgeo/geocaching/ui/ImagesList.java
@@ -68,11 +68,11 @@ public class ImagesList {
private LayoutInflater inflater = null;
private final Activity activity;
// We could use a Set here, but we will insert no duplicates, so there is no need to check for uniqueness.
- private final Collection<Bitmap> bitmaps = new LinkedList<Bitmap>();
+ private final Collection<Bitmap> bitmaps = new LinkedList<>();
/**
* map image view id to image
*/
- private final SparseArray<Image> images = new SparseArray<Image>();
+ private final SparseArray<Image> images = new SparseArray<>();
private final String geocode;
private LinearLayout imagesView;
diff --git a/main/src/cgeo/geocaching/ui/LoggingUI.java b/main/src/cgeo/geocaching/ui/LoggingUI.java
index d5c5fae..8454474 100644
--- a/main/src/cgeo/geocaching/ui/LoggingUI.java
+++ b/main/src/cgeo/geocaching/ui/LoggingUI.java
@@ -78,7 +78,7 @@ public class LoggingUI extends AbstractUIFactory {
final LogType currentLogType = currentLog == null ? null : currentLog.type;
final List<LogType> logTypes = cache.getPossibleLogTypes();
- final ArrayList<LogTypeEntry> list = new ArrayList<LogTypeEntry>();
+ final ArrayList<LogTypeEntry> list = new ArrayList<>();
for (LogType logType : logTypes) {
list.add(new LogTypeEntry(logType, null, logType == currentLogType));
}
@@ -90,7 +90,7 @@ public class LoggingUI extends AbstractUIFactory {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.cache_menu_visit_offline);
- final ArrayAdapter<LogTypeEntry> adapter = new ArrayAdapter<LogTypeEntry>(activity, android.R.layout.select_dialog_item, list);
+ final ArrayAdapter<LogTypeEntry> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, list);
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
@Override
diff --git a/main/src/cgeo/geocaching/ui/WeakReferenceHandler.java b/main/src/cgeo/geocaching/ui/WeakReferenceHandler.java
index 4724466..d51e697 100644
--- a/main/src/cgeo/geocaching/ui/WeakReferenceHandler.java
+++ b/main/src/cgeo/geocaching/ui/WeakReferenceHandler.java
@@ -18,7 +18,7 @@ public abstract class WeakReferenceHandler<ActivityType extends Activity> extend
private final WeakReference<ActivityType> activityRef;
protected WeakReferenceHandler(final ActivityType activity) {
- this.activityRef = new WeakReference<ActivityType>(activity);
+ this.activityRef = new WeakReference<>(activity);
}
protected ActivityType getActivity() {
diff --git a/main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java b/main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java
index 6311476..38a219e 100644
--- a/main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java
+++ b/main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java
@@ -53,7 +53,7 @@ public class CacheLogsViewCreator extends LogsViewCreator {
// adds the log counts
final Map<LogType, Integer> logCounts = getCache().getLogCounts();
if (logCounts != null) {
- final List<Entry<LogType, Integer>> sortedLogCounts = new ArrayList<Entry<LogType, Integer>>(logCounts.size());
+ final List<Entry<LogType, Integer>> sortedLogCounts = new ArrayList<>(logCounts.size());
for (final Entry<LogType, Integer> entry : logCounts.entrySet()) {
// it may happen that the label is unknown -> then avoid any output for this type
if (entry.getKey() != LogType.PUBLISH_LISTING && entry.getKey().getL10n() != null) {
@@ -71,7 +71,7 @@ public class CacheLogsViewCreator extends LogsViewCreator {
}
});
- final ArrayList<String> labels = new ArrayList<String>(sortedLogCounts.size());
+ final ArrayList<String> labels = new ArrayList<>(sortedLogCounts.size());
for (final Entry<LogType, Integer> pair : sortedLogCounts) {
labels.add(pair.getValue() + "× " + pair.getKey().getL10n());
}
diff --git a/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java b/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java
index 1f6706c..020b895 100644
--- a/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java
+++ b/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java
@@ -1,6 +1,5 @@
package cgeo.geocaching.ui.logs;
-import cgeo.geocaching.Image;
import cgeo.geocaching.ImagesActivity;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.R;
@@ -110,7 +109,7 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre
holder.images.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
- ImagesActivity.startActivityLogImages(activity, getGeocode(), new ArrayList<Image>(log.getLogImages()));
+ ImagesActivity.startActivityLogImages(activity, getGeocode(), new ArrayList<>(log.getLogImages()));
}
});
} else {
diff --git a/main/src/cgeo/geocaching/utils/HtmlUtils.java b/main/src/cgeo/geocaching/utils/HtmlUtils.java
index 37e20ec..51c4d6e 100644
--- a/main/src/cgeo/geocaching/utils/HtmlUtils.java
+++ b/main/src/cgeo/geocaching/utils/HtmlUtils.java
@@ -34,7 +34,7 @@ public final class HtmlUtils {
if (html instanceof Spanned) {
Spanned text = (Spanned) html;
Object[] styles = text.getSpans(0, text.length(), Object.class);
- ArrayList<Pair<Integer, Integer>> removals = new ArrayList<Pair<Integer, Integer>>();
+ ArrayList<Pair<Integer, Integer>> removals = new ArrayList<>();
for (Object style : styles) {
if (style instanceof ImageSpan) {
int start = text.getSpanStart(style);
diff --git a/main/src/cgeo/geocaching/utils/LazyInitializedList.java b/main/src/cgeo/geocaching/utils/LazyInitializedList.java
index dedc96e..b0e2e46 100644
--- a/main/src/cgeo/geocaching/utils/LazyInitializedList.java
+++ b/main/src/cgeo/geocaching/utils/LazyInitializedList.java
@@ -65,7 +65,7 @@ public abstract class LazyInitializedList<ElementType> extends AbstractList<Elem
@Override
public void clear() {
- list = new ArrayList<ElementType>();
+ list = new ArrayList<>();
}
}
diff --git a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java
index 259e94a..a69f427 100644
--- a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java
+++ b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java
@@ -31,11 +31,11 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E>
public LeastRecentlyUsedSet(int maxEntries, int initialCapacity, float loadFactor) {
// because we don't use any Map.get() methods from the Set, BOUNDED and LRU_CACHE have the exact same Behaviour
// So we use LRU_CACHE mode because it should perform a bit better (as it doesn't re-add explicitly)
- map = new LeastRecentlyUsedMap.LruCache<E, Object>(maxEntries, initialCapacity, loadFactor);
+ map = new LeastRecentlyUsedMap.LruCache<>(maxEntries, initialCapacity, loadFactor);
}
public LeastRecentlyUsedSet(int maxEntries) {
- map = new LeastRecentlyUsedMap.LruCache<E, Object>(maxEntries);
+ map = new LeastRecentlyUsedMap.LruCache<>(maxEntries);
}
/**
@@ -157,7 +157,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E>
* @return List based clone of the set
*/
public synchronized List<E> getAsList() {
- return new ArrayList<E>(this);
+ return new ArrayList<>(this);
}
/**
@@ -200,7 +200,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E>
final float loadFactor = s.readFloat();
final int maxEntries = s.readInt();
- map = new LeastRecentlyUsedMap.LruCache<E, Object>(maxEntries, capacity, loadFactor);
+ map = new LeastRecentlyUsedMap.LruCache<>(maxEntries, capacity, loadFactor);
// Read in size
final int size = s.readInt();
diff --git a/main/src/cgeo/geocaching/utils/LogTemplateProvider.java b/main/src/cgeo/geocaching/utils/LogTemplateProvider.java
index 3507116..8867609 100644
--- a/main/src/cgeo/geocaching/utils/LogTemplateProvider.java
+++ b/main/src/cgeo/geocaching/utils/LogTemplateProvider.java
@@ -108,7 +108,7 @@ public final class LogTemplateProvider {
* @return all templates, but not the signature template itself
*/
public static ArrayList<LogTemplate> getTemplatesWithoutSignature() {
- final ArrayList<LogTemplate> templates = new ArrayList<LogTemplateProvider.LogTemplate>();
+ final ArrayList<LogTemplate> templates = new ArrayList<>();
templates.add(new LogTemplate("DATE", R.string.init_signature_template_date) {
@Override
diff --git a/main/src/cgeo/geocaching/utils/SimpleCancellableHandler.java b/main/src/cgeo/geocaching/utils/SimpleCancellableHandler.java
index 22cd4d7..eee71ba 100644
--- a/main/src/cgeo/geocaching/utils/SimpleCancellableHandler.java
+++ b/main/src/cgeo/geocaching/utils/SimpleCancellableHandler.java
@@ -15,8 +15,8 @@ public class SimpleCancellableHandler extends CancellableHandler {
protected final WeakReference<Progress> progressDialogRef;
public SimpleCancellableHandler(final AbstractActivity activity, final Progress progress) {
- this.activityRef = new WeakReference<AbstractActivity>(activity);
- this.progressDialogRef = new WeakReference<Progress>(progress);
+ this.activityRef = new WeakReference<>(activity);
+ this.progressDialogRef = new WeakReference<>(progress);
}
@Override
diff --git a/main/src/cgeo/geocaching/utils/SimpleHandler.java b/main/src/cgeo/geocaching/utils/SimpleHandler.java
index 8e0a479..7c5ac43 100644
--- a/main/src/cgeo/geocaching/utils/SimpleHandler.java
+++ b/main/src/cgeo/geocaching/utils/SimpleHandler.java
@@ -14,8 +14,8 @@ public abstract class SimpleHandler extends Handler {
protected final WeakReference<Progress> progressDialogRef;
public SimpleHandler(final AbstractActivity activity, final Progress progress) {
- activityRef = new WeakReference<AbstractActivity>(activity);
- progressDialogRef = new WeakReference<Progress>(progress);
+ activityRef = new WeakReference<>(activity);
+ progressDialogRef = new WeakReference<>(progress);
}
@Override
diff --git a/tests/.settings/org.eclipse.jdt.core.prefs b/tests/.settings/org.eclipse.jdt.core.prefs
index fd37b9b..e9dd68c 100644
--- a/tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/.settings/org.eclipse.jdt.core.prefs
@@ -6,9 +6,10 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -96,7 +97,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0