@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)); }
@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(); }
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(); } }
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(); }  }
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(); }
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();  }