@Test public void testIntegerVSInteger() throws Exception { final Value nroZero = new Value( 0 ); final Value nroOne = new Value( 1 ); assertTrue( nroZero.compareTo( nroOne ) < 0 ); assertTrue( nroOne.compareTo( nroZero ) > 0 ); }
@Override public int compareTo(final Value value) { if (comparable == null && value.comparable == null) { return 0; } else if (comparable == null) { return -1; } else if (value.comparable == null) { return 1; } else { try { return this.comparable.compareTo(value.comparable); } catch (final ClassCastException cce) { return this.comparable.toString().compareTo(value.comparable.toString()); } } }
Value implements Comparable<Value> { @Override public int compareTo(final Value value) { if (comparable == null && value.comparable == null) { return 0; } else if (comparable == null) { return -1; } else if (value.comparable == null) { return 1; } else { try { return this.comparable.compareTo(value.comparable); } catch (final ClassCastException cce) { return this.comparable.toString().compareTo(value.comparable.toString()); } } } }
Value implements Comparable<Value> { @Override public int compareTo(final Value value) { if (comparable == null && value.comparable == null) { return 0; } else if (comparable == null) { return -1; } else if (value.comparable == null) { return 1; } else { try { return this.comparable.compareTo(value.comparable); } catch (final ClassCastException cce) { return this.comparable.toString().compareTo(value.comparable.toString()); } } } Value(final Comparable comparable); }
Value implements Comparable<Value> { @Override public int compareTo(final Value value) { if (comparable == null && value.comparable == null) { return 0; } else if (comparable == null) { return -1; } else if (value.comparable == null) { return 1; } else { try { return this.comparable.compareTo(value.comparable); } catch (final ClassCastException cce) { return this.comparable.toString().compareTo(value.comparable.toString()); } } } Value(final Comparable comparable); Comparable getComparable(); @Override String toString(); @Override int compareTo(final Value value); }
Value implements Comparable<Value> { @Override public int compareTo(final Value value) { if (comparable == null && value.comparable == null) { return 0; } else if (comparable == null) { return -1; } else if (value.comparable == null) { return 1; } else { try { return this.comparable.compareTo(value.comparable); } catch (final ClassCastException cce) { return this.comparable.toString().compareTo(value.comparable.toString()); } } } Value(final Comparable comparable); Comparable getComparable(); @Override String toString(); @Override int compareTo(final Value value);  }