| 359 | } |
| 360 | |
| 361 | public static Object add(Object a, Object b) { |
| 362 | a = normalizeIntIfNeeded(a); |
| 363 | b = normalizeIntIfNeeded(b); |
| 364 | |
| 365 | if (a instanceof Long && b instanceof Long) { |
| 366 | return ((Long) a) + ((Long) b); |
| 367 | } else if (a instanceof Double || b instanceof Double) { |
| 368 | return toDouble(a) + toDouble(b); |
| 369 | } else if (a instanceof String && b instanceof String) { |
| 370 | return ((String) a) + ((String) b); |
| 371 | } else if (a instanceof String || b instanceof String) { |
| 372 | return String.valueOf(a) + String.valueOf(b); |
| 373 | } |
| 374 | |
| 375 | return null; |
| 376 | } |
| 377 | |
| 378 | public static String add(String a, String b) { |
| 379 | return a + b; |