From 0f6b1897b7b9c2c3e056ee766598acceeae655bd Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 28 Mar 2020 13:34:39 -0700 Subject: [PATCH] remove unnecessary types from generics constructors --- .../org/eehouse/android/xw4/BiDiSockWrap.java | 2 +- .../org/eehouse/android/xw4/BoardCanvas.java | 24 --------- .../eehouse/android/xw4/BoardContainer.java | 2 +- .../eehouse/android/xw4/CommsTransport.java | 2 +- .../org/eehouse/android/xw4/DBHelper.java | 4 +- .../java/org/eehouse/android/xw4/DBUtils.java | 30 +++++------ .../org/eehouse/android/xw4/DbgUtils.java | 2 +- .../org/eehouse/android/xw4/DelegateBase.java | 4 +- .../eehouse/android/xw4/DictLangCache.java | 13 +++-- .../android/xw4/DictListPreference.java | 4 +- .../org/eehouse/android/xw4/DictUtils.java | 2 +- .../eehouse/android/xw4/DictsDelegate.java | 35 ++++++------- .../eehouse/android/xw4/DwnldDelegate.java | 8 +-- .../eehouse/android/xw4/ExpiringDelegate.java | 6 +-- .../org/eehouse/android/xw4/GameListItem.java | 4 +- .../org/eehouse/android/xw4/GameUtils.java | 2 +- .../android/xw4/GamesListDelegate.java | 32 ++++++------ .../android/xw4/InviteChoicesAlert.java | 5 +- .../eehouse/android/xw4/LookupAlertView.java | 11 ++-- .../org/eehouse/android/xw4/MainActivity.java | 4 +- .../android/xw4/MountEventReceiver.java | 2 +- .../org/eehouse/android/xw4/MultiMsgSink.java | 2 +- .../org/eehouse/android/xw4/NBSProto.java | 2 +- .../eehouse/android/xw4/NagTurnReceiver.java | 4 +- .../eehouse/android/xw4/NetStateCache.java | 2 +- .../org/eehouse/android/xw4/NetUtils.java | 4 +- .../eehouse/android/xw4/PrefsDelegate.java | 2 +- .../eehouse/android/xw4/RefreshNamesTask.java | 8 +-- .../android/xw4/RelayInviteDelegate.java | 6 +-- .../org/eehouse/android/xw4/RelayService.java | 11 ++-- .../android/xw4/SMSInviteDelegate.java | 2 +- .../android/xw4/StudyListDelegate.java | 2 +- .../org/eehouse/android/xw4/TilePickView.java | 6 +-- .../java/org/eehouse/android/xw4/Toolbar.java | 2 +- .../java/org/eehouse/android/xw4/Utils.java | 3 +- .../org/eehouse/android/xw4/WiDirService.java | 18 +++---- .../eehouse/android/xw4/XWDialogFragment.java | 2 +- .../eehouse/android/xw4/XWExpListAdapter.java | 2 +- .../org/eehouse/android/xw4/XWFragment.java | 2 +- .../eehouse/android/xw4/jni/CommsAddrRec.java | 2 +- .../eehouse/android/xw4/jni/CurGameInfo.java | 2 +- .../eehouse/android/xw4/jni/JNIThread.java | 2 +- .../eehouse/android/xw4/jni/JNIUtilsImpl.java | 4 +- .../org/eehouse/android/xw4/loc/LocIDs.java | 2 +- .../android/xw4/loc/LocItemEditDelegate.java | 2 +- .../eehouse/android/xw4/loc/LocSearcher.java | 4 +- .../org/eehouse/android/xw4/loc/LocUtils.java | 16 +++--- .../src/main/res/layout/game_list_item.xml | 4 +- .../app/src/main/res/layout/pause_view.xml | 52 +++++++++---------- 49 files changed, 167 insertions(+), 201 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BiDiSockWrap.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BiDiSockWrap.java index 3418072fe..5ddc98b45 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BiDiSockWrap.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BiDiSockWrap.java @@ -125,7 +125,7 @@ public class BiDiSockWrap { private void init( Socket socket ) { mSocket = socket; - mQueue = new LinkedBlockingQueue(); + mQueue = new LinkedBlockingQueue<>(); startThreads(); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java index b62d2b74e..b78ca6ee5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardCanvas.java @@ -335,30 +335,6 @@ public class BoardCanvas extends Canvas implements DrawCtx { } @Override - // public void drawTimer( Rect rect, int player, int secondsLeft, - // boolean turnDone ) - // { - // if ( m_lastSecsLeft != secondsLeft - // || m_lastTimerPlayer != player - // || m_lastTimerTurnDone != turnDone ) { - // if ( null != m_activity && null != m_jniThread ) { - // Rect rectCopy = new Rect(rect); - // m_lastSecsLeft = secondsLeft; - // m_lastTimerPlayer = player; - // m_lastTimerTurnDone = turnDone; - - // String negSign = secondsLeft < 0? "-" : ""; - // secondsLeft = Math.abs( secondsLeft ); - // String time = String.format( "%s%d:%02d", negSign, - // secondsLeft/60, secondsLeft%60 ); - - // fillRectOther( rectCopy, CommonPrefs.COLOR_BACKGRND ); - - // int color = m_playerColors[player]; - // if ( turnDone ) { - // color &= NOT_TURN_ALPHA; - // } - // m_fillPaint.setColor( color ); public void drawTimer( Rect rect, final int player, int secondsLeft, final boolean turnDone ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardContainer.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardContainer.java index 14bc4c4bd..181940253 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardContainer.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardContainer.java @@ -57,7 +57,7 @@ public class BoardContainer extends ViewGroup { public static void registerSizeChangeListener(SizeChangeListener scl) { - s_scl = new WeakReference(scl); + s_scl = new WeakReference<>(scl); callSCL(); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/CommsTransport.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/CommsTransport.java index 7d00c488f..260059c8a 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/CommsTransport.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/CommsTransport.java @@ -69,7 +69,7 @@ public class CommsTransport implements TransportProcs, m_context = context; m_tpHandler = handler; m_rowid = rowid; - m_buffersOut = new Vector(); + m_buffersOut = new Vector<>(); m_bytesIn = ByteBuffer.allocate( 2048 ); NetStateCache.register( context, this ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java index 9e81a6113..597d329b1 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java @@ -497,7 +497,7 @@ public class DBHelper extends SQLiteOpenHelper { if ( null != columnNames ) { ArrayList oldCols = - new ArrayList( Arrays.asList( columnNames ) ); + new ArrayList<>( Arrays.asList( columnNames ) ); // Make a list of columns in the new DB, using it to // remove from the old list any that aren't in the @@ -507,7 +507,7 @@ public class DBHelper extends SQLiteOpenHelper { // the newly-created table doesn't work, perhaps // because we're in a transaction and nothing's been // committed. - ArrayList newCols = new ArrayList(); + ArrayList newCols = new ArrayList<>(); for ( int ii = 0; ii < data.length; ++ii ) { newCols.add( data[ii][0] ); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java index 4d6c1cb56..3537c97b8 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java @@ -89,13 +89,13 @@ public class DBUtils { GameChangeType change ); } private static HashSet s_listeners = - new HashSet(); + new HashSet<>(); public static interface StudyListListener { void onWordAdded( String word, int langCode ); } private static Set s_slListeners - = new HashSet(); + = new HashSet<>(); private static SQLiteOpenHelper s_dbHelper = null; private static SQLiteDatabase s_db = null; @@ -500,9 +500,9 @@ public class DBUtils { private SentInvitesInfo( long rowID ) { m_rowid = rowID; - m_means = new ArrayList(); - m_targets = new ArrayList(); - m_timestamps = new ArrayList(); + m_means = new ArrayList<>(); + m_targets = new ArrayList<>(); + m_timestamps = new ArrayList<>(); } private void addEntry( InviteMeans means, String target, Date ts ) @@ -543,7 +543,7 @@ public class DBUtils { InviteMeans means = m_means.get(ii); Set devs; if ( ! hashes.containsKey( means ) ) { - devs = new HashSet(); + devs = new HashSet<>(); hashes.put( means, devs ); } devs = hashes.get( means ); @@ -770,7 +770,7 @@ public class DBUtils { public static HashMap getGamesWithSendsPending( Context context ) { - HashMap result = new HashMap(); + HashMap result = new HashMap<>(); String[] columns = { ROW_ID, DBHelper.CONTYPE }; String selection = String.format( "%s > 0 AND %s != %d", DBHelper.NPACKETSPENDING, DBHelper.GROUPID, getArchiveGroup( context ) ); @@ -892,7 +892,7 @@ public class DBUtils { for ( String dev : TextUtils.split( devs, "\n" ) ) { set = map.get( dev ); if ( null == set ) { - set = new HashSet(); + set = new HashSet<>(); map.put( dev, set ); } set.add( new Integer(gameID) ); @@ -943,7 +943,7 @@ public class DBUtils { String[] result = null; String[] columns = { ROW_ID, DBHelper.RELAYID }; String selection = DBHelper.RELAYID + " NOT null"; - ArrayList ids = new ArrayList(); + ArrayList ids = new ArrayList<>(); initDB( context ); synchronized( s_dbHelper ) { @@ -1000,7 +1000,7 @@ public class DBUtils { public static Obit[] listObits( Context context ) { Obit[] result = null; - ArrayList al = new ArrayList(); + ArrayList al = new ArrayList<>(); String[] columns = { DBHelper.RELAYID, DBHelper.SEED }; initDB( context ); @@ -1214,8 +1214,8 @@ public class DBUtils { if ( null != oldHistory ) { Log.d( TAG, "convertChatString(): got string: %s", oldHistory ); - ArrayList valuess = new ArrayList(); - ArrayList pairs = new ArrayList(); + ArrayList valuess = new ArrayList<>(); + ArrayList pairs = new ArrayList<>(); String localPrefix = LocUtils.getString( context, R.string.chat_local_id ); String rmtPrefix = LocUtils.getString( context, R.string.chat_other_id ); Log.d( TAG, "convertChatString(): prefixes: \"%s\" and \"%s\"", localPrefix, rmtPrefix ); @@ -1477,7 +1477,7 @@ public class DBUtils { private static HashMap getGameCounts( SQLiteDatabase db ) { - HashMap result = new HashMap(); + HashMap result = new HashMap<>(); String query = "SELECT %s, count(%s) as cnt FROM %s GROUP BY %s"; query = String.format( query, DBHelper.GROUPID, DBHelper.GROUPID, DBHelper.TABLE_NAMES.SUM, DBHelper.GROUPID ); @@ -2298,8 +2298,8 @@ public class DBUtils { // caller cast. public static Object[] getXlations( Context context, String locale ) { - HashMap local = new HashMap(); - HashMap blessed = new HashMap(); + HashMap local = new HashMap<>(); + HashMap blessed = new HashMap<>(); String selection = String.format( "%s = '%s'", DBHelper.LOCALE, locale ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java index e7f107ca5..502cd1c86 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java @@ -101,7 +101,7 @@ public class DbgUtils { static String extrasToString( Bundle extras ) { - ArrayList al = new ArrayList(); + ArrayList al = new ArrayList<>(); if ( null != extras ) { for ( String key : extras.keySet() ) { al.add( key + ":" + extras.get(key) ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java index 145e8f390..cc7f6106c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java @@ -76,7 +76,7 @@ public class DelegateBase implements DlgClickNotify, private boolean m_finishCalled; private View m_rootView; private boolean m_isVisible; - private ArrayList m_visibleProcs = new ArrayList(); + private ArrayList m_visibleProcs = new ArrayList<>(); private static Map> s_instances = new HashMap>(); @@ -146,7 +146,7 @@ public class DelegateBase implements DlgClickNotify, if ( s_instances.containsKey( clazz ) ) { Log.d( TAG, "onStart(): replacing curThis" ); } - s_instances.put( clazz, new WeakReference(this) ); + s_instances.put( clazz, new WeakReference<>(this) ); } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictLangCache.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictLangCache.java index 9c6995154..94710aca3 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictLangCache.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictLangCache.java @@ -66,7 +66,7 @@ public class DictLangCache { public void rebuild() { - m_map = new HashMap(); + m_map = new HashMap<>(); DictAndLoc[] dals = DictUtils.dictList( m_context ); for ( DictAndLoc dal : dals ) { String lang = getLangName( m_context, dal.name ); @@ -175,7 +175,7 @@ public class DictLangCache { private static DictInfo[] getInfosHaveLang( Context context, int code ) { - ArrayList al = new ArrayList(); + ArrayList al = new ArrayList<>(); DictAndLoc[] dals = DictUtils.dictList( context ); for ( DictAndLoc dal : dals ) { DictInfo info = getInfo( context, dal ); @@ -221,7 +221,7 @@ public class DictLangCache { Arrays.sort( infos, comp ); } - ArrayList al = new ArrayList(); + ArrayList al = new ArrayList<>(); String fmt = "%s (%d)"; // must match stripCount below for ( DictInfo info : infos ) { String name = info.name; @@ -244,7 +244,7 @@ public class DictLangCache { public static DictAndLoc[] getDALsHaveLang( Context context, int code ) { - ArrayList al = new ArrayList(); + ArrayList al = new ArrayList<>(); DictAndLoc[] dals = DictUtils.dictList( context ); for ( DictAndLoc dal : dals ) { DictInfo info = getInfo( context, dal ); @@ -356,7 +356,7 @@ public class DictLangCache { public static String[] listLangs( Context context, DictAndLoc[] dals ) { - Set langs = new HashSet(); + Set langs = new HashSet<>(); for ( DictAndLoc dal : dals ) { String name = getLangName( context, dal.name ); if ( null == name || 0 == name.length() ) { @@ -422,8 +422,7 @@ public class DictLangCache { { if ( lang != s_adaptedLang ) { s_dictsAdapter = - new ArrayAdapter( context, - android.R.layout.simple_spinner_item ); + new ArrayAdapter<>(context, android.R.layout.simple_spinner_item); rebuildAdapter( s_dictsAdapter, getHaveLang( context, lang ) ); s_adaptedLang = lang; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictListPreference.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictListPreference.java index 940c3a5b9..6534b72d0 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictListPreference.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictListPreference.java @@ -47,8 +47,8 @@ public class DictListPreference extends XWListPreference { int langCode = DictLangCache.getLangLangCode( context, curLang ); DictUtils.DictAndLoc[] dals = DictUtils.dictList( context ); - ArrayList dictEntries = new ArrayList(); - ArrayList values = new ArrayList(); + ArrayList dictEntries = new ArrayList<>(); + ArrayList values = new ArrayList<>(); for ( int ii = 0; ii < dals.length; ++ii ) { String name = dals[ii].name; if ( langCode == DictLangCache.getDictLangCode( context, name ) ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java index c4673ba87..5f6bc27bd 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictUtils.java @@ -452,7 +452,7 @@ public class DictUtils { byte[][] dictBytes = new byte[names.length][]; String[] dictPaths = new String[names.length]; - HashMap seen = new HashMap(); + HashMap seen = new HashMap<>(); for ( int ii = 0; ii < names.length; ++ii ) { byte[] bytes = null; String path = null; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java index 766a39095..caee91ed3 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictsDelegate.java @@ -102,7 +102,7 @@ public class DictsDelegate extends ListDelegateBase private String[] m_locNames; private String m_finishOnName; private Map m_selViews; - private Map m_selDicts = new HashMap(); + private Map m_selDicts = new HashMap<>(); private String m_origTitle; private boolean m_showRemote = false; private String m_filterLang; @@ -123,7 +123,7 @@ public class DictsDelegate extends ListDelegateBase String curDict, int lang ) { final HashMap itemData - = new HashMap(); + = new HashMap<>(); MenuItem.OnMenuItemClickListener listener = new MenuItem.OnMenuItemClickListener() { @@ -207,7 +207,7 @@ public class DictsDelegate extends ListDelegateBase @Override public Object[] makeListData() { - ArrayList alist = new ArrayList(); + ArrayList alist = new ArrayList<>(); int nLangs = m_langs.length; for ( int ii = 0; ii < nLangs; ++ii ) { String langName = m_langs[ii]; @@ -317,9 +317,9 @@ public class DictsDelegate extends ListDelegateBase private ArrayList makeLangItems( String langName ) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); - HashSet locals = new HashSet(); + HashSet locals = new HashSet<>(); int lang = DictLangCache.getLangLangCode( m_context, langName ); DictAndLoc[] dals = DictLangCache.getDALsHaveLang( m_context, lang ); if ( null != dals ) { @@ -470,13 +470,13 @@ public class DictsDelegate extends ListDelegateBase protected void init( Bundle savedInstanceState ) { m_onServerStr = getString( R.string.dict_on_server ); - m_closedLangs = new HashSet(); + m_closedLangs = new HashSet<>(); String[] closed = XWPrefs.getClosedLangs( m_activity ); if ( null != closed ) { m_closedLangs.addAll( Arrays.asList( closed ) ); } - m_expandedItems = new HashSet(); + m_expandedItems = new HashSet<>(); m_locNames = getStringArray( R.array.loc_names ); m_noteNone = getString( R.string.note_none ); @@ -829,7 +829,7 @@ public class DictsDelegate extends ListDelegateBase class LangDelData { public LangDelData( int langCode ) { - delDicts = new HashSet(); + delDicts = new HashSet<>(); langName = DictLangCache.getLangName( m_activity, langCode ); nDicts = DictLangCache.getDALsHaveLang( m_activity, langCode ).length; } @@ -847,8 +847,8 @@ public class DictsDelegate extends ListDelegateBase int nDicts; } - Map dels = new HashMap(); - Set skipLangs = new HashSet(); + Map dels = new HashMap<>(); + Set skipLangs = new HashSet<>(); for ( String dict : m_selDicts.keySet() ) { int langCode = DictLangCache.getDictLangCode( m_activity, dict ); if ( skipLangs.contains( langCode ) ) { @@ -963,7 +963,7 @@ public class DictsDelegate extends ListDelegateBase private void resetLangs() { - Set langs = new HashSet(); + Set langs = new HashSet<>(); langs.addAll( Arrays.asList(DictLangCache.listLangs( m_activity )) ); if ( m_showRemote && null != m_remoteInfo ) { langs.addAll( m_remoteInfo.keySet() ); @@ -978,7 +978,7 @@ public class DictsDelegate extends ListDelegateBase m_adapter = new DictListAdapter( m_activity ); setListAdapterKeepScroll( m_adapter ); - m_selViews = new HashMap(); + m_selViews = new HashMap<>(); } private void saveClosed() @@ -1370,11 +1370,11 @@ public class DictsDelegate extends ListDelegateBase boolean success = false; JSONArray langs = null; - m_needUpdates = new HashMap(); + m_needUpdates = new HashMap<>(); if ( null != jsonData ) { - Set closedLangs = new HashSet(); + Set closedLangs = new HashSet<>(); final Set curLangs = - new HashSet( Arrays.asList( m_langs ) ); + new HashSet<>( Arrays.asList( m_langs ) ); // DictLangCache hits the DB hundreds of times below. Fix! Log.w( TAG, "Fix me I'm stupid" ); @@ -1384,7 +1384,7 @@ public class DictsDelegate extends ListDelegateBase langs = obj.optJSONArray( "langs" ); int nLangs = langs.length(); - m_remoteInfo = new HashMap(); + m_remoteInfo = new HashMap<>(); for ( int ii = 0; !isCancelled() && ii < nLangs; ++ii ) { JSONObject langObj = langs.getJSONObject( ii ); String langName = langObj.getString( "lang" ); @@ -1400,8 +1400,7 @@ public class DictsDelegate extends ListDelegateBase JSONArray dicts = langObj.getJSONArray( "dicts" ); int nDicts = dicts.length(); - ArrayList dictNames = - new ArrayList(); + ArrayList dictNames = new ArrayList<>(); for ( int jj = 0; !isCancelled() && jj < nDicts; ++jj ) { JSONObject dict = dicts.getJSONObject( jj ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DwnldDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DwnldDelegate.java index 5b1aa4ec5..b17cc33e5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DwnldDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DwnldDelegate.java @@ -88,7 +88,7 @@ public class DwnldDelegate extends ListDelegateBase { public DownloadFinishedListener m_lstnr; } private static Map s_listeners = - new HashMap(); + new HashMap<>(); private class DownloadFilesTask extends AsyncTask implements DictUtils.DownProgListener { @@ -249,7 +249,7 @@ public class DwnldDelegate extends ListDelegateBase { @Override protected void init( Bundle savedInstanceState ) { - m_dfts = new ArrayList(); + m_dfts = new ArrayList<>(); DownloadFilesTask dft = null; Uri[] uris = null; LinearLayout item = null; @@ -269,7 +269,7 @@ public class DwnldDelegate extends ListDelegateBase { } } if ( null != uris ) { - m_views = new ArrayList(); + m_views = new ArrayList<>(); for ( int ii = 0; ii < uris.length; ++ii ) { item = (LinearLayout)inflate( R.layout.import_dict_item ); m_dfts.add( new DownloadFilesTask( uris[ii], item, isApp )); @@ -287,7 +287,7 @@ public class DwnldDelegate extends ListDelegateBase { if ( null != dft ) { Assert.assertTrue( 0 == m_dfts.size() ); m_dfts.add( dft ); - m_views = new ArrayList( 1 ); + m_views = new ArrayList<>( 1 ); m_views.add( item ); dft = null; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ExpiringDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ExpiringDelegate.java index f7a16ef65..92ffaa113 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ExpiringDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ExpiringDelegate.java @@ -69,11 +69,11 @@ public class ExpiringDelegate { private Handler m_handler; private ArrayList> m_refs = new ArrayList>(); - private Set m_hashes = new HashSet(); + private Set m_hashes = new HashSet<>(); public void run() { int sizeBefore; - ArrayList dlgts = new ArrayList(); + ArrayList dlgts = new ArrayList<>(); synchronized( this ) { sizeBefore = m_refs.size(); m_hashes.clear(); @@ -111,7 +111,7 @@ public class ExpiringDelegate { synchronized( this ) { if ( ! m_hashes.contains( hash ) ) { m_hashes.add( hash ); - m_refs.add( new WeakReference(self) ); + m_refs.add( new WeakReference<>(self) ); } } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameListItem.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameListItem.java index 94594f1b0..c28a682f7 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameListItem.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameListItem.java @@ -48,7 +48,7 @@ public class GameListItem extends LinearLayout private static final int SUMMARY_WAIT_MSECS = 1000; - private static HashSet s_invalRows = new HashSet(); + private static HashSet s_invalRows = new HashSet<>(); private Activity m_activity; private Context m_context; @@ -455,7 +455,7 @@ public class GameListItem extends LinearLayout GameListItem m_item; } private static LinkedBlockingQueue s_queue - = new LinkedBlockingQueue(); + = new LinkedBlockingQueue<>(); private static Thread s_thumbThread; private static void enqueueGetThumbnail( GameListItem item, long rowid ) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java index 82a99578c..d59f698e7 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java @@ -883,7 +883,7 @@ public class GameUtils { HashSet missingSet; DictUtils.DictAndLoc[] installed = DictUtils.dictList( context ); - missingSet = new HashSet( Arrays.asList( gameDicts ) ); + missingSet = new HashSet<>( Arrays.asList( gameDicts ) ); missingSet.remove( null ); boolean allHere = 0 != missingSet.size(); // need some non-null! if ( allHere ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java index 7ffd74c3c..25f264353 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java @@ -144,7 +144,7 @@ public class GamesListDelegate extends ListDelegateBase protected Object[] makeListData() { final Map gameInfo = DBUtils.getGroups( m_activity ); - ArrayList alist = new ArrayList(); + ArrayList alist = new ArrayList<>(); long[] positions = getGroupPositions(); for ( int ii = 0; ii < positions.length; ++ii ) { long groupID = positions[ii]; @@ -425,7 +425,7 @@ public class GamesListDelegate extends ListDelegateBase private List makeChildren( long groupID ) { long[] rows = DBUtils.getGroupGames( m_activity, groupID ); - List alist = new ArrayList( rows.length ); + List alist = new ArrayList<>( rows.length ); for ( long row : rows ) { alist.add( new GameRec( row ) ); } @@ -457,7 +457,7 @@ public class GamesListDelegate extends ListDelegateBase int start, int len ) { Log.d( TAG, "removeRange(start=%d, len=%d)", start, len ); - ArrayList result = new ArrayList(len); + ArrayList result = new ArrayList<>(len); for ( int ii = 0; ii < len; ++ii ) { result.add( list.remove( start ) ); } @@ -466,7 +466,7 @@ public class GamesListDelegate extends ListDelegateBase private Set getGroupWithID( long groupID ) { - Set groupIDs = new HashSet(); + Set groupIDs = new HashSet<>(); groupIDs.add( groupID ); Set result = getGroupsWithIDs( groupIDs ); return result; @@ -477,7 +477,7 @@ public class GamesListDelegate extends ListDelegateBase // get to page out when they scroll offscreen. private Set getGroupsWithIDs( Set groupIDs ) { - Set result = new HashSet(); + Set result = new HashSet<>(); ListView listView = getListView(); int count = listView.getChildCount(); for ( int ii = 0; ii < count; ++ii ) { @@ -494,14 +494,14 @@ public class GamesListDelegate extends ListDelegateBase private Set getGamesFromElems( long rowID ) { - HashSet rowSet = new HashSet(); + HashSet rowSet = new HashSet<>(); rowSet.add( rowID ); return getGamesFromElems( rowSet ); } private Set getGamesFromElems( Set rowIDs ) { - Set result = new HashSet(); + Set result = new HashSet<>(); ListView listView = getListView(); int count = listView.getChildCount(); for ( int ii = 0; ii < count; ++ii ) { @@ -619,7 +619,7 @@ public class GamesListDelegate extends ListDelegateBase { super( delegator, sis, R.layout.game_list, R.menu.games_list_menu ); m_activity = delegator.getActivity(); - m_launchedGames = new HashSet(); + m_launchedGames = new HashSet<>(); s_self = this; } @@ -1013,14 +1013,14 @@ public class GamesListDelegate extends ListDelegateBase warnSMSBannedIf(); } - Set dupModeGames = DBUtils.getDupModeGames( m_activity ).keySet(); - long[] asArray = new long[dupModeGames.size()]; - int ii = 0; - for ( long rowid : dupModeGames ) { - Log.d( TAG, "row %d is dup-mode", rowid ); - asArray[ii++] = rowid; - } if ( false ) { + Set dupModeGames = DBUtils.getDupModeGames( m_activity ).keySet(); + long[] asArray = new long[dupModeGames.size()]; + int ii = 0; + for ( long rowid : dupModeGames ) { + Log.d( TAG, "row %d is dup-mode", rowid ); + asArray[ii++] = rowid; + } deleteGames( asArray, true ); } } // init @@ -2522,7 +2522,7 @@ public class GamesListDelegate extends ListDelegateBase boolean needsClear = 0 < m_mySIS.selGames.size(); if ( needsClear ) { // long[] rowIDs = getSelRowIDs(); - Set selGames = new HashSet( m_mySIS.selGames ); + Set selGames = new HashSet<>( m_mySIS.selGames ); m_mySIS.selGames.clear(); m_adapter.clearSelectedGames( selGames ); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java index 9da3c9c58..9e6fca37e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java @@ -55,9 +55,8 @@ public class InviteChoicesAlert extends DlgDelegateAlert { public void populateBuilder( final Context context, final DlgState state, AlertDialog.Builder builder ) { - final ArrayList means = - new ArrayList(); - ArrayList items = new ArrayList(); + final ArrayList means = new ArrayList<>(); + ArrayList items = new ArrayList<>(); InviteMeans lastMeans = null; if ( null != state.m_params && state.m_params[0] instanceof SentInvitesInfo ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlertView.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlertView.java index 79ed3bb9c..c682521a2 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlertView.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/LookupAlertView.java @@ -103,8 +103,7 @@ public class LookupAlertView extends LinearLayout m_wordIndex = bundle.getInt( WORDINDEX, 0 ); m_urlIndex = bundle.getInt( URLINDEX, 0 ); - m_wordsAdapter = new ArrayAdapter( m_context, LIST_LAYOUT, - m_words ); + m_wordsAdapter = new ArrayAdapter<>( m_context, LIST_LAYOUT, m_words ); m_listView = (ListView)findViewById( android.R.id.list ); m_listView.setOnItemClickListener( this ); @@ -248,8 +247,8 @@ public class LookupAlertView extends LinearLayout if ( s_lang != lang ) { String[] urls = context.getResources().getStringArray( R.array.lookup_urls ); - ArrayList tmpUrls = new ArrayList(); - ArrayList tmpNames = new ArrayList(); + ArrayList tmpUrls = new ArrayList<>(); + ArrayList tmpNames = new ArrayList<>(); String langCode = String.format( ":%s:", s_langCodes[lang] ); for ( int ii = 0; ii < urls.length; ii += 3 ) { String codes = urls[ii+1]; @@ -263,8 +262,8 @@ public class LookupAlertView extends LinearLayout } s_lookupNames = tmpNames.toArray( new String[tmpNames.size()] ); s_lookupUrls = tmpUrls.toArray( new String[tmpUrls.size()] ); - s_urlsAdapter = new ArrayAdapter( context, LIST_LAYOUT, - s_lookupNames ); + s_urlsAdapter = new ArrayAdapter<>( context, LIST_LAYOUT, + s_lookupNames ); s_lang = lang; String langName = DictLangCache.getLangName( context, lang ); s_langName = LocUtils.xlateLang( context, langName ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MainActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MainActivity.java index 12d6d39ea..27e2da1bf 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MainActivity.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MainActivity.java @@ -54,7 +54,7 @@ public class MainActivity extends XWActivity // Used only if m_dpEnabled is true private LinearLayout m_root; private boolean m_safeToCommit; - private ArrayList m_runWhenSafe = new ArrayList(); + private ArrayList m_runWhenSafe = new ArrayList<>(); private Intent m_newIntent; // work in progress... // for tracking launchForResult callback recipients @@ -270,7 +270,7 @@ public class MainActivity extends XWActivity public Intent m_data; public PendingResultCache( Fragment target, int request, int result, Intent data ) { - m_frag = new WeakReference(target); + m_frag = new WeakReference<>(target); m_request = request; m_result = result; m_data = data; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MountEventReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MountEventReceiver.java index 446d7d569..f75b0e1c5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MountEventReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MountEventReceiver.java @@ -34,7 +34,7 @@ public class MountEventReceiver extends BroadcastReceiver { void cardMounted( boolean nowMounted ); } - private static HashSet s_procs = new HashSet(); + private static HashSet s_procs = new HashSet<>(); @Override public void onReceive( Context context, Intent intent ) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiMsgSink.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiMsgSink.java index c7405cf13..7b08a5b7c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiMsgSink.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MultiMsgSink.java @@ -36,7 +36,7 @@ public class MultiMsgSink implements TransportProcs { private Context m_context; // Use set to count so message sent over both BT and Relay is counted only // once. - private Set m_sentSet = new HashSet(); + private Set m_sentSet = new HashSet<>(); public MultiMsgSink( Context context, long rowid ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NBSProto.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NBSProto.java index 15011033b..0edcf970f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NBSProto.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NBSProto.java @@ -56,7 +56,7 @@ public class NBSProto { private static int s_nReceived = 0; private static int s_nSent = 0; - private static Set s_sentDied = new HashSet(); + private static Set s_sentDied = new HashSet<>(); public static void handleFrom( Context context, byte[] buffer, String phone, short port ) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NagTurnReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NagTurnReceiver.java index 2e3d15b5b..be3e125ee 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NagTurnReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NagTurnReceiver.java @@ -171,7 +171,7 @@ public class NagTurnReceiver extends BroadcastReceiver { result = s_lastIntervals; } else { String[] strs = TextUtils.split( pref, "," ); - ArrayList al = new ArrayList(); + ArrayList al = new ArrayList<>(); for ( String str : strs ) { try { long value = Long.parseLong(str); @@ -203,7 +203,7 @@ public class NagTurnReceiver extends BroadcastReceiver { private static String formatMillis( Context context, long millis ) { long seconds = millis / 1000; - ArrayList results = new ArrayList(); + ArrayList results = new ArrayList<>(); for ( int[] datum : s_fmtData ) { long val = seconds / datum[0]; if ( 1 <= val ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java index 08a2b191e..f7757a44c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetStateCache.java @@ -153,7 +153,7 @@ public class NetStateCache { context.getApplicationContext() .registerReceiver( s_receiver, filter ); - s_ifs = new HashSet(); + s_ifs = new HashSet<>(); s_haveReceiver.set( true ); } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetUtils.java index 035256693..e4c6f718c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NetUtils.java @@ -260,7 +260,7 @@ public class NetUtils { private static String runConn( HttpsURLConnection conn, String param ) { String result = null; - Map params = new HashMap(); + Map params = new HashMap<>(); params.put( k_PARAMS, param ); String paramsString = getPostDataString( params ); @@ -338,7 +338,7 @@ public class NetUtils { { String result = null; try { - ArrayList pairs = new ArrayList(); + ArrayList pairs = new ArrayList<>(); // StringBuilder sb = new StringBuilder(); // String[] pair = { null, null }; for ( Map.Entry entry : params.entrySet() ){ diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java index 9045bf8e5..04d2b0359 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java @@ -139,7 +139,7 @@ public class PrefsDelegate extends DelegateBase protected void init( Bundle savedInstanceState ) { if ( null == s_keysHash ) { - s_keysHash = new HashMap(); + s_keysHash = new HashMap<>(); for ( int key : s_keys ) { String str = getString( key ); s_keysHash.put( str, key ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RefreshNamesTask.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RefreshNamesTask.java index f35a267d2..97124b2e6 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RefreshNamesTask.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RefreshNamesTask.java @@ -68,7 +68,7 @@ public class RefreshNamesTask extends AsyncTask { @Override protected String[] doInBackground( Void...unused ) { - ArrayList names = new ArrayList(); + ArrayList names = new ArrayList<>(); Log.i( TAG, "doInBackground()" ); try { @@ -125,9 +125,9 @@ public class RefreshNamesTask extends AsyncTask { { Log.i( TAG, "onPostExecute()" ); ArrayAdapter adapter = - new ArrayAdapter( m_context, - android.R.layout.simple_spinner_item, - result ); + new ArrayAdapter<>( m_context, + android.R.layout.simple_spinner_item, + result ); int resID = android.R.layout.simple_spinner_dropdown_item; adapter.setDropDownViewResource( resID ); m_resultSpinner.setAdapter( adapter ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java index b6a4ecb29..8dd4709af 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java @@ -577,7 +577,7 @@ public class RelayInviteDelegate extends InviteDelegate { // Spinner spinner = (Spinner) // item.findViewById(R.id.nperdev_spinner); // ArrayAdapter adapter = - // new ArrayAdapter( m_activity, android.R.layout + // new ArrayAdapter<>( m_activity, android.R.layout // .simple_spinner_item ); // for ( int ii = 1; ii <= m_nMissing; ++ii ) { // String str = getQuantityString( R.plurals.nplayers_fmt, ii, ii ); @@ -642,7 +642,7 @@ public class RelayInviteDelegate extends InviteDelegate { // } // if ( null != reply ) { - // result = new HashSet(); + // result = new HashSet<>(); // setProgressMsg( R.string.processing_games ); @@ -673,7 +673,7 @@ public class RelayInviteDelegate extends InviteDelegate { // if ( null == devIDs ) { // Log.w( TAG, "onPostExecute: no results from server?" ); // } else { - // m_devIDRecs = new ArrayList(devIDs.size()); + // m_devIDRecs = new ArrayList<>(devIDs.size()); // Iterator iter = devIDs.iterator(); // while ( iter.hasNext() ) { // String devID = iter.next(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java index b0af8bd73..78524dbb5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java @@ -115,7 +115,7 @@ public class RelayService extends XWJIService private static final String MSGNUM = "MSGNUM"; private static LinkedBlockingQueue s_queue = - new LinkedBlockingQueue(); + new LinkedBlockingQueue<>(); private static List s_packetsSentUDP = new ArrayList<>(); private static List s_packetsSentWeb = new ArrayList<>(); private static final PacketData sEOQPacket = new PacketData(); @@ -1254,10 +1254,9 @@ public class RelayService extends XWJIService if ( null != msgs ) { RelayMsgSink sink = new RelayMsgSink(); int nameCount = relayIDs.length; - ArrayList idsWMsgs = new ArrayList( nameCount ); - ArrayList isLocals = new ArrayList( nameCount ); - ArrayList bmrs = - new ArrayList( nameCount ); + ArrayList idsWMsgs = new ArrayList<>( nameCount ); + ArrayList isLocals = new ArrayList<>( nameCount ); + ArrayList bmrs = new ArrayList<>( nameCount ); boolean[] isLocalP = new boolean[1]; for ( int ii = 0; ii < nameCount; ++ii ) { @@ -1512,7 +1511,7 @@ public class RelayService extends XWJIService ArrayList list = m_msgLists.get( relayID ); if ( list == null ) { - list = new ArrayList(); + list = new ArrayList<>(); m_msgLists.put( relayID, list ); } list.add( buf ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java index 4c4ad14b8..c744858ca 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java @@ -312,7 +312,7 @@ public class SMSInviteDelegate extends InviteDelegate { { JSONObject phones = XWPrefs.getSMSPhones( m_activity ); - m_phoneRecs = new ArrayList(); + m_phoneRecs = new ArrayList<>(); for ( Iterator iter = phones.keys(); iter.hasNext(); ) { String phone = iter.next(); String name = phones.optString( phone, null ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/StudyListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/StudyListDelegate.java index b2ab06d33..885451f5e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/StudyListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/StudyListDelegate.java @@ -81,7 +81,7 @@ public class StudyListDelegate extends ListDelegateBase m_spinner = (Spinner)findViewById( R.id.pick_lang_spinner ); m_pickView = findViewById( R.id.pick_lang ); - m_checkeds = new HashSet(); + m_checkeds = new HashSet<>(); m_words = new String[0]; getBundledData( sis ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickView.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickView.java index 6a9d4fc7d..4c9d333ff 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickView.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/TilePickView.java @@ -51,7 +51,7 @@ public class TilePickView extends LinearLayout { private ArrayList m_pendingTiles; private TilePickListener m_listner; private TilePickState m_state; - private Map m_buttons = new HashMap(); + private Map m_buttons = new HashMap<>(); public TilePickView( Context context, AttributeSet as ) { super( context, as ); @@ -65,7 +65,7 @@ public class TilePickView extends LinearLayout { m_pendingTiles = (ArrayList)bundle.getSerializable( NEW_TILES ); if ( null == m_pendingTiles ) { Log.d( TAG, "creating new m_pendingTiles" ); - m_pendingTiles = new ArrayList(); + m_pendingTiles = new ArrayList<>(); } showPending(); @@ -156,7 +156,7 @@ public class TilePickView extends LinearLayout { if ( m_state.forBlank() ) { desc.setVisibility( View.GONE ); } else { - List faces = new ArrayList(); + List faces = new ArrayList<>(); for ( int indx : m_pendingTiles ) { faces.add( m_state.faces[indx] ); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Toolbar.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Toolbar.java index 2a6d00eee..05d8c344f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Toolbar.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Toolbar.java @@ -64,7 +64,7 @@ public class Toolbar implements BoardContainer.SizeChangeListener { private boolean m_visible; private Map m_onClickListeners = new HashMap<>(); private Map m_onLongClickListeners = new HashMap<>(); - private Set m_enabled = new HashSet(); + private Set m_enabled = new HashSet<>(); public Toolbar( Activity activity, HasDlgDelegate dlgDlgt ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Utils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Utils.java index d461b4b7e..cab59e91b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Utils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/Utils.java @@ -94,8 +94,7 @@ public class Utils { private static Boolean s_firstVersion = null; private static Boolean s_isFirstBootEver = null; private static Integer s_appVersion = null; - private static HashMap s_phonesHash = - new HashMap(); + private static HashMap s_phonesHash = new HashMap<>(); private static Boolean s_hasSmallScreen = null; private static Random s_random = new Random(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java index d4a241f48..b5671be2f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java @@ -113,14 +113,12 @@ public class WiDirService extends XWService { private static Thread sAcceptThread; private static ServerSocket sServerSock; private static BiDiSockWrap.Iface sIface; - private static Map sSocketWrapMap - = new HashMap(); - private static Map sUserMap = new HashMap(); - private static Map sPendingDevs = new HashMap(); + private static Map sSocketWrapMap = new HashMap<>(); + private static Map sUserMap = new HashMap<>(); + private static Map sPendingDevs = new HashMap<>(); private static String sMacAddress; private static String sDeviceName; - private static Set s_devListeners - = new HashSet(); + private static Set s_devListeners = new HashSet<>(); private static Set s_peersSet; private P2pMsgSink m_sink; @@ -190,7 +188,7 @@ public class WiDirService extends XWService { false ); Assert.assertNull( s_peersSet ); - s_peersSet = new HashSet(); + s_peersSet = new HashSet<>(); String peers = DBUtils.getStringFor( context, PEERS_LIST_KEY, null ); if ( null != peers ) { String[] macs = TextUtils.split( peers, "," ); @@ -583,7 +581,7 @@ public class WiDirService extends XWService { break; case ADD_LOCAL_SERVICES: - Map record = new HashMap(); + Map record = new HashMap<>(); record.put( "AVAILABLE", "visible"); record.put( "PORT", "" + OWNER_PORT ); record.put( "NAME", sDeviceName ); @@ -937,7 +935,7 @@ public class WiDirService extends XWService { { Map macToName; synchronized ( sUserMap ) { - macToName = new HashMap(sUserMap); + macToName = new HashMap<>(sUserMap); } return macToName; } @@ -1053,7 +1051,7 @@ public class WiDirService extends XWService { private static void updatePeersList( WifiP2pDeviceList peerList ) { - Set newSet = new HashSet(); + Set newSet = new HashSet<>(); for ( WifiP2pDevice device : peerList.getDeviceList() ) { String macAddress = device.deviceAddress; newSet.add( macAddress ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWDialogFragment.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWDialogFragment.java index 5ede46644..c83fc3de6 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWDialogFragment.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWDialogFragment.java @@ -128,7 +128,7 @@ abstract class XWDialogFragment extends DialogFragment { private Map getButtonMap() { if ( null == m_buttonMap ) { - m_buttonMap = new HashMap(); + m_buttonMap = new HashMap<>(); } return m_buttonMap; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java index 7e6827994..c4e92bd90 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWExpListAdapter.java @@ -48,7 +48,7 @@ abstract class XWExpListAdapter extends XWListAdapter { public XWExpListAdapter( Class[] childClasses ) { m_groupClass = childClasses[0]; - m_types = new HashMap(); + m_types = new HashMap<>(); for ( int ii = 0; ii < childClasses.length; ++ii ) { m_types.put( childClasses[ii], ii ); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWFragment.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWFragment.java index 18ceb7d23..c0edfe1fa 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWFragment.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWFragment.java @@ -47,7 +47,7 @@ abstract class XWFragment extends Fragment implements Delegator { private boolean m_hasOptionsMenu = false; private int m_commitID; - private static Set sActiveFrags = new HashSet(); + private static Set sActiveFrags = new HashSet<>(); public static XWFragment findOwnsView( View view ) { XWFragment result = null; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommsAddrRec.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommsAddrRec.java index 15d743f39..5e1326f7c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommsAddrRec.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommsAddrRec.java @@ -199,7 +199,7 @@ public class CommsAddrRec { if ( 0 == types.length ) { result = LocUtils.getString( context, R.string.note_none ); } else { - List strs = new ArrayList(); + List strs = new ArrayList<>(); for ( CommsConnType typ : types ) { if ( typ.isSelectable() ) { String str = longVersion? diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java index 7fc26fecc..4779b5c6e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CurGameInfo.java @@ -425,7 +425,7 @@ public class CurGameInfo implements Serializable { { String[] dicts = DictLangCache.getHaveLang( context, dictLang ); - HashSet installed = new HashSet( Arrays.asList(dicts) ); + HashSet installed = new HashSet<>( Arrays.asList(dicts) ); if ( !installed.contains( dictName ) ) { dictName = newDict; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIThread.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIThread.java index 925a65a10..46f02ef61 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIThread.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIThread.java @@ -824,7 +824,7 @@ public class JNIThread extends Thread implements AutoCloseable { return XwJNI.server_do( gamePtr ); } - private static Map s_instances = new HashMap(); + private static Map s_instances = new HashMap<>(); private void retain_sync() { ++m_refCount; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIUtilsImpl.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIUtilsImpl.java index f4dba1544..57312c04f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIUtilsImpl.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/JNIUtilsImpl.java @@ -64,7 +64,7 @@ public class JNIUtilsImpl implements JNIUtils { @Override public String[][] splitFaces( byte[] chars, boolean isUTF8 ) { - ArrayList faces = new ArrayList(); + ArrayList faces = new ArrayList<>(); ByteArrayInputStream bais = new ByteArrayInputStream( chars ); InputStreamReader isr; try { @@ -115,7 +115,7 @@ public class JNIUtilsImpl implements JNIUtils { } lastWasDelim = false; if ( null == face ) { - face = new ArrayList(); + face = new ArrayList<>(); } face.add( letter ); } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocIDs.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocIDs.java index ca9bd4a79..4984bade0 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocIDs.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocIDs.java @@ -50,7 +50,7 @@ public class LocIDs extends LocIDsData { protected static HashMap getS_MAP( Context context ) { if ( null == S_MAP ) { - S_MAP = new HashMap(S_IDS.length); + S_MAP = new HashMap<>(S_IDS.length); for ( int id : S_IDS ) { String str = context.getString( id ); S_MAP.put( str, id ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocItemEditDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocItemEditDelegate.java index c9de44776..fc7e7d58d 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocItemEditDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocItemEditDelegate.java @@ -172,7 +172,7 @@ public class LocItemEditDelegate extends DelegateBase implements TextWatcher { // searching for them anyway. private HashSet getFmtSet( String txt, TextView owner ) { - HashSet fmts = new HashSet(); + HashSet fmts = new HashSet<>(); Spannable spanText = null; // null unless used Matcher matcher = s_patFormat.matcher( txt ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocSearcher.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocSearcher.java index f819e0f5c..55fd63e18 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocSearcher.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocSearcher.java @@ -111,7 +111,7 @@ public class LocSearcher { break; } - ArrayList matches = new ArrayList(); + ArrayList matches = new ArrayList<>(); for ( Pair pair : m_pairs ) { if ( proc.passes( m_context, pair ) ) { matches.add( pair ); @@ -135,7 +135,7 @@ public class LocSearcher { Pair[] usePairs = null != m_lastTerm && term.contains(m_lastTerm) ? m_matchingPairs : m_filteredPairs; Log.i( TAG, "start: searching %d pairs", usePairs.length ); - ArrayList matches = new ArrayList(); + ArrayList matches = new ArrayList<>(); for ( Pair pair : usePairs ) { if ( pair.matches( term ) ) { matches.add( pair ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocUtils.java index a2e74fcee..24fdac01c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocUtils.java @@ -121,7 +121,7 @@ public class LocUtils { public static String xlateLang( Context context, String lang, boolean caps ) { if ( null == s_langMap ) { - s_langMap = new HashMap(); + s_langMap = new HashMap<>(); s_langMap.put( "English", context.getString( R.string.lang_name_english ) ); s_langMap.put( "French", context.getString( R.string.lang_name_french ) ); s_langMap.put( "German", context.getString( R.string.lang_name_german ) ); @@ -156,7 +156,7 @@ public class LocUtils { { int result = 0; if ( null == s_langCodeMap ) { - s_langCodeMap = new HashMap(); + s_langCodeMap = new HashMap<>(); String[] langCodes = context.getResources().getStringArray( R.array.language_codes ); for ( int ii = 0; ii < langCodes.length; ++ii ) { @@ -199,7 +199,7 @@ public class LocUtils { if ( XWApp.LOCUTILS_ENABLED ) { pareMenus(); - xlateMenu( activity, new WeakReference( menu ), menu, 0 ); + xlateMenu( activity, new WeakReference<>( menu ), menu, 0 ); } } @@ -456,8 +456,7 @@ public class LocUtils { pairs.length(), newVersion ); int len = pairs.length(); - Map newXlations = - new HashMap( len ); + Map newXlations = new HashMap<>( len ); for ( int jj = 0; jj < len; ++jj ) { JSONObject pair = pairs.getJSONObject( jj ); int id = pair.getInt( "id" ); @@ -619,8 +618,7 @@ public class LocUtils { { if ( null == s_idsToKeys ) { Map map = LocIDs.getS_MAP( context ); - HashMap idsToKeys = - new HashMap( map.size() ); + HashMap idsToKeys = new HashMap<>( map.size() ); Iterator iter = map.keySet().iterator(); while ( iter.hasNext() ) { @@ -783,7 +781,7 @@ public class LocUtils { { HashSet keys = s_menuSets.get( ref ); if ( null == keys ) { - keys = new HashSet(); + keys = new HashSet<>(); s_menuSets.put( ref, keys ); } keys.add( key ); @@ -798,7 +796,7 @@ public class LocUtils { { HashSet keys = s_contextSets.get( contextName ); if ( null == keys ) { - keys = new HashSet(); + keys = new HashSet<>(); s_contextSets.put( contextName, keys ); // DbgUtils.logf( "adding keys hash to %s", contextName ); } diff --git a/xwords4/android/app/src/main/res/layout/game_list_item.xml b/xwords4/android/app/src/main/res/layout/game_list_item.xml index 102b7a3f3..33481df67 100644 --- a/xwords4/android/app/src/main/res/layout/game_list_item.xml +++ b/xwords4/android/app/src/main/res/layout/game_list_item.xml @@ -39,8 +39,8 @@ android:paddingRight="8dip" > - + - + - -