| OLD | NEW |
| 1 library java.core; | 1 library java.core; |
| 2 | 2 |
| 3 final Stopwatch nanoTimeStopwatch = new Stopwatch(); | 3 final Stopwatch nanoTimeStopwatch = new Stopwatch(); |
| 4 | 4 |
| 5 const int LONG_MAX_VALUE = 0x7fffffffffffffff; | 5 const int LONG_MAX_VALUE = 0x7fffffffffffffff; |
| 6 | 6 |
| 7 class JavaSystem { | 7 class JavaSystem { |
| 8 static int currentTimeMillis() { | 8 static int currentTimeMillis() { |
| 9 return (new DateTime.now()).millisecondsSinceEpoch; | 9 return (new DateTime.now()).millisecondsSinceEpoch; |
| 10 } | 10 } |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 return formatList(pattern, [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7]); | 413 return formatList(pattern, [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7]); |
| 414 } | 414 } |
| 415 | 415 |
| 416 /** | 416 /** |
| 417 * Inserts the given [args] into [pattern]. | 417 * Inserts the given [args] into [pattern]. |
| 418 * | 418 * |
| 419 * format('Hello, {0}!', ['John']) = 'Hello, John!' | 419 * format('Hello, {0}!', ['John']) = 'Hello, John!' |
| 420 * format('{0} are you {1}ing?', ['How', 'do']) = 'How are you doing?' | 420 * format('{0} are you {1}ing?', ['How', 'do']) = 'How are you doing?' |
| 421 * format('{0} are you {1}ing?', ['What', 'read']) = 'What are you reading?' | 421 * format('{0} are you {1}ing?', ['What', 'read']) = 'What are you reading?' |
| 422 */ | 422 */ |
| 423 String formatList(String pattern, List args) { | 423 String formatList(String pattern, List<Object> arguments) { |
| 424 if (arguments == null || arguments.isEmpty) { |
| 425 return pattern; |
| 426 } |
| 424 return pattern.replaceAllMapped(new RegExp(r'\{(\d+)\}'), (match) { | 427 return pattern.replaceAllMapped(new RegExp(r'\{(\d+)\}'), (match) { |
| 425 String indexStr = match.group(1); | 428 String indexStr = match.group(1); |
| 426 int index = int.parse(indexStr); | 429 int index = int.parse(indexStr); |
| 427 var arg = args[index]; | 430 Object arg = arguments[index]; |
| 428 return arg != null ? arg.toString() : null; | 431 return arg != null ? arg.toString() : null; |
| 429 }); | 432 }); |
| 430 } | 433 } |
| OLD | NEW |