How Much Faster Is Java 8?

java-thumbnail

Java SE 8 was released last month (March 18, 2014). Traditionally, every new major JRE version comes with a free performance boost. Do we get another free lunch? And how big is the gain this time? Let’s benchmark it. Benchmark methodology Run the same code with 3 different JRE versions (SunJDK 1.6.0_26, OpenJDK 1.7.0_51 and OpenJDK 1.8.0). The code […]

How To Get Bean Property Details In Java

java-thumbnail

Java API jabs java.bean package for working with the Java beans and its properties. In our previous example I have explained how to write bean PropertyChangeListener. This example is just an extension to that post and it provides the sample for getting the property method details. Lets look at the example. BeanPropertyDetails.java Bean.java Output…

How to Write Bean PropertyChangeListener in Java

java-thumbnail

Property change events occur when ever there is change in the property values. We assume that the component conforms with the Java Bean specification. JavaBean s property is accessed using the set or get methods. These methods are invoked by the application for setting or getting the values from the bean. This doesn’t have any […]

How To Split String In Java

java-thumbnail

If you want to split the String value into the different parts based on the delimiter or regular expression, String class provides split() which does the job. It has two overloaded methods with the following syntax: split(String regex) – Splits this string around matches of the given regular expression. split(String regex, int limit) – Splits […]

Java String IndexOf Example

java-thumbnail

Java String class consist of methods for finding the index of occurrence in the given string literals. If there is no occurrence of the given characters, then it will return the “-1″.  The following are the few methods which is very useful to find the string values. indexOf(char) – Returns the index of the character […]

Java 8 StringJoiner Example

java-thumbnail

Java 8 introduces a new String manipulation API StringJoiner. Using StringJoiner, one can append multiple string values with the pre-defined format like commas, prefix and suffix. This syntax is very similar to the one used with the another framework Guava. StringJoiner Constructors This class takes two constructors: StringJoiner (delimiter) – Adds only the delimiter between the […]

Java String Reverse using Recursion

java-thumbnail

This example shows how to reverse a string using the recursion technique. There are several ways to reverse a string one I have explained using the StringBuffer. Note: The best way is not to choose recursion technique for reversing the string. These concepts are usually used to teach students the recursion , not actual best practices […]

Java String Reverse using StringBuffer Example

java-thumbnail

In this example we shall show you how to reverse the string object by using the Java StringBuffer class. StringBuffer class has a method reverse() which is convenient for reversing a given string value. As it is define in the specification: Causes this character sequence to be replaced by the reverse of the sequence. If […]

Java String ReplaceAll Method Example

java-thumbnail

In this example we shall explain the replaceAll() method in the String class. With the replaceAll() method we can replace the whole or part of the string or character sequences. String objects are immutable and cannot be changed the value. When ever you change the value, new string object is created. This method also creates […]

Java String Intern Method Example

java-thumbnail

String manipulation is one of the most read and confused subject for the Java programmers. String literals are stored in the string pool where identical objects are pointing to the same reference. If you look at the below example, we have created the “JavaBeat” string using the literals and “new” operator. When we create the […]

Close
Please support the site
By clicking any of these buttons you help our site to get better