public static <K, S> Map<K, S> collectMap(final Iterator<S> iterator, final Function<S, K> key) { return collectMap(iterator, key, Function.identity()); }
public static <K, S> Map<K, S> collectMap(final Iterator<S> iterator, final Function<S, K> key) { return collectMap(iterator, key, Function.identity()); }
assertEquals(1, IteratorUtils.count(v.properties())); assertEquals(2, IteratorUtils.count(v.properties("name").next().properties())); final Map<String, Object> valueMap = IteratorUtils.collectMap(v.property("name").properties(), Property::key, Property::value); assertEquals("private", valueMap.get("acl")); assertEquals(2014, valueMap.get("date")); assertEquals(1, IteratorUtils.count(u.properties())); assertEquals(2, IteratorUtils.count(u.properties("name").next().properties())); final Map<String, Object> valueMap = IteratorUtils.collectMap(u.property("name").properties(), Property::key, Property::value); assertEquals("private", valueMap.get("acl")); assertEquals(2014, valueMap.get("date"));
private void writeObject(java.io.ObjectOutputStream stream) throws IOException { Map<String, Object> props = IteratorUtils.collectMap( conf.getKeys(), Function.identity(), key -> conf.getProperty(key)); stream.writeInt(props.size()); props.entrySet().forEach(entry -> { try { stream.writeUTF(entry.getKey()); stream.writeObject(entry.getValue()); } catch (IOException e) { throw new RuntimeException(e); } }); } }
public EdgeIndexWriter(HBaseGraph graph, Edge edge, Iterator<IndexMetadata> indices, Long ts) { this.graph = graph; this.edge = edge; this.keys = IteratorUtils.collectMap(IteratorUtils.filter(indices, i -> i.label().equals(edge.label())), IndexMetadata::propertyKey, IndexMetadata::isUnique); this.ts = ts; }
public VertexIndexRemover(HBaseGraph graph, Vertex vertex, Iterator<IndexMetadata> indices, Long ts) { this.graph = graph; this.vertex = vertex; this.keys = IteratorUtils.collectMap(IteratorUtils.filter(indices, i -> i.label().equals(vertex.label())), IndexMetadata::propertyKey, IndexMetadata::isUnique); this.ts = ts; }
public VertexIndexWriter(HBaseGraph graph, Vertex vertex, Iterator<IndexMetadata> indices, Long ts) { this.graph = graph; this.vertex = vertex; this.keys = IteratorUtils.collectMap(IteratorUtils.filter(indices, i -> i.label().equals(vertex.label())), IndexMetadata::propertyKey, IndexMetadata::isUnique); this.ts = ts; }
public EdgeIndexRemover(HBaseGraph graph, Edge edge, Iterator<IndexMetadata> indices, Long ts) { this.graph = graph; this.edge = edge; this.keys = IteratorUtils.collectMap(IteratorUtils.filter(indices, i -> i.label().equals(edge.label())), IndexMetadata::propertyKey, IndexMetadata::isUnique); this.ts = ts; }
assertEquals(1, IteratorUtils.count(v.properties())); assertEquals(2, IteratorUtils.count(v.properties("name").next().properties())); final Map<String, Object> valueMap = IteratorUtils.collectMap(v.property("name").properties(), Property::key, Property::value); assertEquals("private", valueMap.get("acl")); assertEquals(2014, valueMap.get("date")); assertEquals(1, IteratorUtils.count(u.properties())); assertEquals(2, IteratorUtils.count(u.properties("name").next().properties())); final Map<String, Object> valueMap = IteratorUtils.collectMap(u.property("name").properties(), Property::key, Property::value); assertEquals("private", valueMap.get("acl")); assertEquals(2014, valueMap.get("date"));