/** 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.getEntry())) { return false; } size++; } return size == that.size(); } };
/** * Removes the current entry. */ public final void remove() { if (hasNext == AFTER_NEXT) { hasNext = 0; iterator.remove(); } else { throw new IllegalStateException(); } } }
/** 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(); } };
/** 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.getEntry())) { return false; } size++; } return size == that.size(); } };
/** * 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(); } }
/** * Returns {@code true} if this map contains the given value. * The default implementation iterates over all values using the {@link #entryIterator()}. * * @param value the value for which to test the presence. * @return {@code true} if the map contains the given value. */ @Override public boolean containsValue(final Object value) { final EntryIterator<K,V> it = entryIterator(); if (it != null) while (it.next()) { if (it.getValue().equals(value)) { return true; } } return false; }
/** * Returns {@code true} if this map contains the given value. * The default implementation iterates over all values using the {@link #entryIterator()}. * * @param value the value for which to test the presence. * @return {@code true} if the map contains the given value. */ @Override public boolean containsValue(final Object value) { final EntryIterator<K,V> it = entryIterator(); if (it != null) while (it.next()) { if (it.getValue().equals(value)) { return true; } } return false; }
@Override public Entry<K,V> next() {return entry().getEntry();} }
/** * Returns {@code true} if there is at least one more element to return. */ public final boolean hasNext() { switch (hasNext) { case TRUE: return true; case FALSE: return false; default: { final boolean c = iterator.next(); hasNext = c ? TRUE : FALSE; return c; } } }
@Override public Entry<K,V> next() {return entry().getEntry();} }
/** * 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 {@code true} if there is at least one more element to return. */ public final boolean hasNext() { switch (hasNext) { case TRUE: return true; case FALSE: return false; default: { final boolean c = iterator.next(); hasNext = c ? TRUE : FALSE; return c; } } }
@Override public K next() {return entry().getKey();} }
@Override public V next() {return entry().getValue();} }
@Override public V next() {return entry().getValue();} }
@Override public K next() {return entry().getKey();} }