use of clojure.lang.APersistentSet in project enumerable by hraberg.
the class ClojureTest method creatingPersistentCollections.
@Test
public void creatingPersistentCollections() throws Exception {
APersistentVector vector = (APersistentVector) vec(list("hello", "world"));
assertEquals("hello", vector.invoke(0));
assertEquals("world", vector.invoke(1));
assertEquals("[\"hello\" \"world\"]", vector.toString());
APersistentSet set = (APersistentSet) set(list("hello", "world"));
assertEquals("hello", set.invoke("hello"));
assertEquals("world", set.invoke("world"));
assertEquals("#{\"hello\" \"world\"}", set.toString());
APersistentMap map = (APersistentMap) zipmap(list("hello", "world"), list(1, 2));
assertEquals(1, map.invoke("hello"));
assertEquals(2, map.invoke("world"));
assertEquals("{\"world\" 2, \"hello\" 1}", map.toString());
}
Aggregations