| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 static num max(num a, num b) => math.max(a, b); | 251 static num max(num a, num b) => math.max(a, b); |
| 252 static num min(num a, num b) => math.min(a, b); | 252 static num min(num a, num b) => math.min(a, b); |
| 253 } | 253 } |
| 254 | 254 |
| 255 class RuntimeException implements Exception { | 255 class RuntimeException implements Exception { |
| 256 String toString() => "RuntimeException"; | 256 String toString() => "RuntimeException"; |
| 257 } | 257 } |
| 258 | 258 |
| 259 class JavaException implements Exception { | 259 class JavaException implements Exception { |
| 260 final String message; | 260 final String message; |
| 261 final Exception e; | 261 final Exception cause; |
| 262 JavaException([this.message = "", this.e = null]); | 262 JavaException([this.message = "", this.cause = null]); |
| 263 JavaException.withCause(this.e) : message = null; | 263 JavaException.withCause(this.cause) : message = null; |
| 264 String toString() => "JavaException: $message $e"; | 264 String toString() => "JavaException: $message $cause"; |
| 265 } |
| 266 |
| 267 class IOException extends JavaException { |
| 268 IOException([message = "", cause = null]) : super(message, cause); |
| 265 } | 269 } |
| 266 | 270 |
| 267 class IllegalArgumentException implements Exception { | 271 class IllegalArgumentException implements Exception { |
| 268 final String message; | 272 final String message; |
| 269 const IllegalArgumentException([this.message = "", Exception e = null]); | 273 const IllegalArgumentException([this.message = "", Exception e = null]); |
| 270 String toString() => "IllegalStateException: $message"; | 274 String toString() => "IllegalStateException: $message"; |
| 271 } | 275 } |
| 272 | 276 |
| 273 class StringIndexOutOfBoundsException implements Exception { | 277 class StringIndexOutOfBoundsException implements Exception { |
| 274 final int index; | 278 final int index; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 475 } |
| 472 | 476 |
| 473 bool javaSetAdd(Set s, o) { | 477 bool javaSetAdd(Set s, o) { |
| 474 if (!s.contains(o)) { | 478 if (!s.contains(o)) { |
| 475 s.add(o); | 479 s.add(o); |
| 476 return true; | 480 return true; |
| 477 } | 481 } |
| 478 return false; | 482 return false; |
| 479 } | 483 } |
| 480 | 484 |
| 485 javaMapPut(Map target, key, value) { |
| 486 var oldValue = target[key]; |
| 487 target[key] = value; |
| 488 return oldValue; |
| 489 } |
| 490 |
| 481 void javaMapPutAll(Map target, Map source) { | 491 void javaMapPutAll(Map target, Map source) { |
| 482 source.forEach((k, v) { | 492 source.forEach((k, v) { |
| 483 target[k] = v; | 493 target[k] = v; |
| 484 }); | 494 }); |
| 485 } | 495 } |
| 486 | 496 |
| 487 bool javaStringEqualsIgnoreCase(String a, String b) { | 497 bool javaStringEqualsIgnoreCase(String a, String b) { |
| 488 return a.toLowerCase() == b.toLowerCase(); | 498 return a.toLowerCase() == b.toLowerCase(); |
| 489 } | 499 } |
| 490 | 500 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 514 } | 524 } |
| 515 } else if (sb.length > newLength) { | 525 } else if (sb.length > newLength) { |
| 516 var s = sb.toString().substring(0, newLength); | 526 var s = sb.toString().substring(0, newLength); |
| 517 sb = new StringBuffer(s); | 527 sb = new StringBuffer(s); |
| 518 } | 528 } |
| 519 } | 529 } |
| 520 void clear() { | 530 void clear() { |
| 521 sb = new StringBuffer(); | 531 sb = new StringBuffer(); |
| 522 } | 532 } |
| 523 } | 533 } |
| 534 |
| 535 abstract class Enum<E> implements Comparable<E> { |
| 536 int get ordinal; |
| 537 String get name; |
| 538 } |
| OLD | NEW |