Skip to content

Instantly share code, notes, and snippets.

@okram
Created December 17, 2013 16:10
Show Gist options
  • Save okram/8007471 to your computer and use it in GitHub Desktop.
Save okram/8007471 to your computer and use it in GitHub Desktop.
public interface Vertex extends Element {
static final String V = "v";
static final String L_BRACKET = "[";
static final String R_BRACKET = "]";
public default Set<String> getPropertyKeys() {
return this.getProperties().keySet();
}
public Map<String, Iterable<Vertex.Property>> getProperties();
public <V> Iterable<Vertex.Property<V>> getProperties(String key);
public default <V> Iterable<V> getValues(String key) {
return () -> (Iterator) StreamFactory.stream(getProperties(key)).filter(p -> p.isPresent()).map(p -> p.<V>getValue()).iterator();
}
public <V> Vertex.Property<V> getProperty(String key);
public <V> Vertex.Property<V> setProperty(String key, V value);
public <V> Vertex.Property<V> addProperty(String key, V value);
public VertexQuery query();
public Edge addEdge(String label, Vertex inVertex, Object... keyValues);
public default String toString() {
return V + L_BRACKET + this.getId() + R_BRACKET;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment