<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2288132424752960803</id><updated>2011-12-17T13:40:25.608+05:30</updated><title type='text'>Arpit Agarwal's Blog</title><subtitle type='html'>java | swings | performance | netbeans | programming | coding | operating systems | profiling</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-1321261604331970935</id><published>2011-12-17T13:40:00.002+05:30</published><updated>2011-12-17T13:40:25.617+05:30</updated><title type='text'></title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I was checking my facebook wall today. I was shocked to see that nearly 80% of my status updates were related to technology. This gave me an idea to start a new page "TechieHub" in facebook which would allow techies like you and me to post latest updates to this one place for all to read. &lt;br /&gt;&lt;br /&gt;I would like to suggest you to "LIKE" this new "TechieHub" page if you really like my idea. Here is a link. &lt;a href="http://www.facebook.com/pages/TechieHub/201369999950798"&gt;Click Here&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-1321261604331970935?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/1321261604331970935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=1321261604331970935&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/1321261604331970935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/1321261604331970935'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2011/12/i-was-checking-my-facebook-wall-today.html' title=''/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-3910067803040872990</id><published>2010-08-11T10:54:00.000+05:30</published><updated>2010-08-11T10:54:04.036+05:30</updated><title type='text'>JavaFX - Special data types and data holders!</title><content type='html'>Apart from the usual datatypes found in almost every programming language for eg. Integer, Long, Double, Boolean etc; JavaFX provides a special data type named &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Duration&lt;/span&gt;. As soon as you see &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Duration&lt;/span&gt; data type, you get a strong feeling that it has something to do with Animation.&amp;nbsp;Below is an example:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;def mil = 25ms;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;def sec = 25s;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;def min = 25m;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;def hrs = 25h;&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;Also notice the &lt;strong&gt;time literals&lt;/strong&gt; used in this example. Appending &lt;strong&gt;ms, s, m&amp;nbsp;or h&lt;/strong&gt;&amp;nbsp; to a value creates an object of type &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Duration&lt;/span&gt;. Not only this, you can also apply arithmatic operations on &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Duration&lt;/span&gt; data types. Cool ... isn't it!&lt;br /&gt;&lt;br /&gt;The second feature that is extremely useful is a special collection of objects named &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Sequences&lt;/span&gt;. Peek into the example below:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;def seq1:String[] = ["A", "B", "C"];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;def seq2 = [1 .. 100];&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;Don't they look like arrays. Yes they do, but look at the second line, this is special feature in a &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Sequence&lt;/span&gt;. Here seq2 automatically gets assigned the values from 1 to 100 i.e the size of sequence becomes 100. You can also use the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;def seq3 = [0 .. 100 step 10];&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;This would assign values 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 to seq3. Not only this, you can do &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Sequence&lt;/span&gt; manipulation as well i.e. you can always perform insert, delete and reverse operations on a &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;sequence&lt;/span&gt;. But you must understand that although you can perform such operations but still a &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;sequence&lt;/span&gt; is immutable and any such operation would result in creation of a new &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;sequence&lt;/span&gt;. Look a the eg. below:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;var seq1= [1 .. 5];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;insert 6 into seq1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;insert 0 before seq1[0];&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;This would result in a sequence with values 0, 1, 2, 3, 4, 5, 6. Similary you can delete from a &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;sequence&lt;/span&gt; as well. Isn't it much more powerful than an Array!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-3910067803040872990?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/3910067803040872990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=3910067803040872990&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/3910067803040872990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/3910067803040872990'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2010/08/javafx-special-data-types-and-data.html' title='JavaFX - Special data types and data holders!'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-5327657630298303250</id><published>2010-08-10T15:05:00.000+05:30</published><updated>2010-08-10T15:05:32.536+05:30</updated><title type='text'>JavaFX - New ways to declare a variable!</title><content type='html'>While making my way through learning this new and exciting technology, interestingly, i found that in&amp;nbsp;JavaFX there are two ways to declare a variable.&amp;nbsp;Take a look at&amp;nbsp;the code snippet below:&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;var canAssign: Integer = 10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;def cannotAssign: Integer = 10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;canAssign = 20; // will work fine&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;cannotAssign = 20; // will result in compiler error&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;To sum up,&amp;nbsp;you can declare&amp;nbsp;a variable using a keyword &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;strong&gt;var&lt;/strong&gt;&lt;/span&gt; and second option is to use a keyword &lt;strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;def&lt;/span&gt;&lt;/strong&gt;. In case you use &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;strong&gt;var&lt;/strong&gt;&lt;/span&gt; keyword to&amp;nbsp;declare a variable,&amp;nbsp;you&amp;nbsp;are creating a reassignable variable. In case&amp;nbsp;you opt in for &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;strong&gt;def&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt; &lt;/span&gt;keyword, you are creating an initialize-only variable.&lt;br /&gt;&lt;br /&gt;However, it must be noted here that&amp;nbsp;although a &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;strong&gt;def&lt;/strong&gt;&lt;/span&gt; variable cannot be reassigned but the object it references can definately mutate i.e. change its contents. Therefore a &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;strong&gt;def&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt; &lt;/span&gt;variable may be assumed as an immutable type.&lt;br /&gt;&lt;br /&gt;Isn't it interesting!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-5327657630298303250?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/5327657630298303250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=5327657630298303250&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/5327657630298303250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/5327657630298303250'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2010/08/javafx-new-ways-to-declare-variable.html' title='JavaFX - New ways to declare a variable!'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-4125204934332485885</id><published>2010-08-08T19:15:00.001+05:30</published><updated>2010-08-08T19:15:46.463+05:30</updated><title type='text'>NetBeans JavaFX Composer - A threat to Adobe FlexBuilder!</title><content type='html'>Before coming up with tutorial on working with NetBeans 6.9 JavaFX composer and just to make you more curious, I must tell you guys that JavaFX Composer is a great competitor and might be a threat to Adobe FlexBuilder.&lt;br /&gt;&lt;br /&gt;Last night, I was playing with this new tool in the block and I must appreciate the efforts of NetBeans team. They are bang on target with this excellent tool. It makes coding in JavaFX a breeze. Most of times you need not code anything, about 90% of the tasks are done by mere drag and drop.&lt;br /&gt;&lt;br /&gt;So Adobe and Microsoft get ready to face a stiff competition from Oracle with this new JavaFX composer. I must say... I am impressed! Just remain tuned in for more action.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-4125204934332485885?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/4125204934332485885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=4125204934332485885&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/4125204934332485885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/4125204934332485885'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2010/08/netbeans-javafx-composer-similar-to.html' title='NetBeans JavaFX Composer - A threat to Adobe FlexBuilder!'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-3119398259458127298</id><published>2010-08-06T00:43:00.001+05:30</published><updated>2010-08-06T00:43:06.623+05:30</updated><title type='text'>JavaFX - Rich UI Applications!</title><content type='html'>Last few days, I had been trying to understand the need of JavaFX in the world of Java. With RIAs becoming so common and Java really loosing out in client side application development at the hands of Microsoft Silverlight and Adobe Flex, something was urgently required to prove the existence of Java on client side as well. And JavaFX is an answer to this. &lt;br /&gt;&lt;br /&gt;If you remember, it was Java which first introduced the concept of RIAs in form of an Applet, but with time it became old and mature. And then Flash and AJAX begin dominating Java Applet. It would not be wrong to say that Java was completely wiped off from the RIA arena. But now with JavaFX it has really made a comeback.&lt;br /&gt;&lt;br /&gt;Oracle is not only doing a great job in creating JavaFX but it is also trying to create solid tools that would enable&amp;nbsp;the developers to quickly create a JavaFX application. If you don't believe me, check out the latest version of NetBeans 6.9. NetBeans 6.9 has an excellent JavaFX composer tool to start creating JavaFX applications by mere drag and drop stuff and its really really powerful.&lt;br /&gt;&lt;br /&gt;I will be soon coming up with a tutorial on how to startup with JavaFX using&amp;nbsp;NetBeans 6.9 JavaFX composer.&amp;nbsp;Until then... Good Bye!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-3119398259458127298?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/3119398259458127298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=3119398259458127298&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/3119398259458127298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/3119398259458127298'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2010/08/javafx-rich-ui-applications.html' title='JavaFX - Rich UI Applications!'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-2623321862999485707</id><published>2010-04-29T07:50:00.000+05:30</published><updated>2010-04-29T07:50:45.763+05:30</updated><title type='text'>Here comes one more Java puzzle for you...</title><content type='html'>&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;I am up with my new puzzle today. Just go through the code below and see if you can guess the output. The code looks pretty simple. But beware, its not that easy:&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;public class StringPuzzle {&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;public static void main(String[] args) {&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; final String a = "length is 12";&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; final String b = "length is " + a.length();&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; System.out.println("Strings are equal: "                             + a == b);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;}&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Well... can you guess the answer? Ok... let me read your mind... you guessed the output &amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;i&gt;Strings are equal: true&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&amp;nbsp;&lt;span class="Apple-style-span" style="font-style: normal;"&gt;or you might have guessed&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new'; font-style: normal;"&gt;&lt;i&gt;Strings are equal: false&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;.&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new'; font-style: normal;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new'; font-style: normal;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-style: normal;"&gt;Well I have some bad news for you. In both the cases you are incorrect. Isn't it strange! Don't believe my words. Just execute this program and you will see it yourself.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new'; font-style: normal;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Verdana, sans-serif; font-size: 11px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Post a solution in comment section. Happy coding!!&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-2623321862999485707?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/2623321862999485707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=2623321862999485707&amp;isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/2623321862999485707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/2623321862999485707'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2010/04/here-comes-one-more-java-puzzle-for-you.html' title='Here comes one more Java puzzle for you...'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-1311258431496896367</id><published>2010-02-21T12:08:00.017+05:30</published><updated>2010-02-21T20:32:33.232+05:30</updated><title type='text'>Performance driven iteration of an ArrayList - Iterator or Traditional for loop?</title><content type='html'>&lt;span class="Apple-style-span" style="font-size: small;"&gt;Well.. for last few days I have come to know a lot about writing performance driven java code. Thanks to java profiling. Today, I am going to share my small experience with &lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;ArrayList&lt;/span&gt; iteration with you. &lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;One of the first lessons while going through lectures on Collections is about fetching or iterating through data stored in these Collections. One of the most commonly used Collection is &lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;ArrayList. ArrayList&lt;/span&gt; is an ordered list that allows index based fetching. &lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Let me ask you a question. If you have to write a performance driven code, where it is required to iterate through huge dataset contained in an &lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;ArrayList&lt;/span&gt;, what mechanism would you follow? About 90% of the times the answer would be using an &lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;Iterator&lt;/span&gt;. Correct?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Well in my opinion, &lt;b&gt;NO&lt;/b&gt;. Just try to run the below piece of code and note down the time taken in both type of iterations i.e. &lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;Iterator &lt;/span&gt;and traditional &lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;for loop&lt;/span&gt; and you would start to agree with me.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;public static void main(String args[])&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;ArrayList arrayList = new ArrayList();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;//populating list with elements&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;for(int i=0; i&amp;lt;1000000; i++)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;arrayList.add(i);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;// using traditional for loop&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;long startTime = System.currentTimeMillis();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;for(int i=0; i&amp;lt;1000000; i++)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;arrayList.get(i);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;System.out.println("Time taken in traditional for loop:"+(System.currentTimeMillis()-startTime));&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;// using traditional for loop with iterator&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;startTime = System.currentTimeMillis();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;for(Iterator i = arrayList.iterator(); i.hasNext();)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;i.next();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;System.out.println("Time taken in Iterator loop:"+(System.currentTimeMillis()-startTime));&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Surprising?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Well that was related to iteration of &lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;ArrayList &lt;/span&gt;elements only. What if, you want to remove elements from the &lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;ArrayList &lt;/span&gt;while iterating through. In such as case, its always better to use &lt;span class="Apple-style-span" style="font-family: &amp;quot;courier new&amp;quot;;"&gt;Iterator &lt;/span&gt;since it does not enforce you to know the size of underlying Collection and is also fail safe. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;So now you should be comfortable enough with both of these mechanisms and when to actually use them.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Happy Coding!&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-1311258431496896367?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/1311258431496896367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=1311258431496896367&amp;isPopup=true' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/1311258431496896367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/1311258431496896367'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2010/02/performance-driven-iteration-of.html' title='Performance driven iteration of an ArrayList - Iterator or Traditional for loop?'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-3379981458501621526</id><published>2010-02-17T00:32:00.010+05:30</published><updated>2010-02-20T19:12:43.478+05:30</updated><title type='text'>Is it a Bug or simply a Java Puzzle?</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Ok... I just wrote a simple program where I was trying to divide a &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;microseconds &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;in day with &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;milliseconds &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;in a day and I wrote it as follows:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;public class Test&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;public static void main(String[] args)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;long microseconds = 24 * 60 * 60 * 1000 * 1000;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;long milliseconds = 24 * 60 * 60 * 1000; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;System.out.println(microseconds/milliseconds); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; } &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Well... can you figure out any problem with this code? If yes, you have got a great presence of mind and If no, its not an issue. Let me explain the problem with this code. You are just thinking that the code should run fine and should print 1000 as a result. My advice, try to copy-compile-run this piece of code, see the result and then continue reading the next section of my post.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Did you just saw it printed 5. Is it hard to believe? Well, the good news, is its not a Java Bug and the bad news is, the code you just executed has a flaw.  Although the results of the computation of the variables &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;microseconds &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;and &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;milliseconds &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;are getting stored in &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;long &lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;data type but they are being computed as an &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;int &lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;arithmetic which makes the &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;microseconds &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;variable to overflow (&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;int &lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;range) before storing the result in &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;long &lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;data type. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;So why the hell these computations are being carried on as an &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;int &lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;arithmetic. The reason is pretty simple. All of the values involved in computation i.e. 24, 60, 60, 1000, 1000 are &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;int&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; themselves. So, when you multiply &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;int &lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;to an &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;int &lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;you get another &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;int&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Whats the solution then? Do you have an idea? Post a solution in comment section. Happy coding!!&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-3379981458501621526?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/3379981458501621526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=3379981458501621526&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/3379981458501621526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/3379981458501621526'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2010/02/is-it-bug-or-simply-java-puzzle.html' title='Is it a Bug or simply a Java Puzzle?'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-7517092739305899380</id><published>2010-01-21T21:49:00.012+05:30</published><updated>2010-01-21T22:23:52.052+05:30</updated><title type='text'>Profiling Java Applications</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Well, last few days have given me some serious reasons for profiling Java applications. To be precise, the problem was with one of the Java application which was becoming slower overtime. I tried to figure out the real problem both by manually scanning the code and debugging as well but the problem was hidden and all my efforts were getting wasted. Then, someone came and advised me on using a profiler to find the actual problem in the code.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Really, till then I had just heard about profiling but had never tried myself. This was the first time I gave it a try and it really worked. I used NetBeans profiler in order to find the problem with the code and I must say, it worked wonders for me. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Profiler enables a Java developer to make the application JVM friendly. &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; "&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Java profilers connect to a running Java application's JVM and capture memory information. In older Java versions they used Java Virtual Machine Profiler Interface (JVMPI). In latest versions however, the JVM Tool Interface (JVMTI) for Java is used to get the profiling information. If you don't profile your large enterprise Java applications prior to releasing them to production, they can fail with &lt;/span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;OutOfMemoryErrors&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; or render poor performance over time. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span"   style="  border-collapse: collapse; font-family:Arial, Helvetica, sans-serif;font-size:13px;"&gt;&lt;p&gt;&lt;/p&gt;&lt;h4 style="text-align: left;line-height: 12px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;JVMPI&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;JVMPI was an experimental feature in the Java 2 SDK. Sun intended tools vendors to use it to develop profilers that would work in conjunction with Sun's JVM. Similar to the Java AWT listener API, JVMPI was based on the event model.&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;p style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Profiling tools that utilized JVMPI had to implement the function call interface and register for various events in order to get various VM memory stats. When a registered event occurred, the application's VM captured a memory snapshot by querying the object hierarchy. This was very time consuming and it interfered with the running application. Also, when the profiling tool registered all the exposed events, it slowed down the VM considerably. As a result, many vendors stayed away from developing profiling tools with this interface.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;h4 style="text-align: left;line-height: 12px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;JVMTI&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;As JVMPI had some shortcomings and was not offering finer-grain control of the running JVM, Sun introduced JVMTI with JDK 5.0 as an experimental interface model to profile the JVM. It provides ways to both inspect the state and control the execution of applications running in the JVM. JVMTI supports the full breadth of tools that need access to JVM state, including but not limited to profiling, debugging, monitoring, thread analysis, and coverage analysis tools. The JVMTI model supports both sampling and instrumentation of the JVM.&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;p style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;JVMTI is a two-way (query and control) interface. A client of JVMTI can be notified of interesting occurrences through events. Using JVMTI, profilers can query and control the application through many functions. The native in-process interface allows maximal control with minimal intrusion from the tool.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;So what are you waiting for, if you are facing any kind of memory related issues in your Java application, NetBeans profiler is there to help you out.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-7517092739305899380?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/7517092739305899380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=7517092739305899380&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/7517092739305899380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/7517092739305899380'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2010/01/profiling-java-applications.html' title='Profiling Java Applications'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-1108170309990816268</id><published>2009-09-18T22:50:00.011+05:30</published><updated>2009-09-18T23:21:33.536+05:30</updated><title type='text'>Free alternative to FlexBuilder in 10 easy steps!</title><content type='html'>After downloading Flex SDK and documentation last week, I came to know about Adobe FlexBuilder, a commercial tool available from Adobe website to develop flex applications. I was really disappointed when i was not able to find even a single free alternative to FlexBuilder. FlexBuilder is basically based upon eclipse and as soon as I came to know about it, I start wondering if something similar is available for NetBeans as well. And here it is. After some googling around, I found a plugin for NetBeans which would allow me to develop Flex Applications for free. Its pretty easy to install and configure. The only downside being that it won’t give you code auto-complete feature. But anyways, as a beginner its good for me to write my own code instead of making bad habit of code to auto-complete. Below is a quick walkthrough of how I was able to install flex plugin into my NetBeans IDE in just 10 easy steps. &lt;p&gt;1. To download the FlexBean plugin, &lt;a href="http://downloads.sourceforge.net/project/flexbean/FlexBean/1.1.1%20%28Win%2C%20Linux%2C%20Mac%29/org-netbeans-module-flexbean-1.1.1.nbm?use_mirror=nchc"&gt;click here&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;2. Once downloaded, please start NetBeans IDE and click Tools &amp;gt;&amp;gt; Plugins&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_7Fs2NqmLouM/SrPEVBX6LKI/AAAAAAAAADE/wZbu2o27R2Q/s1600-h/1.png"&gt;&lt;img style="WIDTH: 320px; HEIGHT: 200px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5382861845062888610" border="0" alt="" src="http://4.bp.blogspot.com/_7Fs2NqmLouM/SrPEVBX6LKI/AAAAAAAAADE/wZbu2o27R2Q/s320/1.png" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;3. Now in “Plugins” dialog box select “Downloaded” Tab and click “Add Plugins…” button.&lt;/p&gt;&lt;p&gt;4. From “Add Plugins…” dialog please browse to the directory where you downloaded the flex bean plugin file and select it. Finally, click “Open” button to add the plugin to plugin list.&lt;/p&gt;&lt;p&gt;&lt;a href="http://4.bp.blogspot.com/_7Fs2NqmLouM/SrPFF5HPY9I/AAAAAAAAADM/x-bRbp-YUTM/s1600-h/1.png"&gt;&lt;img style="WIDTH: 320px; HEIGHT: 200px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5382862684659082194" border="0" alt="" src="http://4.bp.blogspot.com/_7Fs2NqmLouM/SrPFF5HPY9I/AAAAAAAAADM/x-bRbp-YUTM/s320/1.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;5. Now click “Install” button with FlexBean selected and you will be presented with a FlexBean installation wizard.&lt;/p&gt;&lt;p&gt;6. Click Next, accept the agreement, and finally click install to install the plugin in NetBeans.&lt;/p&gt;&lt;p&gt;7. Click finish and then close all the dialogs to return to NetBeans workbench. &lt;/p&gt;&lt;p&gt;&lt;a href="http://3.bp.blogspot.com/_7Fs2NqmLouM/SrPF0vcLedI/AAAAAAAAADU/8uBirFvomE8/s1600-h/1.png"&gt;&lt;img style="WIDTH: 320px; HEIGHT: 200px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5382863489516403154" border="0" alt="" src="http://3.bp.blogspot.com/_7Fs2NqmLouM/SrPF0vcLedI/AAAAAAAAADU/8uBirFvomE8/s320/1.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;8. To configure FlexBean plugin properly, it needs to know the location where the Flex SDK has been extracted. Click Tools &amp;gt;&amp;gt; Flex Platform.&lt;/p&gt;&lt;p&gt;9. From “Flex Platforms” dialog select "Add Platform…” Button and select the folder where you have extracted Flex SDK and click Next.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_7Fs2NqmLouM/SrPGgV5mntI/AAAAAAAAADc/y00W26M7-FM/s1600-h/1.png"&gt;&lt;img style="WIDTH: 320px; HEIGHT: 200px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5382864238574739154" border="0" alt="" src="http://1.bp.blogspot.com/_7Fs2NqmLouM/SrPGgV5mntI/AAAAAAAAADc/y00W26M7-FM/s320/1.png" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;10. Finally, write a name of the platform in the next dialog and click Finish. &lt;/p&gt;&lt;p align="left"&gt;This is all you need to do in order to make the NetBeans IDE ready for Flex editing. &lt;/p&gt;&lt;p&gt;Next, I will be creating our first flex application and get our hands wet with some real water. Stay tuned!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-1108170309990816268?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/1108170309990816268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=1108170309990816268&amp;isPopup=true' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/1108170309990816268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/1108170309990816268'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2009/09/free-alternative-to-flexbuilder-in-10.html' title='Free alternative to FlexBuilder in 10 easy steps!'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7Fs2NqmLouM/SrPEVBX6LKI/AAAAAAAAADE/wZbu2o27R2Q/s72-c/1.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-5311258624203753208</id><published>2009-09-09T00:53:00.001+05:30</published><updated>2009-09-09T00:53:20.428+05:30</updated><title type='text'>My Latest Interest…</title><content type='html'>&lt;p&gt;Well… no excuses on why I am blogging after a long break. I would just say… I was really busy with all the work I have been doing during this break of mine. Lots of things in life have changed. I am not the same “Java Enthusiast”. I am much more grown up now, in the sense that I see Java just as any other technology which could help me achieve the requirements. I, no more belong to a group of people who follow a particular technology as their religion but believe in new inventions and innovations. Just like Windows has its alternatives in form of Linux and Mac OS… Java too has its alternatives. Then why should I stick to Java… why shouldn’t I try something new, something more productive, something more flashy. First of all, I must tell you… I am just talking about the client side Java for now. The last day, someone told me about Adobe Flex and its power. Therefore, I decided to give it a try. My latest interest is Adobe Flex and I am trying to get my hands wet with it.&lt;/p&gt;  &lt;p&gt;Will keep you updated on it.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-5311258624203753208?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/5311258624203753208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=5311258624203753208&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/5311258624203753208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/5311258624203753208'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2009/09/my-latest-interest.html' title='My Latest Interest…'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-9027813958463227711</id><published>2007-12-15T11:57:00.000+05:30</published><updated>2007-12-15T12:07:49.661+05:30</updated><title type='text'>Thats me on NetBeans Community Docs Spotlight</title><content type='html'>A day before, James Branam, the man responsible for documentation for NetBeans web applications and release notes and is also the NetBeans Community Docs Manager, published NetBeans Community Docs spotlight on his official blog at &lt;a href="http://blogs.sun.com/branajam/"&gt;http://blogs.sun.com/branajam/&lt;/a&gt;. Any guesses on who was picked up as a spotlight for NetBeans Community Docs by James this time. It was me! Check it out at &lt;a href="http://blogs.sun.com/branajam/entry/nb_community_docs_spotlight_arpit"&gt;http://blogs.sun.com/branajam/entry/nb_community_docs_spotlight_arpit&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Well, I have another good news. He is sending all the Community Docs contributors a NetBeans T-Shirt and I am really excited.&lt;br /&gt;&lt;br /&gt;With all these good stuffs, I have now planned to write one more tutorial for Community Docs section which will be posted soon.&lt;br /&gt;&lt;br /&gt;Thanks James!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-9027813958463227711?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/9027813958463227711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=9027813958463227711&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/9027813958463227711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/9027813958463227711'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2007/12/thats-me-on-netbeans-community-docs.html' title='Thats me on NetBeans Community Docs Spotlight'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2288132424752960803.post-2655220508297000366</id><published>2007-12-06T21:27:00.000+05:30</published><updated>2007-12-06T21:39:32.733+05:30</updated><title type='text'>Tutorial on Beginning Enterprise Application Development with NetBeans 6.0</title><content type='html'>You might be aware that NetBeans 6.0 has been released a day before. For all the NetBeans fans its a great news. This time around NetBeans team has done a lot of improvement in all spheres and have tried their level best in making it the "Only IDE you would ever require for any sort of Java Development".&lt;br /&gt;&lt;br /&gt;If anyone of you is interested, I have just published a tutorial which may be an excellent starting point for any Java Developer who want to start Enterprise Application Development (J2EE 5) using NetBeans 6.0 IDE, on NetBeans CommunityDocs Wiki. The tutorial has been done entirely on Ubuntu but is applicable to all the operating systems.&lt;br /&gt;&lt;a href="http://wiki.netbeans.org/wiki/view/BeginningWithEnterpriseApplication"&gt;&lt;br /&gt;Click Here&lt;/a&gt; to go through this tutorial and do not forget to post in your comments!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2288132424752960803-2655220508297000366?l=arpitsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arpitsblog.blogspot.com/feeds/2655220508297000366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2288132424752960803&amp;postID=2655220508297000366&amp;isPopup=true' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/2655220508297000366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2288132424752960803/posts/default/2655220508297000366'/><link rel='alternate' type='text/html' href='http://arpitsblog.blogspot.com/2007/12/tutorial-on-beginning-enterprise.html' title='Tutorial on Beginning Enterprise Application Development with NetBeans 6.0'/><author><name>Arpit Agarwal</name><uri>http://www.blogger.com/profile/06295755157726008581</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_7Fs2NqmLouM/S4EF03Uh78I/AAAAAAAAADo/CMZFZc_y5dY/S220/100_1628.JPG'/></author><thr:total>6</thr:total></entry></feed>
