This content has been marked as final. Show 3 replies
rickbecraft wrote:The variable path has a type of Vector but clone() returns an Object. It is only a warning, not an error, so you can ignore it - I think you can be confident that clone() will always return a Vector. A slightly more typesafe approach (in my opinion) is to create a new Vector<Long> using the constructor that takes a Collection as an argument, passing in the Vector that you want to clone. Something like
I am getting the following warning when I compile my code. Please help.
warning: [unchecked] unchecked cast
found : java.lang.Object
copy.path = (Vector<Long>) this.path.clone();
copy.path = new Vector<Long>(this.path);