SafeIterableMap implements Iterable<Map.Entry<K, V>> { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof SafeIterableMap)) { return false; } SafeIterableMap map = (SafeIterableMap) obj; if (this.size() != map.size()) { return false; } Iterator<Map.Entry<K, V>> iterator1 = iterator(); Iterator iterator2 = map.iterator(); while (iterator1.hasNext() && iterator2.hasNext()) { Map.Entry<K, V> next1 = iterator1.next(); Object next2 = iterator2.next(); if ((next1 == null && next2 != null) || (next1 != null && !next1.equals(next2))) { return false; } } return !iterator1.hasNext() && !iterator2.hasNext(); }  V putIfAbsent(@NonNull K key, @NonNull V v); V remove(@NonNull K key); int size(); @NonNull @Override Iterator<Map.Entry<K, V>> iterator(); Iterator<Map.Entry<K, V>> descendingIterator(); IteratorWithAdditions iteratorWithAdditions(); Map.Entry<K, V> eldest(); Map.Entry<K, V> newest(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testEquality8() { SafeIterableMap<Integer, Boolean> map1 = mapOf(); SafeIterableMap<Integer, Boolean> map2 = mapOf(); assertThat(map1.equals(map2), is(true)); }
@Test public void testEqualityRespectsOrder() { SafeIterableMap<Integer, Boolean> map1 = mapOf(1, 2, 3, 4); SafeIterableMap<Integer, Boolean> map2 = mapOf(1, 3, 2, 4); assertThat(map1.equals(map2), is(false)); }
@Test public void testEquality1() { SafeIterableMap<Integer, Integer> map1 = from(1, 2, 3, 4).to(10, 20, 30, 40); SafeIterableMap<Integer, Integer> map2 = from(1, 2, 3, 4).to(10, 20, 30, 40); assertThat(map1.equals(map2), is(true)); }
@Test public void testEquality2() { SafeIterableMap<Integer, Boolean> map = mapOf(1, 2, 3, 4); assertThat(map.equals(null), is(false)); }
@Test public void testEquality3() { SafeIterableMap<Integer, Boolean> map = mapOf(1, 2, 3, 4); assertThat(map.equals(new ArrayList<>()), is(false)); }
@Test public void testEquality4() { SafeIterableMap<Integer, Boolean> map = mapOf(1, 2, 3, 4); assertThat(map.equals(new SafeIterableMap<Integer, Boolean>()), is(false)); }
@Test public void testEquality5() { SafeIterableMap<Integer, Boolean> map1 = mapOf(1, 2, 3, 4); SafeIterableMap<Integer, Boolean> map2 = mapOf(1); assertThat(map1.equals(map2), is(false)); }
@Test public void testEquality6() { SafeIterableMap<Integer, Boolean> map1 = mapOf(1, 2, 3, 4); SafeIterableMap<Integer, Boolean> map2 = mapOf(1, 2, 3, 5); assertThat(map1.equals(map2), is(false)); }
@Test public void testEquality7() { SafeIterableMap<Integer, Integer> map1 = from(1, 2, 3, 4).to(1, 2, 3, 4); SafeIterableMap<Integer, Integer> map2 = from(1, 2, 3, 4).to(1, 2, 3, 5); assertThat(map1.equals(map2), is(false)); }