| 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 495 } |
| 496 | 496 |
| 497 bool javaSetAdd(Set s, o) { | 497 bool javaSetAdd(Set s, o) { |
| 498 if (!s.contains(o)) { | 498 if (!s.contains(o)) { |
| 499 s.add(o); | 499 s.add(o); |
| 500 return true; | 500 return true; |
| 501 } | 501 } |
| 502 return false; | 502 return false; |
| 503 } | 503 } |
| 504 | 504 |
| 505 bool javaCollectionContainsAll(Iterable list, Iterable c) { |
| 506 return c.fold(true, (bool prev, e) => prev && list.contains(e)); |
| 507 } |
| 508 |
| 505 javaMapPut(Map target, key, value) { | 509 javaMapPut(Map target, key, value) { |
| 506 var oldValue = target[key]; | 510 var oldValue = target[key]; |
| 507 target[key] = value; | 511 target[key] = value; |
| 508 return oldValue; | 512 return oldValue; |
| 509 } | 513 } |
| 510 | 514 |
| 511 void javaMapPutAll(Map target, Map source) { | 515 void javaMapPutAll(Map target, Map source) { |
| 512 source.forEach((k, v) { | 516 source.forEach((k, v) { |
| 513 target[k] = v; | 517 target[k] = v; |
| 514 }); | 518 }); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 abstract class Enum<E extends Enum> implements Comparable<E> { | 559 abstract class Enum<E extends Enum> implements Comparable<E> { |
| 556 /// The name of this enum constant, as declared in the enum declaration. | 560 /// The name of this enum constant, as declared in the enum declaration. |
| 557 final String name; | 561 final String name; |
| 558 /// The position in the enum declaration. | 562 /// The position in the enum declaration. |
| 559 final int ordinal; | 563 final int ordinal; |
| 560 Enum(this.name, this.ordinal); | 564 Enum(this.name, this.ordinal); |
| 561 int get hashCode => ordinal; | 565 int get hashCode => ordinal; |
| 562 String toString() => name; | 566 String toString() => name; |
| 563 int compareTo(E other) => ordinal - other.ordinal; | 567 int compareTo(E other) => ordinal - other.ordinal; |
| 564 } | 568 } |
| 569 |
| 570 class JavaPatternMatcher { |
| 571 Iterator<Match> _matches; |
| 572 Match _match; |
| 573 JavaPatternMatcher(RegExp re, String input) { |
| 574 _matches = re.allMatches(input).iterator; |
| 575 } |
| 576 bool find() { |
| 577 if (!_matches.moveNext()) { |
| 578 return false; |
| 579 } |
| 580 _match = _matches.current; |
| 581 return true; |
| 582 } |
| 583 String group(int i) => _match[i]; |
| 584 int start() => _match.start; |
| 585 int end() => _match.end; |
| 586 } |
| OLD | NEW |