Commits

Stepan Koltsov  committed a574c8f

getOrThrow without "message" parameter ("apply" replacement)

  • Participants
  • Parent commits 8dc0eb5

Comments (0)

Files changed (2)

File src/main/java/ru/yandex/bolts/collection/MapF.java

 
     boolean containsEntry(Entry<K, V> entry);
 
+    /**
+     * Use {@link #getOrThrow(Object)} instead.
+     */
+    V apply(K key) throws NoSuchElementException;
+
     /** Throws if there is no entry for key */
-    V apply(K key) throws NoSuchElementException;
+    V getOrThrow(K key) throws NoSuchElementException;
 
     MapF<K, V> filterKeys(Function1B<? super K> p);
 

File src/main/java/ru/yandex/bolts/collection/impl/AbstractMapF.java

 import java.io.Serializable;
 import java.util.AbstractMap;
 import java.util.Map;
+import java.util.NoSuchElementException;
 
 import ru.yandex.bolts.collection.CollectionF;
 import ru.yandex.bolts.collection.CollectionsF;
     }
 
     public V apply(K key) {
+        return getOrThrow(key);
+    }
+
+    public V getOrThrow(K key) {
         return getO(key).get();
     }