Saturday, 31 January 2015

Java collection framework

This article talks about the collection framework in Java. Interfaces and classes hierarchy for collections:


Tuesday, 20 January 2015

Comparable and Comparator

By default a collection is sorted in natural order: numbers and Strings are sorted in ascendant order. Note that for Strings upper-cases comes before lower-cases and spaces comes before any characters.You can modify the default behaviour of 'natural order' by implementing a 'Comparable' or/and 'Comparator' interfaces for your classes.

Sunday, 11 January 2015

The statements continue, break and label

In a loop:
  • continue: cease the current iteration and start the next one
  • break: stop the loop in which it is located
  • label: give an identifier to a loop in order to use it with continue or break statements

Monday, 10 November 2014

The switch statement in Java

The "switch" statement works with any values that can be implicitly casted to an "int": "char", "byte", "short", "int" and also "enum". Therefore "switch" does not work with: "long", "float" and "double".

Since Java 7, it is also possible to use a String in the switch statement.

Wednesday, 5 November 2014

String in Java

In Java, the encoding of a String is in UTF-16 by default. A String object is immutable. It means that it is not possible to modify its value. Each time you assign a value to a String variable, this variable refers to a new String object.

Sunday, 2 November 2014

Serialization

Serialization is the action to save the state of an object into a specific format, like for example a string.

Friday, 31 October 2014

Regular expression

This article talks about the classes and quantifiers allowing to execute design pattern on a String.