Tag Archives: Java

LocalDate in Java 8

The java.time.LocalDate class is new in Java 8. Inspired by the Joda Time library, LocalDate represents a date as it might be used from a wall calendar. It is not a singular instant in time like java.util.Date. You might use a LocalDate to represent a birthday, the start of a school year, or an anniversary.… Read More »

Using Jersey (JAX-RS) with Spring

Spring does a great job for what it does — dependency injection, transaction management, database query simplification, and plenty of other things. Jersey, the reference JAX-RS implementation, is also excellent for what it does — it simplifies the creation of RESTful web services by providing a framework for defining resources, accessing them, and creating their… Read More »

Enumerating Android Calendars

Android APIs allow you to query information about calendars in your system. Your application can perform typical read, write, update, and delete (CRUD) operations on calendars using a combination of several classes. To retrieve calendar data, you’ll use the following classes: Context ContentResolver Cursor Android security requires that you announce your application’s intentions for calendar… Read More »

Comparison of the Instant and Date Classes

Java 8 has a new java.time package, and one of its new classes is Instant. The best counterpart to this in past platforms is the java.util.Date class. There are a couple notable differences between Date and Instant: Date has very few useful methods, and Instant provides many. Instant provides finer time granularity and a longer timeline. Most… Read More »

The New Date and Time API in Java 8

It’s no secret that developers have been unsatisfied with the existing Date and Calendar classes of previous Java versions. I’ve heard complaints that the Calendar API is difficult to understand, lacks needed features, and even causes unexpected concurrency bugs. As a result, developers sometimes migrated to the popular Joda Time library, which apparently satisfied their… Read More »

Standard Charsets in Java 7

Once in a while I poke my nose through the release notes of new Java releases. It’s not a particularly rewarding activity, but this time I did find something interesting. Oddly enough, it was interesting for what it did NOT say. I was surprised, so I thought you might want to know about a new… Read More »

On Sale Already?

What, already on sale at Amazon? And it’s not even published yet! Java 7 Recipes will release sometime late December 2011.

User error using Java 7 Locale

Yesterday I pushed a blog entry about my experience with the Locale class in Java 7. As I experimented with the class, I discovered a new category enumeration: Locale.Category.DISPLAY Locale.Category.FORMAT I learned some more about the Locale.setDefault methods that indicate a user error on my part. I stated that ResourceBundle is tied to the DISPLAY… Read More »