Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
🚀 Google AI PRO – 18 Months | Rs. 850 Only
lkkolla
Updated:
Yesterday at 4:56 PM
🔒 NordVPN Premium – 3 Months
hrdilshan
Updated:
Thursday at 8:29 PM
🚀 Microsoft Office 365 Pro Plus – Lifetime Access! 🚀
hrdilshan
Updated:
Thursday at 8:28 PM
Linkedin Premium Business / Careere /Sales Navigator - 1/2/3/6/9/12 Months - Reddem Link
hrdilshan
Updated:
Thursday at 8:27 PM
Colombo
YEYE 3 in 1 Instant Coffee Mix 50 Sachet
Romeshka
Updated:
Wednesday at 12:16 AM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Best Software Companies in Sri Lanka
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="DJvodka" data-source="post: 16496399" data-attributes="member: 186185"><p>Scala is very well mature enough to utilize it in production code now. Frameworks like play has direct support on Scala. Big players like LinkedIn, twitter, foursquare using it. About the java 8 vs Scala, IMO scala is miles ahead of java 8. See the following code:</p><p></p><p>[CODE]</p><p>package test;</p><p></p><p>public class Bean {</p><p> private int id;</p><p> private int age;</p><p> private String name;</p><p> private String address;</p><p></p><p> public Bean(int id, int age, String name, String address) {</p><p> this.id = id;</p><p> this.age = age;</p><p> this.name = name;</p><p> this.address = address;</p><p> }</p><p></p><p> public int getId() {</p><p> return id;</p><p> }</p><p></p><p> public void setId(int id) {</p><p> this.id = id;</p><p> }</p><p></p><p> public int getAge() {</p><p> return age;</p><p> }</p><p></p><p> public void setAge(int age) {</p><p> this.age = age;</p><p> }</p><p></p><p> public String getName() {</p><p> return name;</p><p> }</p><p></p><p> public void setName(String name) {</p><p> this.name = name;</p><p> }</p><p></p><p> public String getAddress() {</p><p> return address;</p><p> }</p><p></p><p> public void setAddress(String address) {</p><p> this.address = address;</p><p> }</p><p></p><p> @Override</p><p> public int hashCode() {</p><p> int hash = 7;</p><p> hash = 13 * hash + this.id;</p><p> return hash;</p><p> }</p><p></p><p> @Override</p><p> public boolean equals(Object obj) {</p><p> if (obj == null) {</p><p> return false;</p><p> }</p><p> if (getClass() != obj.getClass()) {</p><p> return false;</p><p> }</p><p> final Bean other = (Bean) obj;</p><p> if (this.id != other.id) {</p><p> return false;</p><p> }</p><p> if (this.age != other.age) {</p><p> return false;</p><p> }</p><p> if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {</p><p> return false;</p><p> }</p><p> if ((this.address == null) ? (other.address != null) : !this.address.equals(other.address)) {</p><p> return false;</p><p> }</p><p> return true;</p><p> }</p><p></p><p> @Override</p><p> public String toString() {</p><p> return "Bean{" + "id=" + id + ", age=" + age + ", name=" + name + ", address=" + address + '}';</p><p> }</p><p> </p><p>}</p><p>[/CODE]</p><p></p><p>Here is the Scala equivalent code: </p><p></p><p>[CODE]</p><p>case class Bean(id:Int, age:Int, name:String, address:String)</p><p>[/CODE] </p><p></p><p>84 lines of java boilerplate code reduced to one line of scala code. Less code you write, less errors will pop up. Also Java has lot of confusing error prone language constructs that can easily fool you if you're not careful. I looked in to Clojure, but the code looks less readable and cryptic to me.</p></blockquote><p></p>
[QUOTE="DJvodka, post: 16496399, member: 186185"] Scala is very well mature enough to utilize it in production code now. Frameworks like play has direct support on Scala. Big players like LinkedIn, twitter, foursquare using it. About the java 8 vs Scala, IMO scala is miles ahead of java 8. See the following code: [CODE] package test; public class Bean { private int id; private int age; private String name; private String address; public Bean(int id, int age, String name, String address) { this.id = id; this.age = age; this.name = name; this.address = address; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Override public int hashCode() { int hash = 7; hash = 13 * hash + this.id; return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Bean other = (Bean) obj; if (this.id != other.id) { return false; } if (this.age != other.age) { return false; } if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { return false; } if ((this.address == null) ? (other.address != null) : !this.address.equals(other.address)) { return false; } return true; } @Override public String toString() { return "Bean{" + "id=" + id + ", age=" + age + ", name=" + name + ", address=" + address + '}'; } } [/CODE] Here is the Scala equivalent code: [CODE] case class Bean(id:Int, age:Int, name:String, address:String) [/CODE] 84 lines of java boilerplate code reduced to one line of scala code. Less code you write, less errors will pop up. Also Java has lot of confusing error prone language constructs that can easily fool you if you're not careful. I looked in to Clojure, but the code looks less readable and cryptic to me. [/QUOTE]
Insert quotes…
Verification
Haya warak paha keeyada? (haya wadi kireema paha)
Post reply
Top
Bottom