I am trying to use Scala's immutable.Vector in Java. Can anyone post an simple Java code for this?
This is what I have tried till now.
- Tried
Vector Builder. - Tried
Vector.concat(Seq<Traversable <A>>)
Here is a sample of what I have tried:
Vector<Long> part1= orignal.slice(0, indexOfMid);
Vector<Long> part2 = orignal.slice(indexOfMid, orignal.size());
orignal= part2.appendFront(1L);
Vector <Traversable<Long>> vectorOfTraversables = Vector.empty();
vectorOfTraversables.appendFront(orignal.toTraversable());
vectorOfTraversables.appendFront(part1.toTraversable());
orignal= Vector.concat(vectorOfTraversables.toSeq());
I am getting the following error
Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.immutable.Vector.concat(Lscala/collection/Seq;)Lscala/collection/immutable/Vector;
Is there a better totally different way to do this? Or am I going wrong somewhere?
concatmakes no sense. You need to construct a new vector entirely.