329 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Notes Domino 9 group 1 language versions are availabe now.
Tue, Apr 23rd 2013 120
Improve File enumeration performance in the admin client
Sat, Apr 20th 2013 139
IBM Redbooks: Installing and Deploying IBM Connections
Wed, Apr 17th 2013 156
Tabris a cool way to reuse your Notes/Eclipse RCP skills in the mobile app development
Tue, Apr 16th 2013 144
Improve your Domino Server Performance on the System i
Sun, Apr 14th 2013 144
Howto get auto generated values from rows created by SQL inserts in DB2
Sun, Apr 14th 2013 93
The Art of Java performance tuning.
Thu, Apr 11th 2013 206
Top 10
My Top 5 Notes 9 features
Wed, Mar 27th 2013 687
Lotus Notes 9 final is available in passport advantage
Thu, Mar 21st 2013 562
Erste Eindrücke vom Browserplugin und iNotes
Fri, Dec 28th 2012 486
Notes 9 als Anwender; erster Blick Hui, zweiter Blick leider Pfui.
Fri, Dec 28th 2012 479
Notes 9 gold the first look is a little bit disappointing
Fri, Mar 22nd 2013 474
Coole neue notes.ini Variable in Domino 9 für Copy style compact
Thu, Jan 3rd 2013 455
"equal" vs "==" in Java
Fri, Dec 14th 2012 427
Frohe Weihnachten
Mon, Dec 24th 2012 419
Generische Collection in ein Array verwandeln.
Fri, Nov 30th 2012 397
Neues Feature Database Maintenance in Domino 9
Fri, Jan 4th 2013 392


"equal" vs "==" in Java
   

Ein typischer Anfängerfehler in Java ist, zwei Objekte in einer if Klausel mit "==" statt mit .equals() zu vergleichen. Dies ist aber in den meisten Fällen grundfalsch. Das tückische dabei ist, dass der Fehler nicht immer sofort auffällt, da unter manchen Umständen der Vergleich mit "==" auch funktioniert.

Um zu verstehen warum die beiden Vergleiche unterschiedlich sind, muss man zuerst wissen, wie Java eigentlich Objekte verwaltet. Wenn mit new ein neues Objekt erzeugt wird und einer Variable zugewiesen wird, wird nicht das Objekt in der Variable gespeichert, sondern das Objekt wird am Heap (Hauptspeicher) erzeugt und ein Zeiger auf die Stelle im Heap an der das Objekt gespeichert ist, wird der Variable zugewiesen. Man kann sich sozusagen die Variable als einen primitiven Datentyp vorstellen, der eine Referenz auf den Heap speichert. Mehrere Variablen können die selbe Referenz auf das selbe Objekt im Heap zugewiesen haben. Wenn nun mit "==" verglichen wird, wird das Objekt im Heap gar nicht angeschaut, sondern es wird nur verglichen, ob die Variable die gleiche Referenz enthält. Wenn ja wird true zurückgeliefert und wenn nein wird false zurückgeliefert. Ganz anders verhält es sich beim equals(). Hier müssen die Objekte nicht einmal vom gleichen Typ sein, sondern es kommt auf die Implementierung der "equals" Methode an, ob das Ergebnis true oder false ist. Im Normalfall wird man immter mit equals() vergleichen, da ich im Normalfall wissen will, ob es sich um ein logisch gleiches Objekt handelt und nicht um das selbe Objekt. Wenn alles so klar ist, warum funktioniert dann folgender Code:


String test1="Test";
String test2="Test";
System.out.println(test1==test2); //Bitte auf keinen Fall so machen
System.out.println(test1.equals(test2); //So vergleicht man richtig.
Im Normalfall würde man erwarten, da man zwei String Literale hat, dass der erste Vergleich false ergeben würde. Doch die JVM verwendet für Stringliterale einen Cache und so wird der zweite Literal wegoptimiert und beide Variablen verweisen auf das selbe Objekt im String Cache. Nur sollte man sich auf keinen Fall auf das verlassen, da eine andere JVM Implementierung auf diesen Cache eventuell verzichtet, oder der Cache bereits voll ist und dann hat man plötzlich zwei unterschiedliche Objekte und der erste Vergleich ergibt false.

---------------------
http://petterralf.blogspot.com/2012/12/equal-vs-in-java.html
Dec 14, 2012
428 hits



Recent Blog Posts
120


Notes Domino 9 group 1 language versions are availabe now.
Tue, Apr 23rd 2013 4:14a   Ralf Petter
The first national language versions (Group 1) for example Catalan, Italian and German of Notes Domino 9 are available in passport advantage now. So there is no more reason to postbone your upgrade to the greatest version of Notes/Domino. The GA2 languages like Finnish, Norwegian, Swedish, Danish, Dutch will be availabe on 04.06 and the remaining languages like Greek, Slovenian, Thai, Turkish, Russian, IB Portuguese, Hungarian, Slovakian, Hebrew, Kazakh, Polish, Czech should be available on 23 [read] Keywords: domino notes
139


Improve File enumeration performance in the admin client
Sat, Apr 20th 2013 3:31a   Ralf Petter
Since Domino 8.5 there have been many files in the data/domino directory on the server. So every time you refresh the files tab you have to wait while the server scans the whole data/domino directory. Although some contents like domino/js is not scanned this can take some time. Fortunatly there is a notes.ini setting which disable file scans in the domino directory. To enable this feature you cann add ADMIN_CLIENT_SKIP_DOMINO=1 to the notes.ini of the server or you can set this value with SET C [read] Keywords: admin domino notes development server
156


IBM Redbooks: Installing and Deploying IBM Connections
Wed, Apr 17th 2013 6:19a   Ralf Petter
IBM has published a new redbook about the installation and configuration of IBM connections. Looks very promising. [read] Keywords: connections ibm ldd lotus
144


Tabris a cool way to reuse your Notes/Eclipse RCP skills in the mobile app development
Tue, Apr 16th 2013 11:55a   Ralf Petter
Today the final version of Tabris has been released. Tabris is a native peer client for a RAP (Remote Application Plattform formerly Rich Ajax Plattform) Server. RAP is a mature technology to run SWT/Jface Applications and Eclipse RCP Plugins on a server and render the UI to different clients like a webbrowser or native clients. The RAP Server and the Webclient are opensource. With the Tabris SDK they first commercial native client to RAP Server for Android and IOS is available. So you can reuse [read] Keywords: notes ajax application applications development eclipse google mobile server
144


Improve your Domino Server Performance on the System i
Sun, Apr 14th 2013 12:17p   Ralf Petter
On Windows it is pretty clear that Domino Servers only perform well, when the admin regulary defragment the file system where the Domino data is stored. Unfortunatly many System i admins do not know that fragmentation of Domino databases is a problem on their system too. So they do not get the best performance possible and with every year of using the server the problem of framgentation gets bigger and bigger. The defragmentation of the disks in a System i Server can be done with the command ST [read] Keywords: admin domino ibm lotus server system i
93


Howto get auto generated values from rows created by SQL inserts in DB2
Sun, Apr 14th 2013 11:18a   Ralf Petter
Normally you know exactly which values are in the columns of a newly inserted row in a database table. But when your table has an automatic generated identity column which is the primary key of the table you will want the automatic generated key value from your insert statement. But the normal insert command does not give back values. Fortunatly newer DB2 Version have the "Select from final Table" clause to solve the problem. For example we have an address table created by the following comma [read] Keywords: database db2 java sql
206


The Art of Java performance tuning.
Thu, Apr 11th 2013 11:58p   Ralf Petter
There was a very interesting session at Eclipse Con 2013 in Boston about low level java performance tuning from Ed Merks. You can find the session slides at: http://www.eclipsecon.org/2013/sites/eclipsecon.org.2013/files/JavaPerformanceTuning.pptx P. S. The interesting slides start at slide 17. [read] Keywords: eclipse java
273


Happy Birthday to the best application server on earth
Thu, Apr 11th 2013 9:18a   Ralf Petter
This year the best application server system celebrate its 25th birthday. Watch this video to see why the "IBM i" is is such a great system. [read] Keywords: ibm application server
140


Howto split a String with a delimiter in SQL
Thu, Apr 11th 2013 3:37a   Ralf Petter
Today i want to show how to split a String with a delimiter in SQL for example in a table with modelnumbers which consists of two parts sperated by a slash. model A1/44 CX3/2 C/140 To get the first and second part of the modelnumber you can use select LEFT( trim(model),LENGTH(trim(model))-ABS(LOCATE('/',trim(model))-1)) model1, RIGHT( trim(model), LENGTH(trim(model))-LOCATE('/',trim(model))) model2 from modeltable to get the result: model1 model2 A1 44 CX3 2 C 140 [read] Keywords: sql




263


MammothHq The next social network?
Wed, Apr 10th 2013 12:48a   Ralf Petter
I do not know if http://mammothhq.com/ralfpetter is the next big thing in the internet, but the registration is free and easy. So if you want you can try out with the above link. [read] Keywords: network




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition