int is a primitive data type, and as such Java's generics can't handle them. Instead, try using the Integer wrapper class.