Skip to content
Bartosz Radaczyński edited this page Sep 12, 2013 · 4 revisions
public static int square(int x) {
    return x * x;
}

import java.util.Date;
public static Date oneYearFrom(Date date) {
    date.setYear(date.getYear()+1);
    return date;
}

import org.joda.time.DateTime;
public static DateTime oneYearFrom(DateTime date) {
    MutableDateTime temp = new MutableDateTime(date);
    temp.addYears(1);
    return temp.toDateTime();
}

new Foo("bar");
Boolean.TRUE;
"  abcde   ".trim();
person.getAddress().getCountry().getCode();
person.setFirstName("Bartosz");
person.setLastName("Radaczyński");
person.setAge(35);

new Callable<Integer>() {

    @Override
    public Integer call() throws Exception {
        return 12;
    }
}
Clone this wiki locally