715 }
716
717 // ise thrown from function is not a cme.
718 v = function.apply(k, v);
719
720 try {
721 entry.setValue(v);
722 } catch (IllegalStateException ise) {
723 // this usually means the entry is no longer in the map.
724 throw new ConcurrentModificationException(ise);
725 }
726 }
727 }
728
729 /**
730 * If the specified key is not already associated with a value (or is mapped
731 * to {@code null}) associates it with the given value and returns
732 * {@code null}, else returns the current value.
733 *
734 * @implSpec
735 * The default implementation is equivalent to, for this {@code
736 * map}:
737 *
738 * <pre> {@code
739 * V v = map.get(key);
740 * if (v == null)
741 * v = map.put(key, value);
742 *
743 * return v;
744 * }</pre>
745 *
746 * <p>The default implementation makes no guarantees about synchronization
747 * or atomicity properties of this method. Any implementation providing
748 * atomicity guarantees must override this method and document its
749 * concurrency properties.
750 *
751 * @param key key with which the specified value is to be associated
752 * @param value value to be associated with the specified key
753 * @return the previous value associated with the specified key, or
754 * {@code null} if there was no mapping for the key.
755 * (A {@code null} return can also indicate that the map
756 * previously associated {@code null} with the key,
|
715 }
716
717 // ise thrown from function is not a cme.
718 v = function.apply(k, v);
719
720 try {
721 entry.setValue(v);
722 } catch (IllegalStateException ise) {
723 // this usually means the entry is no longer in the map.
724 throw new ConcurrentModificationException(ise);
725 }
726 }
727 }
728
729 /**
730 * If the specified key is not already associated with a value (or is mapped
731 * to {@code null}) associates it with the given value and returns
732 * {@code null}, else returns the current value.
733 *
734 * @implSpec
735 * The default implementation is equivalent to, for this {@code map}:
736 *
737 * <pre> {@code
738 * V v = map.get(key);
739 * if (v == null)
740 * v = map.put(key, value);
741 *
742 * return v;
743 * }</pre>
744 *
745 * <p>The default implementation makes no guarantees about synchronization
746 * or atomicity properties of this method. Any implementation providing
747 * atomicity guarantees must override this method and document its
748 * concurrency properties.
749 *
750 * @param key key with which the specified value is to be associated
751 * @param value value to be associated with the specified key
752 * @return the previous value associated with the specified key, or
753 * {@code null} if there was no mapping for the key.
754 * (A {@code null} return can also indicate that the map
755 * previously associated {@code null} with the key,
|