[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-573204-105":53,"doc-detail-573204-en":126},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":119,"head_meta":121,"extra_data":123,"updated_unix":125},105,"en","scala-cheat-sheet-v01","Scala - Cheat Sheet - v.0.1","","Scala cheat sheet v.0.1 providing a compact reference for core language concepts and idioms. Covers package scoping and nested packages, import styles including wildcard and renamed members, variable and constant conventions (val vs var, defaults, null/Unit), and type foundations for AnyVal/AnyRef. Includes guidance on singleton objects, trait mixins, generic classes, inner classes and type binding, case classes reference notes, method/function forms, anonymous functions, operator rules and associativity, arrays, main entry point, and basic selection and iteration patterns.",{"@graph":63,"@context":118},[64,80,101],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/scala-cheat-sheet-v01/573204/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/scala-cheat-sheet-v01/573204.png","ImageObject",442,249,{"name":88,"@type":89},"Logic","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-18","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":73},"InteractionCounter",{"@type":100},"ViewAction",{"@type":102,"mainEntity":103},"FAQPage",[104,110,114],{"name":105,"@type":106,"acceptedAnswer":107},"What does the document say about package scoping in Scala?","Question",{"text":108,"@type":109},"It shows a curly-brace delimited package structure and notes that import/package relevance can be scoped within the file, not only at the top.","Answer",{"name":111,"@type":106,"acceptedAnswer":112},"How are imports structured, and what does wildcard import mean here?",{"text":113,"@type":109},"It lists import p._ to import all members of p, import p.x for a specific member, and import p.{x => a} for renaming, plus shorthand forms for multiple packages.",{"name":115,"@type":106,"acceptedAnswer":116},"What operator associativity rule does the cheat sheet provide?",{"text":117,"@type":109},"It states that operators are usually left-associative, but operators ending with ':' are right-associative, with '::' given as the example for list-consing.","https://schema.org",{"og:url":78,"og:type":120,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":122,"canonical":78},"index,follow",{"doc_id":124,"site_id":56},573204,1792359733,{"code":4,"msg":5,"data":127},{"doc_id":124,"user_id":128,"nickname":88,"user_avatar":129,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":73,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":135,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":136,"faqs":137,"seo_title":138,"seo_description":61,"update_tm":139,"read_time":9},1099513958762,"https://ap-avatar.wpscdn.com/avatar/1000023916a998db790?x-image-process=image/resize,m_fixed,w_180,h_180&k=1784791008015729253","=Scala=  \nCHEAT SHEET v.0.1 “Every value is an object & every operation is a message send.”  \nPACKAGE  \nJava style:  \npackage com.mycompany .mypkg applies across the entire file scope  \nPackage \"scoping\" approach: curly brace delimited package com  \n{  \npackage mycompany {  \npackage scala  \n{  \npackage demo  \n{  \nobject HelloWorld  \n{  \nimport java .math .BigInteger // just to show nested importing def main(args : Array[String]) :  \nUnit =  \n{ Console .println(\"Hello there!\")}  \n}  \n}  \n}  \n}  \n}  \nIMPORT  \nimport p ._ // imports all members of p  \n// (this is analogous to import p .* in Java)  \nimport p .x // the member x of p  \nimport p . {x => a} // the member x of p renamed // as aimport p . {x, y} // the members x and y of p  \nimport p1 .p2 . z // the member z of p2,  \n// itself member of p1  \nimport p1 ._ , p2 ._ // is a shorthand for import // p1 ._ ; import p2 ._  \nimplicit imports:  \nthe package java .lang  \nthe package scala  \nand the object scala .Predef  \nImport anywhere inside the client Scala file, not just at the top of the file, for scoped relevance, see example in Package section.  \nVARIABLE  \nvar var_name: type = init_value;  \neg. var i : int = 0;  \ndefault values:  \nprivate var myvar: T = _ // \"_ \" is a default value  \nscala .Unit is similar to void in Java, except Unit can be assigned the () value.  \nunnamed2: Unit = ()  \ndefault values:  \n0 for numeric types false for the Boolean type () for the Unit type  \nnull for all object types  \nCONSTANT  \nPrefer val over var.  \nform: val var_name: type = init_value;  \nval i : int = 0;  \nSTATIC  \nNo static members, use Singleton, see Object  \nCLASS  \nEvery class inherits from scala.Any  \n2 subclass categories:  \nscala .AnyVal (maps to java. lang.Object) scala .AnyRef  \nform: abstract class(pName: PType1, pName2: PType2 . . . ) extends SuperClass with optional constructor in the class definition: class Person(name: String, age: int) extends Mammal {  \n// secondary constructor  \ndef this(name: String) {  \n// calls to the \"primary\" constructor this(name, 1);  \n}  \n// members here}  \npredefined function classOf[T] returns Scala class type T  \nOBJECT  \nA concrete class instance and is a singleton. object RunRational extends Application {  \n// members here}  \nMIXIN CLASS COMPOSITION  \nMixin:  \ntrait RichIterator extends AbsIterator { def foreach(f: T => Unit) {  \nwhile (hasNext) f(next)}  \n}  \nMixin Class Composition:  \nThe first parent is called the superclass of Iter, whereas the second (and every other, if present) parent is called a mixin.  \nobject StringIteratorTest { def main(args: Array[String]) {  \nclass Iter extends StringIterator(args(0)) with RichIterator  \nval iter = new Iter  \niter foreach println}  \n}  \nnote the keyword \"with\" used to create a mixin composition of the parents StringIterator and RichIterator.  \nTRAITS  \nLike Java interfaces, defines object types by specifying method signatures, can be partially implemented. See example in Mixin.  \nGENERIC CLASS  \nclass Stack[T] {// members here  \n}  \nUsage:  \nobject GenericsTest extends Application { val stack = new Stack[Int]// do stuff here  \n}  \nnote: can also define generic methods  \nINNER CLASS  \nexample:  \nclass Graph { class Node {  \nvar connectedNodes: List[Node] = Nil  \ndef connectTo(node: Node) {  \nif  \n(connectedNodes .find(node .equals) .isEmpty) { connectedNodes = node :: connectedNodes  \n}  \n}  \n}  \n// members here}  \nusage:  \nobject GraphTest extends Application { val g: Graph = new Graph  \nval n1: g .Node = g .newNode  \nval n2: g .Node = g .newNode  \nn1 .connectTo(n2) // legal  \nval h: Graph = new Graph  \nval n3: h .Node = h .newNode  \nn1 .connectTo(n3) // illegal!  \n}  \nInner classes are bound to the outer object, so anode type is prefixed with its outer instance and can't mix instances.  \nCASE CLASSES  \nSee [http://www.scala-lang.org/node/107](http://www.scala-lang.org/node/107 for)[ for](http://www.scala-lang.org/node/107 for) info.  \nMETHODS/FUNCTIONS  \nMethods are Functional Values and Fun","cbCaie0iwZKkuANf","https://ap.wps.com/l/cbCaie0iwZKkuANf","pdf",120555,"English","# Package\n## Import\n## Variable\n## Constant\n## Static and Object\n## Class, Traits, and Mixin Composition\n## Generic and Inner Classes\n## Methods and Functions\n## Operators\n## Arrays\n## Main\n## Annotations\n## Assignment\n## Selection\n## Iteration","[{\"question\":\"What does the document say about package scoping in Scala?\",\"answer\":\"It shows a curly-brace delimited package structure and notes that import/package relevance can be scoped within the file, not only at the top.\"},{\"question\":\"How are imports structured, and what does wildcard import mean here?\",\"answer\":\"It lists import p._ to import all members of p, import p.x for a specific member, and import p.{x =\\u003e a} for renaming, plus shorthand forms for multiple packages.\"},{\"question\":\"What operator associativity rule does the cheat sheet provide?\",\"answer\":\"It states that operators are usually left-associative, but operators ending with ':' are right-associative, with '::' given as the example for list-consing.\"}]","Scala - Cheat Sheet - v.0.1 | PDF",1791934476]