Very simple way to avoid class cast exception which occurs at the run time when we use "ArrayList.toArray()" function is,
Object[] objArray = mylist.toArray(new Entry[mylist.size()]);
Entry[] entry = (Entry[]) objArray;
Object[] objArray = mylist.toArray(new Entry[mylist.size()]);
Entry[] entry = (Entry[]) objArray;
Here 'Entry' is a class object ..
No comments:
Post a Comment