| OLD | NEW |
| 1 library java.core; | 1 library java.core; |
| 2 | 2 |
| 3 import "dart:math" as math; | 3 import "dart:math" as math; |
| 4 import "dart:collection" show ListBase; | 4 import "dart:collection" show ListBase; |
| 5 | 5 |
| 6 class JavaSystem { | 6 class JavaSystem { |
| 7 static int currentTimeMillis() { | 7 static int currentTimeMillis() { |
| 8 return (new DateTime.now()).millisecondsSinceEpoch; | 8 return (new DateTime.now()).millisecondsSinceEpoch; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 | 262 |
| 263 class UnsupportedOperationException implements Exception { | 263 class UnsupportedOperationException implements Exception { |
| 264 String toString() => "UnsupportedOperationException"; | 264 String toString() => "UnsupportedOperationException"; |
| 265 } | 265 } |
| 266 | 266 |
| 267 class NumberFormatException implements Exception { | 267 class NumberFormatException implements Exception { |
| 268 String toString() => "NumberFormatException"; | 268 String toString() => "NumberFormatException"; |
| 269 } | 269 } |
| 270 | 270 |
| 271 /// Parses given string to [Uri], throws [URISyntaxException] if invalid. |
| 272 Uri parseUriWithException(String str) { |
| 273 Uri uri = Uri.parse(str); |
| 274 if (uri.path.isEmpty) { |
| 275 throw new URISyntaxException(); |
| 276 } |
| 277 return uri; |
| 278 } |
| 279 |
| 271 class URISyntaxException implements Exception { | 280 class URISyntaxException implements Exception { |
| 272 String toString() => "URISyntaxException"; | 281 String toString() => "URISyntaxException"; |
| 273 } | 282 } |
| 274 | 283 |
| 275 class IOException implements Exception { | 284 class IOException implements Exception { |
| 276 String toString() => "IOException"; | 285 String toString() => "IOException"; |
| 277 } | 286 } |
| 278 | 287 |
| 279 class MissingFormatArgumentException implements Exception { | 288 class MissingFormatArgumentException implements Exception { |
| 280 final String s; | 289 final String s; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 (_iterable as List).remove(_coPos); | 423 (_iterable as List).remove(_coPos); |
| 415 } else if (_iterable is Set) { | 424 } else if (_iterable is Set) { |
| 416 (_iterable as Set).remove(_current); | 425 (_iterable as Set).remove(_current); |
| 417 } else { | 426 } else { |
| 418 throw new StateError("Unsupported iterable ${_iterable.runtimeType}"); | 427 throw new StateError("Unsupported iterable ${_iterable.runtimeType}"); |
| 419 } | 428 } |
| 420 } | 429 } |
| 421 } | 430 } |
| 422 | 431 |
| 423 class MapEntry<K, V> { | 432 class MapEntry<K, V> { |
| 424 K _key; | 433 final Map<K, V> _map; |
| 434 final K _key; |
| 425 V _value; | 435 V _value; |
| 426 MapEntry(this._key, this._value); | 436 MapEntry(this._map, this._key, this._value); |
| 427 K getKey() => _key; | 437 K getKey() => _key; |
| 428 V getValue() => _value; | 438 V getValue() => _value; |
| 439 V setValue(V v) { |
| 440 V prevValue = _value; |
| 441 _value = v; |
| 442 _map[_key] = v; |
| 443 return prevValue; |
| 444 } |
| 429 } | 445 } |
| 430 | 446 |
| 431 Set<MapEntry> getMapEntrySet(Map m) { | 447 Set<MapEntry> getMapEntrySet(Map m) { |
| 432 Set<MapEntry> result = new Set(); | 448 Set<MapEntry> result = new Set(); |
| 433 m.forEach((k, v) { | 449 m.forEach((k, v) { |
| 434 result.add(new MapEntry(k, v)); | 450 result.add(new MapEntry(m, k, v)); |
| 435 }); | 451 }); |
| 436 return result; | 452 return result; |
| 437 } | 453 } |
| 438 | 454 |
| 439 bool javaSetAdd(Set s, o) { | 455 bool javaSetAdd(Set s, o) { |
| 440 if (!s.contains(o)) { | 456 if (!s.contains(o)) { |
| 441 s.add(o); | 457 s.add(o); |
| 442 return true; | 458 return true; |
| 443 } | 459 } |
| 444 return false; | 460 return false; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 } | 496 } |
| 481 } else if (sb.length > newLength) { | 497 } else if (sb.length > newLength) { |
| 482 var s = sb.toString().substring(0, newLength); | 498 var s = sb.toString().substring(0, newLength); |
| 483 sb = new StringBuffer(s); | 499 sb = new StringBuffer(s); |
| 484 } | 500 } |
| 485 } | 501 } |
| 486 void clear() { | 502 void clear() { |
| 487 sb = new StringBuffer(); | 503 sb = new StringBuffer(); |
| 488 } | 504 } |
| 489 } | 505 } |
| OLD | NEW |