Top "Classcastexception" questions

The Java exception thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance.

"Iterable<Element> cannot be cast to List<Element>" - Isn't `List` a type of `Iterable`?

I called a getElements method which returns Iterable<Element>. I did this: List<Element> elements = (List&…

java list classcastexception iterable
Caused by: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date

I am getting the below given error for the following code snippets: try { cRows = new CachedRowSetImpl(); while(cRows.next()) { MyClass …

java classcastexception cachedrowset
How to create SortedSet (e.g. TreeSet) for elements of type BitSet

I have a number (power(2,k)) of BitSet objects and I want to store them in a SortedSet. I use …

java classcastexception comparable bitset
ClassCastException: RestTemplate returning List<LinkedHashMap> instead of List<MymodelClass>

I'm trying to access getter methods on my MyModelClass but my code is returning List<LinkedHashMap> instead of …

java android spring classcastexception resttemplate
Primefaces datatable date range filter with filterFunction

I use filterFunction method of datatable on primefaces 5.0. I want to filter birthday by date range on column header. On …

jsf-2 primefaces datatable classcastexception
How to get Boolean value from Object

I tried different ways to fix this, but I am not able to fix it. I am trying to get …

java classcastexception
Hibernate -> ArrayList cannot be cast to Set

I have a Java EE application and I use Hibernate. The domain objects, I changed the List / ArrayList to Set / …

java hibernate arraylist set classcastexception
Generics, arrays, and the ClassCastException

I think there must be something subtle going on here that I don't know about. Consider the following: public class …

java arrays generics classcastexception
ClassCastException: java.lang.Object cannot be cast to java.lang.Integer

The root of my problem is that I have a method that handles JDBC queries and releases all connections after …

java classcastexception