@Override default int compareTo(final Relationship o) { return compare("internalTimestamp", this, o); } }
default int compare(final String key, final PropertyContainer a, final PropertyContainer b) { if (!a.hasProperty(key) && b.hasProperty(key)) { return -1; } if (a.hasProperty(key) && !b.hasProperty(key)) { return 1; } if (a.hasProperty(key) && b.hasProperty(key)) { final String t1 = (String)a.getProperty(key); final String t2 = (String)b.getProperty(key); int result = t1.compareTo(t2); if (result != 0) { return result; } } // do not return 0 since that would cause objects without the // above property to be considered equal which is not wanted. return Long.valueOf(a.getId()).compareTo(b.getId()); } }