Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Java version of Clojure's or Scala's persistent immutable vector?

That is, immutable but data sharing with effectively O(1) indexing.

like image 289
Duncan McGregor Avatar asked Apr 14 '13 10:04

Duncan McGregor


People also ask

What is a clojure vector?

Advertisements. A Vector is a collection of values indexed by contiguous integers. A vector is created by using the vector method in Clojure.

What is a collection in Clojure?

Clojure collections "collect" values into compound values. There are four key Clojure collection types: vectors, lists, sets, and maps. Of those four collection types, vectors and lists are ordered.


1 Answers

Karl Krukow extracted clojure data structures into standalone library, so you can use it without bringing whole clojure to your project. There is also pcollections which has TreePVector implementation (with logarithmic time lookups).

like image 194
om-nom-nom Avatar answered Oct 19 '22 11:10

om-nom-nom