Java Reference
In-Depth Information
cases, the functionality offered by Commons Math or Guava's math classes should suffice, but you
might see this library pop up in a number of very intensive applications.
See http://acs.lbl.gov/ACSSoftware/colt/ .
lombok
Lombok aims to provide a set of features that simplifies the development of Java programs. It
includes functionality to avoid having to write getters and setters manually, or to create a “data”
object in a very straightforward manner. Its website shows the following example:
import lombok.AccessLevel;
import lombok.Setter;
import lombok.Data;
@Data public class DataExample {
private final String name;
@Setter(AccessLevel.PACKAGE) private int age;
private double score;
private String[] tags;
}
This code will automatically create getters, setters, equals , hashCode , and toString .
See http://projectlombok.org/ .
opencsV
Just like the Apache Commons CSV library (see “Apache Commons” above), this is another well-
maintained library for dealing with CSV files. Using this library can be more ideal in projects where
you only desire to add functionality to read and write CSV files, without requiring any other librar-
ies from the Apache Commons project. Including the OpenCSV library is then a simple matter of
including one JAR file in your build path.
Reading a CSV files then becomes as easy as writing the following:
// Read csvfile using comma separator (,), double quote quote character ("),
// and skip the first 1 line(s)
CSVReader reader = new CSVReader(new FileReader("csvfile.csv"), ',', '"', 1);
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
// Do something with nextLine here
}
See http://opencsv.sourceforge.net/ .
html and json libraries
These are libraries to parse HTML and deal with JSON data. Refer back to Chapter 10 of this
book, which deals with web sources.
 
Search WWH ::




Custom Search