@Override protected void assertMoreInvariants(Map<String, Integer> map) { BiMap<String, Integer> bimap = (BiMap<String, Integer>) map; BiMap<Integer, String> inverse = bimap.inverse(); assertEquals(bimap.size(), inverse.size()); for (Entry<String, Integer> entry : bimap.entrySet()) { assertEquals(entry.getKey(), inverse.get(entry.getValue())); } for (Entry<Integer, String> entry : inverse.entrySet()) { assertEquals(entry.getKey(), bimap.get(entry.getValue())); } }
public InetAddress getFirstEndpoint() { assert tokenToEndPointMap.size() > 0; lock.readLock().lock(); try { return tokenToEndPointMap.get(sortedTokens.get(0)); } finally { lock.readLock().unlock(); } }