/** Overridden for the same reason than {@link AbstractMap#equals(Object). */ @Override public boolean equals(final Object object) { if (object == this) { return true; } if (!(object instanceof Set<?>)) { return false; } final Set<?> that = (Set<?>) object; final EntryIterator<K,V> it = entryIterator(); if (it == null) { return that.isEmpty(); } int size = 0; while (it.next()) { if (!that.contains(it.getKey())) { return false; } size++; } return size == that.size(); } };
/** Overridden for the same reason than {@link AbstractMap#equals(Object). */ @Override public boolean equals(final Object object) { if (object == this) { return true; } if (!(object instanceof Set<?>)) { return false; } final Set<?> that = (Set<?>) object; final EntryIterator<K,V> it = entryIterator(); if (it == null) { return that.isEmpty(); } int size = 0; while (it.next()) { if (!that.contains(it.getKey())) { return false; } size++; } return size == that.size(); } };
/** * Returns the entry at the current iterator position. * This method is invoked only after {@link #next()}. * The default implementation creates an immutable entry with {@link #getKey()} and {@link #getValue()}. * * @return the entry at the current iterator position. */ protected Entry<K,V> getEntry() { return new java.util.AbstractMap.SimpleImmutableEntry<>(getKey(), getValue()); }
if (!it.getValue().equals(that.get(it.getKey()))) { return false;
if (!it.getValue().equals(that.get(it.getKey()))) { return false;
/** * Returns a string representation of this map. The default implementation is different than the * {@code java.util.AbstractMap} one, as it uses a tabular format rather than formatting all entries * on a single line. * * @return a string representation of this map. */ @Override public String toString() { final TableAppender buffer = new TableAppender(" = "); buffer.setMultiLinesCells(true); final EntryIterator<K,V> it = entryIterator(); if (it != null) while (it.next()) { buffer.append(String.valueOf(it.getKey())); buffer.nextColumn(); buffer.append(AbstractMapEntry.firstLine(it.getValue())); buffer.nextLine(); } return buffer.toString(); } }
/** * Returns a string representation of this map. The default implementation is different than the * {@code java.util.AbstractMap} one, as it uses a tabular format rather than formatting all entries * on a single line. * * @return a string representation of this map. */ @Override public String toString() { final TableAppender buffer = new TableAppender(" = "); buffer.setMultiLinesCells(true); final EntryIterator<K,V> it = entryIterator(); if (it != null) while (it.next()) { buffer.append(String.valueOf(it.getKey())); buffer.nextColumn(); buffer.append(AbstractMapEntry.firstLine(it.getValue())); buffer.nextLine(); } return buffer.toString(); } }
@Override public K next() {return entry().getKey();} }
@Override public K next() {return entry().getKey();} }
/** * Computes a hash code value for this map. * * @return a hash code value. */ @Override public int hashCode() { int code = 0; final EntryIterator<K,V> it = entryIterator(); if (it != null) while (it.next()) { code += (Objects.hashCode(it.getKey()) ^ Objects.hashCode(it.getValue())); } return code; }
/** * Computes a hash code value for this map. * * @return a hash code value. */ @Override public int hashCode() { int code = 0; final EntryIterator<K,V> it = entryIterator(); if (it != null) while (it.next()) { code += (Objects.hashCode(it.getKey()) ^ Objects.hashCode(it.getValue())); } return code; }
/** * Returns the entry at the current iterator position. * This method is invoked only after {@link #next()}. * The default implementation creates an immutable entry with {@link #getKey()} and {@link #getValue()}. * * @return the entry at the current iterator position. */ protected Entry<K,V> getEntry() { return new java.util.AbstractMap.SimpleImmutableEntry<>(getKey(), getValue()); }