I apparently don't understand how varargs works in java

This commit is contained in:
Eric House 2014-04-15 07:31:57 -07:00
parent 3c76de6851
commit 01c94d91cd

View file

@ -148,11 +148,6 @@ public class LocUtils {
} }
public static String getString( Context context, int id ) public static String getString( Context context, int id )
{
return getString( context, id, (Object)null );
}
public static String getString( Context context, int id, Object... params )
{ {
String result = null; String result = null;
String key = keyForID( context, id ); String key = keyForID( context, id );
@ -164,7 +159,14 @@ public class LocUtils {
result = context.getString( id ); result = context.getString( id );
} }
if ( null != result && null != params ) { return result;
}
public static String getString( Context context, int id, Object... params )
{
Assert.assertNotNull( params );
String result = getString( context, id );
if ( null != result ) {
result = String.format( result, params ); result = String.format( result, params );
} }
return result; return result;