<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pro-Tek Blog &#187; Java platform</title>
	<atom:link href="http://www.pro-tekconsulting.com/blog/category/java-platform/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pro-tekconsulting.com/blog</link>
	<description>For UI developers / UI designers and UI trends</description>
	<lastBuildDate>Thu, 05 Sep 2019 03:59:47 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.34</generator>
	<item>
		<title>HOW DO YOU CLONE AN OBJECT?</title>
		<link>http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/</link>
		<comments>http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/#comments</comments>
		<pubDate>Fri, 09 Mar 2018 02:11:30 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Java platform]]></category>
		<category><![CDATA[Clone an Object]]></category>

		<guid isPermaLink="false">http://www.pro-tekconsulting.com/blog/?p=2437</guid>
		<description><![CDATA[<p>How do you clone an object? var obj = {a: 1 ,b: 2} var objclone = Object.assign({},obj); Now the value of objclone is {a: 1 ,b: 2} but points to a different object than obj. Note the potential pitfall, though: Object.clone() will just do a shallow copy, not a deep copy. This means that nested [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/">HOW DO YOU CLONE AN OBJECT?</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h4>How do you clone an object?</h4>
<p>var obj = {a: 1 ,b: 2}<br />
var objclone = Object.assign({},obj);<br />
Now the value of objclone is {a: 1 ,b: 2} but points to a different object than obj.<br />
Note the potential pitfall, though: Object.clone() will just do a shallow copy, not a deep copy. This means that nested objects aren’t copied. They still refer to the same nested objects as the original:<br />
let obj = {<br />
a: 1,<br />
b: 2,<br />
c: {<br />
age: 30<br />
}<br />
};</p>
<p>var objclone = Object.assign({},obj);<br />
console.log(&#8216;objclone: &#8216;, objclone);</p>
<p>console.log(&#8216;After Change &#8211; obj: &#8216;, obj); // 45 &#8211; This also changes<br />
console.log(&#8216;After Change &#8211; objclone: &#8216;, objclone); // 45</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/">HOW DO YOU CLONE AN OBJECT?</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pro-tekconsulting.com/blog/how-do-you-clone-an-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GROOVY PROGRAMMING LANGUAGE</title>
		<link>http://www.pro-tekconsulting.com/blog/groovy-programming-language/</link>
		<comments>http://www.pro-tekconsulting.com/blog/groovy-programming-language/#comments</comments>
		<pubDate>Thu, 14 Sep 2017 02:25:23 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Java platform]]></category>
		<category><![CDATA[Groovy Programming Language]]></category>

		<guid isPermaLink="false">http://www.pro-tekconsulting.com/blog/?p=2178</guid>
		<description><![CDATA[<p>Groovy Programming Language The only thing constant in this world is change! In the 1990s, Java shook up the computing world by bringing managed runtime (virtual machines) to mainstream programming. Today, there are many new languages emerging to replace languages that are popular. Do you know that there are more than two hundred languages that [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/groovy-programming-language/">GROOVY PROGRAMMING LANGUAGE</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h4>Groovy Programming Language</h4>
<p>The only thing constant in this world is change! In the 1990s, Java shook up the computing world by bringing managed runtime (virtual machines) to mainstream programming. Today, there are many new languages emerging to replace languages that are popular.</p>
<p>Do you know that there are more than two hundred languages that target the Java platform? Languages like Scala, Clojure, Groovy, and JRuby are few important languages that target the Java platform. Of these, of interest to us is Groovy since it is getting extensive attention and gaining steady popularity in the last few years. So explore this article and know more about Groovy.</p>
<p><strong>MEET GROOVY </strong></p>
<p>Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. If you are familiar with languages like Java, C/C++, Python, Ruby, or JavaScript, then you will see many resemblances in Groovy. Groovy code is compiled to byte code that is executed by the Java Virtual Machine (JVM). Groovy programming language is always known for its simplicity and flexibility, as-well-as the performance and stability of the JVM. As Groovy is compiled to byte code that runs on the JVM Java Virtual Machine (JVM), most of the Java code is valid for Groovy and the standard Java libraries are available to Groovy programs.</p>
<p>The user can write Groovy code online and can execute it too quickly to play around with some snippets. Please notice, that the playground currently has some limitations, like System.out.println is not working.</p>
<p><strong>HELLO WORLD </strong></p>
<p>Groovy nearly is a superset of Java, which means most of the Java code is also valid in Groovy code. It just adds a lot of syntactic sugar on top of Java. Let’s see a short example.</p>
<p><strong>System.out.println(&#8220;Hello World&#8221;);</strong></p>
<p>This would be valid in Java and Groovy. Except that the user would need at least a class with a main method around it in Java to run. In Groovy user can just place this inside a file, execute it through the console and it will start working. But in Groovy we can shorten this line to:</p>
<p><strong>println &#8220;Hello World&#8221;</strong></p>
<p><strong>VARIABLES</strong></p>
<p>In contrast to Java, user can also use dynamic typing in Groovy. To define a variable, use the keyword “def”. That way Groovy will determine the type of the variable at runtime and the type might even change. For instance, the following snippet is valid for Groovy code:</p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">def x = 42</span></span></span></p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">println x.getClass()</span></span></span></p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">x = &#8220;Hello World&#8221;</span></span></span></p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">println x.getClass()</span></span></span></p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">This script produces the following output:</span></span></span></p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">class java.lang.Integer</span></span></span></p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">class java.lang.String</span></span></span></p>
<p>The variable x changed its type during runtime. The user is still free to define x with a type like int.</p>
<p><strong>STRINGS</strong></p>
<p>Groovy has a String implementation called GString which allows the user to add variables into the String.</p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">def x = &#8220;World&#8221;</span></span></span></p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">println &#8220;Hello, $x&#8221;</span></span></span></p>
<p>This would produce the output Hello, World. The content of variable x is inserted into the string. If the user wants to use more difficult statements in the string, then the user need to add curly braces after the dollar sign.</p>
<p><strong>IMPLICIT TRUTHY</strong></p>
<p>Alike JavaScript Groovy evaluates every object to a Boolean value if required.</p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">if(&#8220;foobar&#8221;) &#8230;</span></span></span></p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">if(42) &#8230;</span></span></span></p>
<p class="western"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">if(someObject) &#8230;</span></span></span></p>
<p><strong>REGULAR EXPRESSIONS</strong></p>
<p>Groovy has some syntactic sugar around regular expressions. The user can define a regular pattern class by placing the ~ in front of a string. Besides the already mentioned single quote and double quotes,there is a third method to define a string, which is primarily meant for regular expressions. The user can define a string inside two slashes /../. The main difference (in contrast to &#8220;&#8221;&#8221;) is, that the user does not need to escape a backslash character, which they often need in regular expression patterns.</p>
<p>def pattern = ~/a slash must be escaped \/ but backslash, like in a digit match \d does not/<br />
println pattern.getClass()</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/groovy-programming-language/">GROOVY PROGRAMMING LANGUAGE</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pro-tekconsulting.com/blog/groovy-programming-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
