I am looking to cast class com.google.common.collect.HashBasedTable to com.google.common.collect.TreeBasedTable.
Casting does not work.
class com.google.common.collect.HashBasedTable cannot be cast to class com.google.common.collect.TreeBasedTable
Is there an efficient way to do this ?
These are two different implementations for generic
Tableand thus cannot just be cast (similarly toArrayListandLinkedList, which cannot be case one to another).You can however copy contents of any table to a new one, in your case: