1. Список говнокодов пользователя lameduck

    Всего: 1

  2. Java / Говнокод #18641

    −11

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    private static <T extends Comparable<T>> int compareTo(final T c1, final T c2) {
    		final boolean f1, f2;
    		return (f1 = c1 == null) ^ (f2 = c2 == null) ? f1 ? -1 : 1 : f1 && f2 ? 0 : c1.compareTo(c2);
    	}
    
          BigDecimal newDiscountPrice = .....;
          BigDecimal oldDiscountPrice = ......;
          if (compareTo(newDiscountPrice, oldDiscountPrice) != 0) {
              ....
          }

    Видимо ObjectUtils.notEqual(newDiscountPrice, oldDiscountPrice) или старого доброго
    !(newDiscountPrice==null? oldDiscountPrice==null: newDiscountPrice.equals(oldDiscountPrice ))
    недостаточно)

    lameduck, 27 Августа 2015

    Комментарии (17)