@Test public void testCompareTo() { List<NodeInterfacePair> ordered = ImmutableList.of( NodeInterfacePair.of("a", "a"), NodeInterfacePair.of("a", "b"), NodeInterfacePair.of("b", "a"), NodeInterfacePair.of("b", "b")); for (int i = 0; i < ordered.size(); i++) { for (int j = 0; j < ordered.size(); j++) { assertThat( Integer.signum(ordered.get(i).compareTo(ordered.get(j))), equalTo(Integer.signum(i - j))); } } }
@Override public int compareTo(NodeInterfacePair other) { int hostCmp = _hostname.compareTo(other._hostname); return hostCmp != 0 ? hostCmp : _interfaceName.compareTo(other._interfaceName); }
NodeInterfacePair implements Serializable, Comparable<NodeInterfacePair> { @Override public int compareTo(NodeInterfacePair other) { int hostCmp = _hostname.compareTo(other._hostname); return hostCmp != 0 ? hostCmp : _interfaceName.compareTo(other._interfaceName); } }
NodeInterfacePair implements Serializable, Comparable<NodeInterfacePair> { @Override public int compareTo(NodeInterfacePair other) { int hostCmp = _hostname.compareTo(other._hostname); return hostCmp != 0 ? hostCmp : _interfaceName.compareTo(other._interfaceName); } private  NodeInterfacePair(String hostname, String interfaceName); }
NodeInterfacePair implements Serializable, Comparable<NodeInterfacePair> { @Override public int compareTo(NodeInterfacePair other) { int hostCmp = _hostname.compareTo(other._hostname); return hostCmp != 0 ? hostCmp : _interfaceName.compareTo(other._interfaceName); } private  NodeInterfacePair(String hostname, String interfaceName); static NodeInterfacePair of(String hostname, String interfaceName); static NodeInterfacePair of(Interface iface); @JsonProperty(PROP_HOSTNAME) @Nonnull String getHostname(); @JsonProperty(PROP_INTERFACE) @Nonnull String getInterface(); @Override String toString(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override int compareTo(NodeInterfacePair other); }
NodeInterfacePair implements Serializable, Comparable<NodeInterfacePair> { @Override public int compareTo(NodeInterfacePair other) { int hostCmp = _hostname.compareTo(other._hostname); return hostCmp != 0 ? hostCmp : _interfaceName.compareTo(other._interfaceName); } private  NodeInterfacePair(String hostname, String interfaceName); static NodeInterfacePair of(String hostname, String interfaceName); static NodeInterfacePair of(Interface iface); @JsonProperty(PROP_HOSTNAME) @Nonnull String getHostname(); @JsonProperty(PROP_INTERFACE) @Nonnull String getInterface(); @Override String toString(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override int compareTo(NodeInterfacePair other);  }