DirectoryPersonalBlog Details for "Computerized World"

Computerized World

Computerized World
Discussion on latest News and Events in my computerized world
Articles: 1, 2, 3, 4, 5, 6, 7

Articles

Write Java with JDK 1.5 features and run on JRE 1.4
2008-08-06 14:33:00
Have you being writing your Java code on Java 1.5 (JDK 1.5) with new features like auto boxing, generics and enums? And suddenly realized that your customer's servers are still using Java 1.4 (JRE 1.4)? This is not a surprise since most of the customers are not in a position to take a risk and try the newer versions as they are running live/online businesses. But as professionals in the software development field, we have to move with the latest/stable versions available in the market. That's where the conflict occurs.Now you must deploy your Java 1.5 codes into a 1.4 Java runtime environment (even may be 1.3 or 1.2). Even if the Java code has not used any of the new features of Java 1.5, you still can not run your code in 1.4 JRE as the runtime throws an error saying "java.lang.UnsupportedClassVersionError". Compile 1.5 codes for 1.4 JVMJava compiler provides an option to specify the target JVM of the generated classes like 1.5, 1.4, and 1.3 as follows.public class MyClass { pu...
More About: News , Tools , Tech , Features
Java: Numbers only String by removing non numeric characters
2008-07-31 14:05:00
With Java , deleting non numeric characters (letters, symbols etc) from a string to produce a numbers-only String is a common requirement in web applications, as application users are used to insert numeric values with non-numeric characters. For example a phone number will be entered with (-) characters like;650-212-5710. A price value may be entered with (,) characters like;12,500.00In Java, java.lang.Character class has a method; isDigit() which can be used to identify whether a character is a digit or not. Following method can be used for extracting a numbers-only string.public static String getOnlyNumeric s(String str) { if (str == null) { return null; } StringBuffer strBuff = new StringBuffer(); char c; for (int i = 0; i < str.length() ; i++) { c = str.charAt(i); if (Character.isDigit(c)) { strBuff.append(c); } } return strBuff.toString();}Calling above method with any String will return a numbers-onl...
More About: Tech , Characters , Numbers
Java: Numbers only String by removing non numeric characters
2008-07-31 14:05:00
With Java , deleting non numeric characters (letters, symbols etc) from a string to produce a numbers-only String is a common requirement in web applications, as application users are used to insert numeric values with non-numeric characters. For example a phone number will be entered with (-) characters like;650-212-5710. A price value may be entered with (,) characters like;12,500.00In Java, java.lang.Character class has a method; isDigit() which can be used to identify whether a character is a digit or not. Following method can be used for extracting a numbers-only string.public static String getOnlyNumeric s(String str) { if (str == null) { return null; } StringBuffer strBuff = new StringBuffer(); char c; for (int i = 0; i < str.length() ; i++) { c = str.charAt(i); if (Character.isDigit(c)) { strBuff.append(c); } } return strBuff.toString();}Calling above method with any String will return a numbers-onl...
More About: Tech , Characters , Numbers
Java: Numbers only String by removing non numeric characters
2008-07-31 14:05:00
With Java , deleting non numeric characters (letters, symbols etc) from a string to produce a numbers-only String is a common requirement in web applications, as application users are used to insert numeric values with non-numeric characters. For example a phone number will be entered with (-) characters like;650-212-5710. A price value may be entered with (,) characters like;12,500.00In Java, java.lang.Character class has a method; isDigit() which can be used to identify whether a character is a digit or not. Following method can be used for extracting a numbers-only string.public static String getOnlyNumeric s(String str) { if (str == null) { return null; } StringBuffer strBuff = new StringBuffer(); char c; for (int i = 0; i < str.length() ; i++) { c = str.charAt(i); if (Character.isDigit(c)) { strBuff.append(c); } } return strBuff.toString();}Calling above method with any String will return a numbers-onl...
More About: Tech , Characters , Numbers
Java: Numbers only String by removing non numeric characters
2008-07-31 14:05:00
With Java , deleting non numeric characters (letters, symbols etc) from a string to produce a numbers-only String is a common requirement in web applications, as application users are used to insert numeric values with non-numeric characters. For example a phone number will be entered with (-) characters like;650-212-5710. A price value may be entered with (,) characters like;12,500.00In Java, java.lang.Character class has a method; isDigit() which can be used to identify whether a character is a digit or not. Following method can be used for extracting a numbers-only string.public static String getOnlyNumeric s(String str) { if (str == null) { return null; } StringBuffer strBuff = new StringBuffer(); char c; for (int i = 0; i < str.length() ; i++) { c = str.charAt(i); if (Character.isDigit(c)) { strBuff.append(c); } } return strBuff.toString();}Calling above method with any String will return a numbers-onl...
More About: Tech , Characters , Numbers
Java: Numbers only String by removing non numeric characters
2008-07-31 14:05:00
With Java , deleting non numeric characters (letters, symbols etc) from a string to produce a numbers-only String is a common requirement in web applications, as application users are used to insert numeric values with non-numeric characters. For example a phone number will be entered with (-) characters like;650-212-5710. A price value may be entered with (,) characters like;12,500.00In Java, java.lang.Character class has a method; isDigit() which can be used to identify whether a character is a digit or not. Following method can be used for extracting a numbers-only string.public static String getOnlyNumeric s(String str) { if (str == null) { return null; } StringBuffer strBuff = new StringBuffer(); char c; for (int i = 0; i < str.length() ; i++) { c = str.charAt(i); if (Character.isDigit(c)) { strBuff.append(c); } } return strBuff.toString();}Calling above method with any String will return a numbers-onl...
More About: Tech , Characters , Numbers
Java: Numbers only String by removing non numeric characters
2008-07-31 14:05:00
With Java , deleting non numeric characters (letters, symbols etc) from a string to produce a numbers-only String is a common requirement in web applications, as application users are used to insert numeric values with non-numeric characters. For example a phone number will be entered with (-) characters like;650-212-5710. A price value may be entered with (,) characters like;12,500.00In Java, java.lang.Character class has a method; isDigit() which can be used to identify whether a character is a digit or not. Following method can be used for extracting a numbers-only string.public static String getOnlyNumeric s(String str) { if (str == null) { return null; } StringBuffer strBuff = new StringBuffer(); char c; for (int i = 0; i < str.length() ; i++) { c = str.charAt(i); if (Character.isDigit(c)) { strBuff.append(c); } } return strBuff.toString();}Calling above method with any String will return a numbers-onl...
More About: Tech , Characters , Numbers
How to open a .war (web archive) or .jar (java archive) files
2008-07-30 14:14:00
With Java we generate .JAR files to bundle a set of resources. For J2EE web applications, we generate .WAR (Web Archive ) files for deployments. Both of these are ways of archiving a set of files.Both these .jar or .war archives are in zip format. So there are plenty of ways to open those files to read the content. One way would be to use any tool that you use to open/extract a .zip file. Next will be to use the Jar command itself.JAR CommandJAR (command) utility in Java can be used to open/extract these files as follows. Run following command from the folder where you need the content to be extracted by providing the path to the archive.jar xf <path-to-file>options:x - extract the filesf - file to extractjar xf myWebApp.warjar xf myProject.jarRelated : Open and read a file inside a war file of a web application with JavaHome
More About: Tech , Files
How to open a .war (web archive) or .jar (java archive) files
2008-07-30 14:14:00
With Java we generate .JAR files to bundle a set of resources. For J2EE web applications, we generate .WAR (Web Archive ) files for deployments. Both of these are ways of archiving a set of files.Both these .jar or .war archives are in zip format. So there are plenty of ways to open those files to read the content. One way would be to use any tool that you use to open/extract a .zip file. Next will be to use the Jar command itself.JAR CommandJAR (command) utility in Java can be used to open/extract these files as follows. Run following command from the folder where you need the content to be extracted by providing the path to the archive.jar xf <path-to-file>options:x - extract the filesf - file to extractjar xf myWebApp.warjar xf myProject.jarRelated : Open and read a file inside a war file of a web application with JavaHome
More About: Tech , Files
How to open a .war (web archive) or .jar (java archive) files
2008-07-30 14:14:00
With Java we generate .JAR files to bundle a set of resources. For J2EE web applications, we generate .WAR (Web Archive ) files for deployments. Both of these are ways of archiving a set of files.Both these .jar or .war archives are in zip format. So there are plenty of ways to open those files to read the content. One way would be to use any tool that you use to open/extract a .zip file. Next will be to use the Jar command itself.JAR CommandJAR (command) utility in Java can be used to open/extract these files as follows. Run following command from the folder where you need the content to be extracted by providing the path to the archive.jar xf <path-to-file>options:x - extract the filesf - file to extractjar xf myWebApp.warjar xf myProject.jarRelated : Open and read a file inside a war file of a web application with JavaHome
More About: Tech , Files
How to open a .war (web archive) or .jar (java archive) files
2008-07-30 14:14:00
With Java we generate .JAR files to bundle a set of resources. For J2EE web applications, we generate .WAR (Web Archive ) files for deployments. Both of these are ways of archiving a set of files.Both these .jar or .war archives are in zip format. So there are plenty of ways to open those files to read the content. One way would be to use any tool that you use to open/extract a .zip file. Next will be to use the Jar command itself.JAR CommandJAR (command) utility in Java can be used to open/extract these files as follows. Run following command from the folder where you need the content to be extracted by providing the path to the archive.jar xf <path-to-file>options:x - extract the filesf - file to extractjar xf myWebApp.warjar xf myProject.jarRelated : Open and read a file inside a war file of a web application with JavaHome
More About: Tech , Files
How to open a .war (web archive) or .jar (java archive) files
2008-07-30 14:14:00
With Java we generate .JAR files to bundle a set of resources. For J2EE web applications, we generate .WAR (Web Archive ) files for deployments. Both of these are ways of archiving a set of files.Both these .jar or .war archives are in zip format. So there are plenty of ways to open those files to read the content. One way would be to use any tool that you use to open/extract a .zip file. Next will be to use the Jar command itself.JAR CommandJAR (command) utility in Java can be used to open/extract these files as follows. Run following command from the folder where you need the content to be extracted by providing the path to the archive.jar xf <path-to-file>options:x - extract the filesf - file to extractjar xf myWebApp.warjar xf myProject.jarRelated : Open and read a file inside a war file of a web application with Java
More About: Tech , Files
How to open a .war (web archive) or .jar (java archive) files
2008-07-30 14:14:00
With Java we generate .JAR files to bundle a set of resources. For J2EE web applications, we generate .WAR (Web Archive ) files for deployments. Both of these are ways of archiving a set of files.Both these .jar or .war archives are in zip format. So there are plenty of ways to open those files to read the content. One way would be to use any tool that you use to open/extract a .zip file. Next will be to use the Jar command itself.JAR CommandJAR (command) utility in Java can be used to open/extract these files as follows. Run following command from the folder where you need the content to be extracted by providing the path to the archive.jar xf <path-to-file>options:x - extract the filesf - file to extractjar xf myWebApp.warjar xf myProject.jarRelated : Open and read a file inside a war file of a web application with Java
More About: Tech , Files
Web Services with Apache Axis 1.4 Tutorial: server and client sides
2008-07-29 14:21:00
Web services are a handy method of integrating independent systems. Apache Axis is one of the best free tools available for implementing and deploying web services, and also for implementing the web service clients.In this article we will create a simple, but complete web service and a client for this service step-by-step. Article will be explanatory as much as possible to succeed you in implementing it yourself alone after completing this tutorial.PrerequisitesMust be familiar with Java Familiar with basics on a web server like TomcatSome knowledge in configuring Axis will be an added advantageSystem Configuration RequirementsWe will be discussing the configuration in brief as our scope is mainly on web services. (If Axis already configured, jump to implementation). If you find any issues on the configuration part, you can refer to Apache Axis site for troubleshooting. (But if you can not solve it yourself do not worry, post the issue under the comments section in this article, and ...
More About: Services , Tutorial , Tech
Web Services with Apache Axis 1.4 Tutorial: server and client sides
2008-07-29 14:21:00
Web services are a handy method of integrating independent systems. Apache Axis is one of the best free tools available for implementing and deploying web services, and also for implementing the web service clients.In this article we will create a simple, but complete web service and a client for this service step-by-step. Article will be explanatory as much as possible to succeed you in implementing it yourself alone after completing this tutorial.PrerequisitesMust be familiar with Java Familiar with basics on a web server like TomcatSome knowledge in configuring Axis will be an added advantageSystem Configuration RequirementsWe will be discussing the configuration in brief as our scope is mainly on web services. (If Axis already configured, jump to implementation). If you find any issues on the configuration part, you can refer to Apache Axis site for troubleshooting. (But if you can not solve it yourself do not worry, post the issue under the comments section in this article, and ...
More About: Services , Tutorial , Tech
Web Services with Apache Axis 1.4 Tutorial: server and client sides
2008-07-29 14:21:00
Web services are a handy method of integrating independent systems. Apache Axis is one of the best free tools available for implementing and deploying web services, and also for implementing the web service clients.In this article we will create a simple, but complete web service and a client for this service step-by-step. Article will be explanatory as much as possible to succeed you in implementing it yourself alone after completing this tutorial.PrerequisitesMust be familiar with Java Familiar with basics on a web server like TomcatSome knowledge in configuring Axis will be an added advantageSystem Configuration RequirementsWe will be discussing the configuration in brief as our scope is mainly on web services. (If Axis already configured, jump to implementation). If you find any issues on the configuration part, you can refer to Apache Axis site for troubleshooting. (But if you can not solve it yourself do not worry, post the issue under the comments section in this article, and ...
More About: Services , Tutorial , Tech
Web Services with Apache Axis 1.4 Tutorial: server and client sides
2008-07-29 14:21:00
Web services are a handy method of integrating independent systems. Apache Axis is one of the best free tools available for implementing and deploying web services, and also for implementing the web service clients.In this article we will create a simple, but complete web service and a client for this service step-by-step. Article will be explanatory as much as possible to succeed you in implementing it yourself alone after completing this tutorial.PrerequisitesMust be familiar with Java Familiar with basics on a web server like TomcatSome knowledge in configuring Axis will be an added advantageSystem Configuration RequirementsWe will be discussing the configuration in brief as our scope is mainly on web services. (If Axis already configured, jump to implementation). If you find any issues on the configuration part, you can refer to Apache Axis site for troubleshooting. (But if you can not solve it yourself do not worry, post the issue under the comments section in this article, and ...
More About: Services , Tutorial , Tech
Web Services with Apache Axis 1.4 Tutorial: server and client sides
2008-07-29 14:21:00
Web services are a handy method of integrating independent systems. Apache Axis is one of the best free tools available for implementing and deploying web services, and also for implementing the web service clients.In this article we will create a simple, but complete web service and a client for this service step-by-step. Article will be explanatory as much as possible to succeed you in implementing it yourself alone after completing this tutorial.PrerequisitesMust be familiar with Java Familiar with basics on a web server like TomcatSome knowledge in configuring Axis will be an added advantageSystem Configuration RequirementsWe will be discussing the configuration in brief as our scope is mainly on web services. (If Axis already configured, jump to implementation). If you find any issues on the configuration part, you can refer to Apache Axis site for troubleshooting. (But if you can not solve it yourself do not worry, post the issue under the comments section in this article, and ...
More About: Services , Tutorial , Tech
Web Services with Apache Axis 1.4 Tutorial: server and client sides
2008-07-29 14:21:00
Web services are a handy method of integrating independent systems. Apache Axis is one of the best free tools available for implementing and deploying web services, and also for implementing the web service clients.In this article we will create a simple, but complete web service and a client for this service step-by-step. Article will be explanatory as much as possible to succeed you in implementing it yourself alone after completing this tutorial.PrerequisitesMust be familiar with Java Familiar with basics on a web server like TomcatSome knowledge in configuring Axis will be an added advantageSystem Configuration RequirementsWe will be discussing the configuration in brief as our scope is mainly on web services. (If Axis already configured, jump to implementation). If you find any issues on the configuration part, you can refer to Apache Axis site for troubleshooting. (But if you can not solve it yourself do not worry, post the issue under the comments section in this article, and ...
More About: Services , Tutorial , Tech
Java2WDSL & WSDL2Java - java.util.Date not handled consistently
2008-07-16 14:28:00
Java2WSDL and WSDL2Java tools in Axis (1.4) are pretty handy tools. Those help you to generate a WSDL from a java class as well as generating stubs/skeletons from a WSDL. But if you are dealing with java.util.Date fields in your code, you must pay some attention.Java2WSDLConsider the following java interface which uses java.util.Date as a return type as well as a method parameter.public interface MyService { public java.util.Date getNextDate(); public void updateLastRun(java.util.Date date);}When the Java2WDSL tool generates a WSDL for a class with a Date field, it will represent java.util.Date fields as dateTime fields in WSDL. The generated WSDL file would look as follows.<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://service" xmlns:apachesoap="http://xml.apache.org/x ml-soap" xmlns:impl="http://service" xmlns:intf="http://service" xmlns:soapenc="http://schemas.xmlsoap.org /soap/encoding/" xmlns:wsdl="h...
More About: Java , Tech , Web Services
Java2WDSL & WSDL2Java - java.util.Date not handled consistently
2008-07-16 14:28:00
Java2WSDL and WSDL2Java tools in Axis (1.4) are pretty handy tools. Those help you to generate a WSDL from a java class as well as generating stubs/skeletons from a WSDL. But if you are dealing with java.util.Date fields in your code, you must pay some attention.Java2WSDLConsider the following java interface which uses java.util.Date as a return type as well as a method parameter.public interface MyService { public java.util.Date getNextDate(); public void updateLastRun(java.util.Date date);}When the Java2WDSL tool generates a WSDL for a class with a Date field, it will represent java.util.Date fields as dateTime fields in WSDL. The generated WSDL file would look as follows.<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://service" xmlns:apachesoap="http://xml.apache.org/x ml-soap" xmlns:impl="http://service" xmlns:intf="http://service" xmlns:soapenc="http://schemas.xmlsoap.org /soap/encoding/" xmlns:wsdl="h...
More About: Java , Tech , Web Services
Java2WDSL & WSDL2Java - java.util.Date not handled consistently
2008-07-16 14:28:00
Java2WSDL and WSDL2Java tools in Axis (1.4) are pretty handy tools. Those help you to generate a WSDL from a java class as well as generating stubs/skeletons from a WSDL. But if you are dealing with java.util.Date fields in your code, you must pay some attention.Java2WSDLConsider the following java interface which uses java.util.Date as a return type as well as a method parameter.public interface MyService { public java.util.Date getNextDate(); public void updateLastRun(java.util.Date date);}When the Java2WDSL tool generates a WSDL for a class with a Date field, it will represent java.util.Date fields as dateTime fields in WSDL. The generated WSDL file would look as follows.<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://service" xmlns:apachesoap="http://xml.apache.org/x ml-soap" xmlns:impl="http://service" xmlns:intf="http://service" xmlns:soapenc="http://schemas.xmlsoap.org /soap/encoding/" xmlns:wsdl="h...
More About: Java , Tech , Web Services
Java2WDSL & WSDL2Java - java.util.Date not handled consistently
2008-07-16 14:28:00
Java2WSDL and WSDL2Java tools in Axis (1.4) are pretty handy tools. Those help you to generate a WSDL from a java class as well as generating stubs/skeletons from a WSDL. But if you are dealing with java.util.Date fields in your code, you must pay some attention.Java2WSDLConsider the following java interface which uses java.util.Date as a return type as well as a method parameter.public interface MyService { public java.util.Date getNextDate(); public void updateLastRun(java.util.Date date);}When the Java2WDSL tool generates a WSDL for a class with a Date field, it will represent java.util.Date fields as dateTime fields in WSDL. The generated WSDL file would look as follows.<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://service" xmlns:apachesoap="http://xml.apache.org/x ml-soap" xmlns:impl="http://service" xmlns:intf="http://service" xmlns:soapenc="http://schemas.xmlsoap.org /soap/encoding/" xmlns:wsdl="h...
More About: Java , Tech , Web Services
Java2WDSL & WSDL2Java - java.util.Date not handled consistently
2008-07-16 14:28:00
Java2WSDL and WSDL2Java tools in Axis (1.4) are pretty handy tools. Those help you to generate a WSDL from a java class as well as generating stubs/skeletons from a WSDL. But if you are dealing with java.util.Date fields in your code, you must pay some attention.Java2WSDLConsider the following java interface which uses java.util.Date as a return type as well as a method parameter.public interface MyService { public java.util.Date getNextDate(); public void updateLastRun(java.util.Date date);}When the Java2WDSL tool generates a WSDL for a class with a Date field, it will represent java.util.Date fields as dateTime fields in WSDL. The generated WSDL file would look as follows.<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://service" xmlns:apachesoap="http://xml.apache.org/x ml-soap" xmlns:impl="http://service" xmlns:intf="http://service" xmlns:soapenc="http://schemas.xmlsoap.org /soap/encoding/" xmlns:wsdl="h...
More About: Java , Tech , Web Services
Java2WDSL & WSDL2Java - java.util.Date not handled consistently
2008-07-16 07:28:00
Java2WSDL and WSDL2Java tools in Axis (1.4) are pretty handy tools. Those help you to generate a WSDL from a java class as well as generating stubs/skeletons from a WSDL. But if you are dealing with java.util.Date fields in your code, you must pay some attention.Java2WSDLConsider the following java interface which uses java.util.Date as a return type as well as a method parameter.public interface MyService { public java.util.Date getNextDate(); public void updateLastRun(java.util.Date date);}When the Java2WDSL tool generates a WSDL for a class with a Date field, it will represent java.util.Date fields as dateTime fields in WSDL. The generated WSDL file would look as follows.<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://service" xmlns:apachesoap="http://xml.apache.org/x ml-soap" xmlns:impl="http://service" xmlns:intf="http://service" xmlns:soapenc="http://schemas.xmlsoap.org /soap/encoding/" xmlns:wsdl="h...
More About: Java , Tech
Java Sorting: Comparator vs Comparable Tutorial
2008-07-10 15:11:00
Java Comparators and Comparables? What are they? How do we use them? This is a question we received from one of our readers. This article will discuss the java.lang.Comparator and java.lang.Comparable in details with a set of sample codes for further clarifications.PrerequisitesBasic Java knowledgeSystem RequirementsJDK installedWhat are Java Comparators and Comparables?As both names suggest (and you may have guessed), these are used for comparing objects in Java. Using these concepts; Java objects can be sorted according to a predefined order.Two of these concepts can be explained as follows.ComparableA comparable object is capable of comparing itself with another object. The class itself must implements the java.lang.Comparable interface in order to be able to compare its instances.ComparatorA comparator object is capable of comparing two different objects. The class is not comparing its instances, but some other class?s instances. This comparator class must implement the java.lan...
More About: Tutorial , Java , Tech , Sorting
Java Sorting: Comparator vs Comparable Tutorial
2008-07-10 15:11:00
Java Comparators and Comparables? What are they? How do we use them? This is a question we received from one of our readers. This article will discuss the java.lang.Comparator and java.lang.Comparable in details with a set of sample codes for further clarifications.PrerequisitesBasic Java knowledgeSystem RequirementsJDK installedWhat are Java Comparators and Comparables?As both names suggest (and you may have guessed), these are used for comparing objects in Java. Using these concepts; Java objects can be sorted according to a predefined order.Two of these concepts can be explained as follows.ComparableA comparable object is capable of comparing itself with another object. The class itself must implements the java.lang.Comparable interface in order to be able to compare its instances.ComparatorA comparator object is capable of comparing two different objects. The class is not comparing its instances, but some other class?s instances. This comparator class must implement the java.lan...
More About: Tutorial , Java , Tech , Sorting
Java Sorting: Comparator vs Comparable Tutorial
2008-07-10 15:11:00
Java Comparators and Comparables? What are they? How do we use them? This is a question we received from one of our readers. This article will discuss the java.lang.Comparator and java.lang.Comparable in details with a set of sample codes for further clarifications.PrerequisitesBasic Java knowledgeSystem RequirementsJDK installedWhat are Java Comparators and Comparables?As both names suggest (and you may have guessed), these are used for comparing objects in Java. Using these concepts; Java objects can be sorted according to a predefined order.Two of these concepts can be explained as follows.ComparableA comparable object is capable of comparing itself with another object. The class itself must implements the java.lang.Comparable interface in order to be able to compare its instances.ComparatorA comparator object is capable of comparing two different objects. The class is not comparing its instances, but some other class?s instances. This comparator class must implement the java.lan...
More About: Tutorial , Java , Tech , Sorting
Java Sorting: Comparator vs Comparable Tutorial
2008-07-10 15:11:00
Java Comparators and Comparables? What are they? How do we use them? This is a question we received from one of our readers. This article will discuss the java.lang.Comparator and java.lang.Comparable in details with a set of sample codes for further clarifications.PrerequisitesBasic Java knowledgeSystem RequirementsJDK installedWhat are Java Comparators and Comparables?As both names suggest (and you may have guessed), these are used for comparing objects in Java. Using these concepts; Java objects can be sorted according to a predefined order.Two of these concepts can be explained as follows.ComparableA comparable object is capable of comparing itself with another object. The class itself must implements the java.lang.Comparable interface in order to be able to compare its instances.ComparatorA comparator object is capable of comparing two different objects. The class is not comparing its instances, but some other class?s instances. This comparator class must implement the java.lan...
More About: Tutorial , Java , Tech , Sorting
Java Sorting: Comparator vs Comparable Tutorial
2008-07-10 15:11:00
Java Comparators and Comparables? What are they? How do we use them? This is a question we received from one of our readers. This article will discuss the java.lang.Comparator and java.lang.Comparable in details with a set of sample codes for further clarifications.PrerequisitesBasic Java knowledgeSystem RequirementsJDK installedWhat are Java Comparators and Comparables?As both names suggest (and you may have guessed), these are used for comparing objects in Java. Using these concepts; Java objects can be sorted according to a predefined order.Two of these concepts can be explained as follows.ComparableA comparable object is capable of comparing itself with another object. The class itself must implements the java.lang.Comparable interface in order to be able to compare its instances.ComparatorA comparator object is capable of comparing two different objects. The class is not comparing its instances, but some other class?s instances. This comparator class must implement the java.lan...
More About: Tutorial , Java , Tech , Sorting
More articles from this author:
1, 2, 3, 4, 5, 6, 7
82246 blogs in the directory.
Statistics resets every week.


Contact | About
© Blog Toplist 2009 - Supported by Web Catalog - SEO by FeWorks
eXTReMe Tracker