remove unnecessary types from generics constructors

This commit is contained in:
Eric House 2020-03-28 13:34:39 -07:00
parent 387d88bdde
commit 0f6b1897b7
49 changed files with 167 additions and 201 deletions

View file

@ -125,7 +125,7 @@ public class BiDiSockWrap {
private void init( Socket socket )
{
mSocket = socket;
mQueue = new LinkedBlockingQueue<byte[]>();
mQueue = new LinkedBlockingQueue<>();
startThreads();
}

View file

@ -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 )
{

View file

@ -57,7 +57,7 @@ public class BoardContainer extends ViewGroup {
public static void registerSizeChangeListener(SizeChangeListener scl)
{
s_scl = new WeakReference<SizeChangeListener>(scl);
s_scl = new WeakReference<>(scl);
callSCL();
}

View file

@ -69,7 +69,7 @@ public class CommsTransport implements TransportProcs,
m_context = context;
m_tpHandler = handler;
m_rowid = rowid;
m_buffersOut = new Vector<ByteBuffer>();
m_buffersOut = new Vector<>();
m_bytesIn = ByteBuffer.allocate( 2048 );
NetStateCache.register( context, this );

View file

@ -497,7 +497,7 @@ public class DBHelper extends SQLiteOpenHelper {
if ( null != columnNames ) {
ArrayList<String> oldCols =
new ArrayList<String>( 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<String> newCols = new ArrayList<String>();
ArrayList<String> newCols = new ArrayList<>();
for ( int ii = 0; ii < data.length; ++ii ) {
newCols.add( data[ii][0] );
}

View file

@ -89,13 +89,13 @@ public class DBUtils {
GameChangeType change );
}
private static HashSet<DBChangeListener> s_listeners =
new HashSet<DBChangeListener>();
new HashSet<>();
public static interface StudyListListener {
void onWordAdded( String word, int langCode );
}
private static Set<StudyListListener> s_slListeners
= new HashSet<StudyListListener>();
= 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<InviteMeans>();
m_targets = new ArrayList<String>();
m_timestamps = new ArrayList<Date>();
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<String> devs;
if ( ! hashes.containsKey( means ) ) {
devs = new HashSet<String>();
devs = new HashSet<>();
hashes.put( means, devs );
}
devs = hashes.get( means );
@ -770,7 +770,7 @@ public class DBUtils {
public static HashMap<Long,CommsConnTypeSet>
getGamesWithSendsPending( Context context )
{
HashMap<Long, CommsConnTypeSet> result = new HashMap<Long,CommsConnTypeSet>();
HashMap<Long, CommsConnTypeSet> 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<Integer>();
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<String> ids = new ArrayList<String>();
ArrayList<String> 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<Obit> al = new ArrayList<Obit>();
ArrayList<Obit> 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<ContentValues> valuess = new ArrayList<ContentValues>();
ArrayList<HistoryPair> pairs = new ArrayList<HistoryPair>();
ArrayList<ContentValues> valuess = new ArrayList<>();
ArrayList<HistoryPair> 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<Long, Integer> getGameCounts( SQLiteDatabase db )
{
HashMap<Long, Integer> result = new HashMap<Long, Integer>();
HashMap<Long, Integer> 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<String, String> local = new HashMap<String, String>();
HashMap<String, String> blessed = new HashMap<String, String>();
HashMap<String, String> local = new HashMap<>();
HashMap<String, String> blessed = new HashMap<>();
String selection = String.format( "%s = '%s'", DBHelper.LOCALE,
locale );

View file

@ -101,7 +101,7 @@ public class DbgUtils {
static String extrasToString( Bundle extras )
{
ArrayList<String> al = new ArrayList<String>();
ArrayList<String> al = new ArrayList<>();
if ( null != extras ) {
for ( String key : extras.keySet() ) {
al.add( key + ":" + extras.get(key) );

View file

@ -76,7 +76,7 @@ public class DelegateBase implements DlgClickNotify,
private boolean m_finishCalled;
private View m_rootView;
private boolean m_isVisible;
private ArrayList<Runnable> m_visibleProcs = new ArrayList<Runnable>();
private ArrayList<Runnable> m_visibleProcs = new ArrayList<>();
private static Map<Class, WeakReference<DelegateBase>> s_instances
= new HashMap<Class, WeakReference<DelegateBase>>();
@ -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<DelegateBase>(this) );
s_instances.put( clazz, new WeakReference<>(this) );
}
}

View file

@ -66,7 +66,7 @@ public class DictLangCache {
public void rebuild()
{
m_map = new HashMap<String, String>();
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<DictInfo> al = new ArrayList<DictInfo>();
ArrayList<DictInfo> 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<String> al = new ArrayList<String>();
ArrayList<String> 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<DictAndLoc> al = new ArrayList<DictAndLoc>();
ArrayList<DictAndLoc> 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<String> langs = new HashSet<String>();
Set<String> 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<String>( 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;
}

View file

@ -47,8 +47,8 @@ public class DictListPreference extends XWListPreference {
int langCode = DictLangCache.getLangLangCode( context, curLang );
DictUtils.DictAndLoc[] dals = DictUtils.dictList( context );
ArrayList<String> dictEntries = new ArrayList<String>();
ArrayList<String> values = new ArrayList<String>();
ArrayList<String> dictEntries = new ArrayList<>();
ArrayList<String> values = new ArrayList<>();
for ( int ii = 0; ii < dals.length; ++ii ) {
String name = dals[ii].name;
if ( langCode == DictLangCache.getDictLangCode( context, name ) ) {

View file

@ -452,7 +452,7 @@ public class DictUtils {
byte[][] dictBytes = new byte[names.length][];
String[] dictPaths = new String[names.length];
HashMap<String,byte[]> seen = new HashMap<String,byte[]>();
HashMap<String,byte[]> seen = new HashMap<>();
for ( int ii = 0; ii < names.length; ++ii ) {
byte[] bytes = null;
String path = null;

View file

@ -102,7 +102,7 @@ public class DictsDelegate extends ListDelegateBase
private String[] m_locNames;
private String m_finishOnName;
private Map<String, XWListItem> m_selViews;
private Map<String, Object> m_selDicts = new HashMap<String, Object>();
private Map<String, Object> 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<MenuItem, DictAndLoc> itemData
= new HashMap<MenuItem, DictAndLoc>();
= new HashMap<>();
MenuItem.OnMenuItemClickListener listener =
new MenuItem.OnMenuItemClickListener() {
@ -207,7 +207,7 @@ public class DictsDelegate extends ListDelegateBase
@Override
public Object[] makeListData()
{
ArrayList<Object> alist = new ArrayList<Object>();
ArrayList<Object> 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<Object> makeLangItems( String langName )
{
ArrayList<Object> result = new ArrayList<Object>();
ArrayList<Object> result = new ArrayList<>();
HashSet<String> locals = new HashSet<String>();
HashSet<String> 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<String>();
m_closedLangs = new HashSet<>();
String[] closed = XWPrefs.getClosedLangs( m_activity );
if ( null != closed ) {
m_closedLangs.addAll( Arrays.asList( closed ) );
}
m_expandedItems = new HashSet<DictInfo>();
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<String>();
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<Integer, LangDelData> dels = new HashMap<Integer, LangDelData>();
Set<Integer> skipLangs = new HashSet<Integer>();
Map<Integer, LangDelData> dels = new HashMap<>();
Set<Integer> 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<String> langs = new HashSet<String>();
Set<String> 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<String, XWListItem>();
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<String, Uri>();
m_needUpdates = new HashMap<>();
if ( null != jsonData ) {
Set<String> closedLangs = new HashSet<String>();
Set<String> closedLangs = new HashSet<>();
final Set<String> curLangs =
new HashSet<String>( 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<String, DictInfo[]>();
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<DictInfo> dictNames =
new ArrayList<DictInfo>();
ArrayList<DictInfo> dictNames = new ArrayList<>();
for ( int jj = 0; !isCancelled() && jj < nDicts;
++jj ) {
JSONObject dict = dicts.getJSONObject( jj );

View file

@ -88,7 +88,7 @@ public class DwnldDelegate extends ListDelegateBase {
public DownloadFinishedListener m_lstnr;
}
private static Map<Uri,ListenerData> s_listeners =
new HashMap<Uri,ListenerData>();
new HashMap<>();
private class DownloadFilesTask extends AsyncTask<Void, Void, Void>
implements DictUtils.DownProgListener {
@ -249,7 +249,7 @@ public class DwnldDelegate extends ListDelegateBase {
@Override
protected void init( Bundle savedInstanceState )
{
m_dfts = new ArrayList<DownloadFilesTask>();
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<LinearLayout>();
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<LinearLayout>( 1 );
m_views = new ArrayList<>( 1 );
m_views.add( item );
dft = null;
}

View file

@ -69,11 +69,11 @@ public class ExpiringDelegate {
private Handler m_handler;
private ArrayList<WeakReference<ExpiringDelegate>> m_refs
= new ArrayList<WeakReference<ExpiringDelegate>>();
private Set<Integer> m_hashes = new HashSet<Integer>();
private Set<Integer> m_hashes = new HashSet<>();
public void run() {
int sizeBefore;
ArrayList<ExpiringDelegate> dlgts = new ArrayList<ExpiringDelegate>();
ArrayList<ExpiringDelegate> 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<ExpiringDelegate>(self) );
m_refs.add( new WeakReference<>(self) );
}
}
}

View file

@ -48,7 +48,7 @@ public class GameListItem extends LinearLayout
private static final int SUMMARY_WAIT_MSECS = 1000;
private static HashSet<Long> s_invalRows = new HashSet<Long>();
private static HashSet<Long> 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<ThumbQueueElem> s_queue
= new LinkedBlockingQueue<ThumbQueueElem>();
= new LinkedBlockingQueue<>();
private static Thread s_thumbThread;
private static void enqueueGetThumbnail( GameListItem item, long rowid )

View file

@ -883,7 +883,7 @@ public class GameUtils {
HashSet<String> missingSet;
DictUtils.DictAndLoc[] installed = DictUtils.dictList( context );
missingSet = new HashSet<String>( Arrays.asList( gameDicts ) );
missingSet = new HashSet<>( Arrays.asList( gameDicts ) );
missingSet.remove( null );
boolean allHere = 0 != missingSet.size(); // need some non-null!
if ( allHere ) {

View file

@ -144,7 +144,7 @@ public class GamesListDelegate extends ListDelegateBase
protected Object[] makeListData()
{
final Map<Long,GameGroupInfo> gameInfo = DBUtils.getGroups( m_activity );
ArrayList<Object> alist = new ArrayList<Object>();
ArrayList<Object> 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<Object> makeChildren( long groupID )
{
long[] rows = DBUtils.getGroupGames( m_activity, groupID );
List<Object> alist = new ArrayList<Object>( rows.length );
List<Object> 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<Object> result = new ArrayList<Object>(len);
ArrayList<Object> 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<GameListGroup> getGroupWithID( long groupID )
{
Set<Long> groupIDs = new HashSet<Long>();
Set<Long> groupIDs = new HashSet<>();
groupIDs.add( groupID );
Set<GameListGroup> result = getGroupsWithIDs( groupIDs );
return result;
@ -477,7 +477,7 @@ public class GamesListDelegate extends ListDelegateBase
// get to page out when they scroll offscreen.
private Set<GameListGroup> getGroupsWithIDs( Set<Long> groupIDs )
{
Set<GameListGroup> result = new HashSet<GameListGroup>();
Set<GameListGroup> 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<GameListItem> getGamesFromElems( long rowID )
{
HashSet<Long> rowSet = new HashSet<Long>();
HashSet<Long> rowSet = new HashSet<>();
rowSet.add( rowID );
return getGamesFromElems( rowSet );
}
private Set<GameListItem> getGamesFromElems( Set<Long> rowIDs )
{
Set<GameListItem> result = new HashSet<GameListItem>();
Set<GameListItem> 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<Long>();
m_launchedGames = new HashSet<>();
s_self = this;
}
@ -1013,14 +1013,14 @@ public class GamesListDelegate extends ListDelegateBase
warnSMSBannedIf();
}
Set<Long> 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<Long> 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<Long> selGames = new HashSet<Long>( m_mySIS.selGames );
Set<Long> selGames = new HashSet<>( m_mySIS.selGames );
m_mySIS.selGames.clear();
m_adapter.clearSelectedGames( selGames );
}

View file

@ -55,9 +55,8 @@ public class InviteChoicesAlert extends DlgDelegateAlert {
public void populateBuilder( final Context context, final DlgState state,
AlertDialog.Builder builder )
{
final ArrayList<InviteMeans> means =
new ArrayList<InviteMeans>();
ArrayList<String> items = new ArrayList<String>();
final ArrayList<InviteMeans> means = new ArrayList<>();
ArrayList<String> items = new ArrayList<>();
InviteMeans lastMeans = null;
if ( null != state.m_params
&& state.m_params[0] instanceof SentInvitesInfo ) {

View file

@ -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<String>( 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<String> tmpUrls = new ArrayList<String>();
ArrayList<String> tmpNames = new ArrayList<String>();
ArrayList<String> tmpUrls = new ArrayList<>();
ArrayList<String> 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<String>( 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 );

View file

@ -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<Runnable> m_runWhenSafe = new ArrayList<Runnable>();
private ArrayList<Runnable> 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<Fragment>(target);
m_frag = new WeakReference<>(target);
m_request = request;
m_result = result;
m_data = data;

View file

@ -34,7 +34,7 @@ public class MountEventReceiver extends BroadcastReceiver {
void cardMounted( boolean nowMounted );
}
private static HashSet<SDCardNotifiee> s_procs = new HashSet<SDCardNotifiee>();
private static HashSet<SDCardNotifiee> s_procs = new HashSet<>();
@Override
public void onReceive( Context context, Intent intent )

View file

@ -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<String> m_sentSet = new HashSet<String>();
private Set<String> m_sentSet = new HashSet<>();
public MultiMsgSink( Context context, long rowid )
{

View file

@ -56,7 +56,7 @@ public class NBSProto {
private static int s_nReceived = 0;
private static int s_nSent = 0;
private static Set<Integer> s_sentDied = new HashSet<Integer>();
private static Set<Integer> s_sentDied = new HashSet<>();
public static void handleFrom( Context context, byte[] buffer,
String phone, short port )

View file

@ -171,7 +171,7 @@ public class NagTurnReceiver extends BroadcastReceiver {
result = s_lastIntervals;
} else {
String[] strs = TextUtils.split( pref, "," );
ArrayList<Long> al = new ArrayList<Long>();
ArrayList<Long> 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<String> results = new ArrayList<String>();
ArrayList<String> results = new ArrayList<>();
for ( int[] datum : s_fmtData ) {
long val = seconds / datum[0];
if ( 1 <= val ) {

View file

@ -153,7 +153,7 @@ public class NetStateCache {
context.getApplicationContext()
.registerReceiver( s_receiver, filter );
s_ifs = new HashSet<StateChangedIf>();
s_ifs = new HashSet<>();
s_haveReceiver.set( true );
}
}

View file

@ -260,7 +260,7 @@ public class NetUtils {
private static String runConn( HttpsURLConnection conn, String param )
{
String result = null;
Map<String, String> params = new HashMap<String, String>();
Map<String, String> params = new HashMap<>();
params.put( k_PARAMS, param );
String paramsString = getPostDataString( params );
@ -338,7 +338,7 @@ public class NetUtils {
{
String result = null;
try {
ArrayList<String> pairs = new ArrayList<String>();
ArrayList<String> pairs = new ArrayList<>();
// StringBuilder sb = new StringBuilder();
// String[] pair = { null, null };
for ( Map.Entry<String, String> entry : params.entrySet() ){

View file

@ -139,7 +139,7 @@ public class PrefsDelegate extends DelegateBase
protected void init( Bundle savedInstanceState )
{
if ( null == s_keysHash ) {
s_keysHash = new HashMap<String, Integer>();
s_keysHash = new HashMap<>();
for ( int key : s_keys ) {
String str = getString( key );
s_keysHash.put( str, key );

View file

@ -68,7 +68,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
@Override
protected String[] doInBackground( Void...unused )
{
ArrayList<String> names = new ArrayList<String>();
ArrayList<String> names = new ArrayList<>();
Log.i( TAG, "doInBackground()" );
try {
@ -125,9 +125,9 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
{
Log.i( TAG, "onPostExecute()" );
ArrayAdapter<String> adapter =
new ArrayAdapter<String>( 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 );

View file

@ -577,7 +577,7 @@ public class RelayInviteDelegate extends InviteDelegate {
// Spinner spinner = (Spinner)
// item.findViewById(R.id.nperdev_spinner);
// ArrayAdapter<String> adapter =
// new ArrayAdapter<String>( 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<String>();
// 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<DevIDRec>(devIDs.size());
// m_devIDRecs = new ArrayList<>(devIDs.size());
// Iterator<String> iter = devIDs.iterator();
// while ( iter.hasNext() ) {
// String devID = iter.next();

View file

@ -115,7 +115,7 @@ public class RelayService extends XWJIService
private static final String MSGNUM = "MSGNUM";
private static LinkedBlockingQueue<PacketData> s_queue =
new LinkedBlockingQueue<PacketData>();
new LinkedBlockingQueue<>();
private static List<PacketData> s_packetsSentUDP = new ArrayList<>();
private static List<PacketData> 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<String> idsWMsgs = new ArrayList<String>( nameCount );
ArrayList<Boolean> isLocals = new ArrayList<Boolean>( nameCount );
ArrayList<BackMoveResult> bmrs =
new ArrayList<BackMoveResult>( nameCount );
ArrayList<String> idsWMsgs = new ArrayList<>( nameCount );
ArrayList<Boolean> isLocals = new ArrayList<>( nameCount );
ArrayList<BackMoveResult> 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<byte[]> list = m_msgLists.get( relayID );
if ( list == null ) {
list = new ArrayList<byte[]>();
list = new ArrayList<>();
m_msgLists.put( relayID, list );
}
list.add( buf );

View file

@ -312,7 +312,7 @@ public class SMSInviteDelegate extends InviteDelegate {
{
JSONObject phones = XWPrefs.getSMSPhones( m_activity );
m_phoneRecs = new ArrayList<PhoneRec>();
m_phoneRecs = new ArrayList<>();
for ( Iterator<String> iter = phones.keys(); iter.hasNext(); ) {
String phone = iter.next();
String name = phones.optString( phone, null );

View file

@ -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<String>();
m_checkeds = new HashSet<>();
m_words = new String[0];
getBundledData( sis );

View file

@ -51,7 +51,7 @@ public class TilePickView extends LinearLayout {
private ArrayList<Integer> m_pendingTiles;
private TilePickListener m_listner;
private TilePickState m_state;
private Map<Integer, Button> m_buttons = new HashMap<Integer, Button>();
private Map<Integer, Button> 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<Integer>)bundle.getSerializable( NEW_TILES );
if ( null == m_pendingTiles ) {
Log.d( TAG, "creating new m_pendingTiles" );
m_pendingTiles = new ArrayList<Integer>();
m_pendingTiles = new ArrayList<>();
}
showPending();
@ -156,7 +156,7 @@ public class TilePickView extends LinearLayout {
if ( m_state.forBlank() ) {
desc.setVisibility( View.GONE );
} else {
List<String> faces = new ArrayList<String>();
List<String> faces = new ArrayList<>();
for ( int indx : m_pendingTiles ) {
faces.add( m_state.faces[indx] );
}

View file

@ -64,7 +64,7 @@ public class Toolbar implements BoardContainer.SizeChangeListener {
private boolean m_visible;
private Map<Buttons, Object> m_onClickListeners = new HashMap<>();
private Map<Buttons, Object> m_onLongClickListeners = new HashMap<>();
private Set<Buttons> m_enabled = new HashSet<Buttons>();
private Set<Buttons> m_enabled = new HashSet<>();
public Toolbar( Activity activity, HasDlgDelegate dlgDlgt )
{

View file

@ -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<String,String> s_phonesHash =
new HashMap<String,String>();
private static HashMap<String,String> s_phonesHash = new HashMap<>();
private static Boolean s_hasSmallScreen = null;
private static Random s_random = new Random();

View file

@ -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<String, BiDiSockWrap> sSocketWrapMap
= new HashMap<String, BiDiSockWrap>();
private static Map<String, String> sUserMap = new HashMap<String, String>();
private static Map<String, Long> sPendingDevs = new HashMap<String, Long>();
private static Map<String, BiDiSockWrap> sSocketWrapMap = new HashMap<>();
private static Map<String, String> sUserMap = new HashMap<>();
private static Map<String, Long> sPendingDevs = new HashMap<>();
private static String sMacAddress;
private static String sDeviceName;
private static Set<DevSetListener> s_devListeners
= new HashSet<DevSetListener>();
private static Set<DevSetListener> s_devListeners = new HashSet<>();
private static Set<String> s_peersSet;
private P2pMsgSink m_sink;
@ -190,7 +188,7 @@ public class WiDirService extends XWService {
false );
Assert.assertNull( s_peersSet );
s_peersSet = new HashSet<String>();
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<String, String> record = new HashMap<String, String>();
Map<String, String> 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<String, String> macToName;
synchronized ( sUserMap ) {
macToName = new HashMap<String, String>(sUserMap);
macToName = new HashMap<>(sUserMap);
}
return macToName;
}
@ -1053,7 +1051,7 @@ public class WiDirService extends XWService {
private static void updatePeersList( WifiP2pDeviceList peerList )
{
Set<String> newSet = new HashSet<String>();
Set<String> newSet = new HashSet<>();
for ( WifiP2pDevice device : peerList.getDeviceList() ) {
String macAddress = device.deviceAddress;
newSet.add( macAddress );

View file

@ -128,7 +128,7 @@ abstract class XWDialogFragment extends DialogFragment {
private Map<Integer, DialogInterface.OnClickListener> getButtonMap()
{
if ( null == m_buttonMap ) {
m_buttonMap = new HashMap<Integer, DialogInterface.OnClickListener>();
m_buttonMap = new HashMap<>();
}
return m_buttonMap;
}

View file

@ -48,7 +48,7 @@ abstract class XWExpListAdapter extends XWListAdapter {
public XWExpListAdapter( Class[] childClasses )
{
m_groupClass = childClasses[0];
m_types = new HashMap<Class, Integer>();
m_types = new HashMap<>();
for ( int ii = 0; ii < childClasses.length; ++ii ) {
m_types.put( childClasses[ii], ii );
}

View file

@ -47,7 +47,7 @@ abstract class XWFragment extends Fragment implements Delegator {
private boolean m_hasOptionsMenu = false;
private int m_commitID;
private static Set<XWFragment> sActiveFrags = new HashSet<XWFragment>();
private static Set<XWFragment> sActiveFrags = new HashSet<>();
public static XWFragment findOwnsView( View view )
{
XWFragment result = null;

View file

@ -199,7 +199,7 @@ public class CommsAddrRec {
if ( 0 == types.length ) {
result = LocUtils.getString( context, R.string.note_none );
} else {
List<String> strs = new ArrayList<String>();
List<String> strs = new ArrayList<>();
for ( CommsConnType typ : types ) {
if ( typ.isSelectable() ) {
String str = longVersion?

View file

@ -425,7 +425,7 @@ public class CurGameInfo implements Serializable {
{
String[] dicts =
DictLangCache.getHaveLang( context, dictLang );
HashSet<String> installed = new HashSet<String>( Arrays.asList(dicts) );
HashSet<String> installed = new HashSet<>( Arrays.asList(dicts) );
if ( !installed.contains( dictName ) ) {
dictName = newDict;

View file

@ -824,7 +824,7 @@ public class JNIThread extends Thread implements AutoCloseable {
return XwJNI.server_do( gamePtr );
}
private static Map<Long, JNIThread> s_instances = new HashMap<Long, JNIThread>();
private static Map<Long, JNIThread> s_instances = new HashMap<>();
private void retain_sync()
{
++m_refCount;

View file

@ -64,7 +64,7 @@ public class JNIUtilsImpl implements JNIUtils {
@Override
public String[][] splitFaces( byte[] chars, boolean isUTF8 )
{
ArrayList<String[]> faces = new ArrayList<String[]>();
ArrayList<String[]> 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<String>();
face = new ArrayList<>();
}
face.add( letter );
}

View file

@ -50,7 +50,7 @@ public class LocIDs extends LocIDsData {
protected static HashMap<String, Integer> getS_MAP( Context context )
{
if ( null == S_MAP ) {
S_MAP = new HashMap<String, Integer>(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 );

View file

@ -172,7 +172,7 @@ public class LocItemEditDelegate extends DelegateBase implements TextWatcher {
// searching for them anyway.
private HashSet<String> getFmtSet( String txt, TextView owner )
{
HashSet<String> fmts = new HashSet<String>();
HashSet<String> fmts = new HashSet<>();
Spannable spanText = null; // null unless used
Matcher matcher = s_patFormat.matcher( txt );

View file

@ -111,7 +111,7 @@ public class LocSearcher {
break;
}
ArrayList<Pair> matches = new ArrayList<Pair>();
ArrayList<Pair> 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<Pair> matches = new ArrayList<Pair>();
ArrayList<Pair> matches = new ArrayList<>();
for ( Pair pair : usePairs ) {
if ( pair.matches( term ) ) {
matches.add( pair );

View file

@ -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<String, String>();
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<String, Integer>();
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 ), menu, 0 );
xlateMenu( activity, new WeakReference<>( menu ), menu, 0 );
}
}
@ -456,8 +456,7 @@ public class LocUtils {
pairs.length(), newVersion );
int len = pairs.length();
Map<String,String> newXlations =
new HashMap<String,String>( len );
Map<String,String> 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<String,Integer> map = LocIDs.getS_MAP( context );
HashMap<Integer, String> idsToKeys =
new HashMap<Integer, String>( map.size() );
HashMap<Integer, String> idsToKeys = new HashMap<>( map.size() );
Iterator<String> iter = map.keySet().iterator();
while ( iter.hasNext() ) {
@ -783,7 +781,7 @@ public class LocUtils {
{
HashSet<String> keys = s_menuSets.get( ref );
if ( null == keys ) {
keys = new HashSet<String>();
keys = new HashSet<>();
s_menuSets.put( ref, keys );
}
keys.add( key );
@ -798,7 +796,7 @@ public class LocUtils {
{
HashSet<String> keys = s_contextSets.get( contextName );
if ( null == keys ) {
keys = new HashSet<String>();
keys = new HashSet<>();
s_contextSets.put( contextName, keys );
// DbgUtils.logf( "adding keys hash to %s", contextName );
}

View file

@ -39,8 +39,8 @@
android:paddingRight="8dip"
>
<ImageView android:id="@+id/game_type_marker"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/ic_multigame"
/>
<ImageView android:id="@+id/has_chat_marker"

View file

@ -13,17 +13,17 @@
android:layout_width="fill_parent"
/>
<org.eehouse.android.xw4.EditWClear
android:id="@+id/msg_edit"
style="@style/edit_w_clear"
android:hint="@string/pause_expl_hint"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences|textMultiLine"
android:layout_weight="1"
android:scrollHorizontally="false"
android:layout_marginTop="10sp"
/>
<org.eehouse.android.xw4.EditWClear
android:id="@+id/msg_edit"
style="@style/edit_w_clear"
android:hint="@string/pause_expl_hint"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences|textMultiLine"
android:layout_weight="1"
android:scrollHorizontally="false"
android:layout_marginTop="10sp"
/>
<Spinner android:id="@+id/saved_msgs"
android:layout_width="wrap_content"
@ -32,22 +32,22 @@
android:layout_marginTop="10sp"
/>
<!-- android:hint="@string/pause_msg_hint" -->
<!-- android:hint="@string/pause_msg_hint" -->
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button android:id="@+id/pause_save_msg"
android:layout_width="wrap_content"
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/pause_save_msg"
/>
<Button android:id="@+id/pause_forget_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pause_forget_msg"
/>
android:orientation="horizontal"
>
<Button android:id="@+id/pause_save_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pause_save_msg"
/>
<Button android:id="@+id/pause_forget_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pause_forget_msg"
/>
</LinearLayout>
</LinearLayout>
</org.eehouse.android.xw4.ConfirmPauseView>