| 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 | 4 |
| 5 final Stopwatch nanoTimeStopwatch = new Stopwatch(); | 5 final Stopwatch nanoTimeStopwatch = new Stopwatch(); |
| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 final StringBuffer _sb = new StringBuffer(); | 222 final StringBuffer _sb = new StringBuffer(); |
| 223 | 223 |
| 224 void print(x) { | 224 void print(x) { |
| 225 _sb.write(x); | 225 _sb.write(x); |
| 226 } | 226 } |
| 227 | 227 |
| 228 String toString() => _sb.toString(); | 228 String toString() => _sb.toString(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 class StringUtils { | 231 class StringUtils { |
| 232 static List<String> split(String s, [String pattern = '']) => s.split(pattern)
; | 232 static String capitalize(String str) { |
| 233 static String replace(String s, String from, String to) => s.replaceAll(from,
to); | 233 if (isEmpty(str)) { |
| 234 return str; |
| 235 } |
| 236 return str.substring(0, 1).toUpperCase() + str.substring(1); |
| 237 } |
| 238 |
| 239 static bool equals(String cs1, String cs2) { |
| 240 if (cs1 == cs2) { |
| 241 return true; |
| 242 } |
| 243 if (cs1 == null || cs2 == null) { |
| 244 return false; |
| 245 } |
| 246 return cs1 == cs2; |
| 247 } |
| 248 |
| 249 static bool isEmpty(String str) { |
| 250 return str == null || str.isEmpty; |
| 251 } |
| 252 |
| 253 static String join(Iterable iter, [String separator = ' ', int start = 0, int |
| 254 end = -1]) { |
| 255 if (start != 0) { |
| 256 iter = iter.skip(start); |
| 257 } |
| 258 if (end != -1) { |
| 259 iter = iter.take(end - start); |
| 260 } |
| 261 return iter.join(separator); |
| 262 } |
| 263 |
| 264 static String remove(String str, String remove) { |
| 265 if (isEmpty(str) || isEmpty(remove)) { |
| 266 return str; |
| 267 } |
| 268 return str.replaceAll(remove, ''); |
| 269 } |
| 270 |
| 271 static String removeStart(String str, String remove) { |
| 272 if (isEmpty(str) || isEmpty(remove)) { |
| 273 return str; |
| 274 } |
| 275 if (str.startsWith(remove)) { |
| 276 return str.substring(remove.length); |
| 277 } |
| 278 return str; |
| 279 } |
| 280 |
| 234 static String repeat(String s, int n) { | 281 static String repeat(String s, int n) { |
| 235 StringBuffer sb = new StringBuffer(); | 282 StringBuffer sb = new StringBuffer(); |
| 236 for (int i = 0; i < n; i++) { | 283 for (int i = 0; i < n; i++) { |
| 237 sb.write(s); | 284 sb.write(s); |
| 238 } | 285 } |
| 239 return sb.toString(); | 286 return sb.toString(); |
| 240 } | 287 } |
| 241 static String join(Iterable iter, [String separator = " "]) { | 288 |
| 242 return iter.join(separator); | 289 static List<String> split(String s, [String pattern = '']) { |
| 290 return s.split(pattern); |
| 291 } |
| 292 |
| 293 static List<String> splitByWholeSeparatorPreserveAllTokens(String s, String |
| 294 pattern) { |
| 295 return s.split(pattern); |
| 243 } | 296 } |
| 244 } | 297 } |
| 245 | 298 |
| 246 class Math { | 299 class Math { |
| 247 static num max(num a, num b) => math.max(a, b); | 300 static num max(num a, num b) => math.max(a, b); |
| 248 static num min(num a, num b) => math.min(a, b); | 301 static num min(num a, num b) => math.min(a, b); |
| 249 } | 302 } |
| 250 | 303 |
| 251 class RuntimeException extends JavaException { | 304 class RuntimeException extends JavaException { |
| 252 RuntimeException({String message: "", Exception cause: null}) : | 305 RuntimeException({String message: "", Exception cause: null}) : |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 if (!_matches.moveNext()) { | 515 if (!_matches.moveNext()) { |
| 463 return false; | 516 return false; |
| 464 } | 517 } |
| 465 _match = _matches.current; | 518 _match = _matches.current; |
| 466 return true; | 519 return true; |
| 467 } | 520 } |
| 468 String group(int i) => _match[i]; | 521 String group(int i) => _match[i]; |
| 469 int start() => _match.start; | 522 int start() => _match.start; |
| 470 int end() => _match.end; | 523 int end() => _match.end; |
| 471 } | 524 } |
| OLD | NEW |