![]() Note that expression pf.applyOrElse(x, default) is equivalent to if(pf isDefinedAt x) pf(x) else default(x)Įxcept that applyOrElse method can be implemented more efficiently.įor all partial function literals the compiler generates an applyOrElse implementation whichĪvoids double evaluation of pattern matchers and guards. Definition Classes rootĭefaultSerializable, java.io.Serializable, StrictOptimizedMapOps], StrictOptimizedIterableOps Iterable, LinkedHashMap], SeqMap, collection.SeqMap, AbstractMap, Map, MapOps LinkedHashMap, LinkedHashMap], Shrinkable, Builder], Growable, Clearable, Cloneable],, Iterable, collection.AbstractMap, collection.Map, Equals, MapFactoryDefaults LinkedHashMap, Iterable], collection.MapOps LinkedHashMap, LinkedHashMap], PartialFunction, ( K) => V, collection.AbstractIterable, collection.Iterable, IterableFactoryDefaults Iterable], IterableOps Iterable, LinkedHashMap], IterableOnceOps Iterable, LinkedHashMap], IterableOnce, AnyRef, AnyĪpplies this partial function to the given argument when it is contained in the function domain.Īpplies fallback function where this partial function is not defined. For example, on the JVM, String is an alias for. ![]() Other aliases refer to classes provided by the underlying platform. Some of these identifiers are type aliases provided as shortcuts to commonly used classes. Identifiers in the scala package and the scala.Predef object are always in scope by default. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |