Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PriorityQueue in MATLAB using JAVA

17 views
Skip to first unread message

Udaranga

unread,
Jan 29, 2012, 8:19:10 AM1/29/12
to
Hi,
I created a PriorityQueue by using this command.
>>P = java.util.PriorityQueue;

But there is a problem when adding elements. I can only add the first element.
The command I used was
>>P.add({1,1});

When i try to add more i get the below error
-----------------------------------------------------------------------------
??? Java exception occurred:
java.lang.ClassCastException:
[Ljava.lang.Object; cannot be cast to
java.lang.Comparable
at
java.util.PriorityQueue.siftUpComparable(Unknown Source)

at java.util.PriorityQueue.siftUp(Unknown Source)

at java.util.PriorityQueue.offer(Unknown Source)

at java.util.PriorityQueue.add(Unknown Source)
------------------------------------------------------------------------------

Why is that ? What is the solution ??

0 new messages