Archive : Java

RSS feed
How to subtract two array lists in Java

How to subtract two array lists in Java

list1.removeAll(list2); will do the job, but it cost you N1*N2 operations . If you work with big arrays you can improve performance like this: public <T> List<T> subtract(List<T> list1, List<T> list2) { List<T> result = new ArrayList<T>(); Set<T> set2 =...
Filed in: Java
0
How to get MAC address using Java

How to get MAC address using Java

Previously for obtaining a MAC address we need to use a native code as a solution. In JDK 1.6 a new method is added in the java.net.NetworkInterface class, this method isgetHardwareAddress(). import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; public...
Filed in: Java
6
How to get real path in JSF

How to get real path in JSF

To get the real path we first need the servlet context ServletContext ctx = (ServletContext) FacesContext.getCurrentInstance() .getExternalContext().getContext(); After getting the servlet  context now we are able to get the real path String deploymentDirectoryPath = ctx.getRealPath("/");
Filed in: JSF, Java
1
Quartz Job Scheduler

Quartz Job Scheduler

Quartz Overview Quartz is a full-featured, open source job scheduling service that can be integrated with, or used along side virtually any Java EE or Java SE application – from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex...
Filed in: Java
3
Tomcat POST Size Limit

Tomcat POST Size Limit

Apache Tomcat has a limit on the size of request that can be made using the POST HTTP method. Some time we need to submit data more than the limit. This article describes how this limit can be removed, enabling very large amount of data to be sent on server. Remove POST size limit If we send large amount...
Filed in: Java
0
JSF 2.0: Introduction and Overview

JSF 2.0: Introduction and Overview

JavaServer Faces (JSF) is a Java-based Web application framework intended to simplify development integration of web-based user interfaces. JSF is a request-driven MVC web framework based on component driven UI design model, using XML files called view templates or Facelets views. Requests are processed...
Filed in: HTML, JSF, Java
15
Print the Stack Trace of the Exception to a String

Print the Stack Trace of the Exception to a String

When an exception occurs, this code snippet will print the stack trace of the exception to a string. This way, the exception stack trace at runtime can be recorded in log file. public static String getStackTrace(Throwable t) { StringWriter sw = new StringWriter(); PrintWriter pw...
Filed in: Java
0
Special Characters

Special Characters

To make special characters and accented letters show up on your pages, use a special set of codes called character entities, which you insert into your HTML code and which your browser will display as the corresponding symbols or characters you want. The most common character entities have been collected...
Filed in: HTML, Java, Javascript
3
Collection Iterator

Collection Iterator

In this section, you will get the detailed explanation about the hasNext() method of interface Iterator. We are going to usehasNext() method of interface Iterator in Java. The description of the code is given below for the usage of the method. Description of the code: Here, you will get to know about...
Filed in: Java
4
Collections Framework

Collections Framework

Java provides the Collections Framework. In the Collection Framework, a collection represents the group of the objects. And a collection framework is the unified architecture that represent and manipulate collections. The collection framework provides a standard common programming interface to many of...
Filed in: Java
1
© 2010 Developer Articles. All rights reserved.
Powered by: Aaban Technologies