Walk implements Iterable<Set<Edge>> { @JsonIgnore public Set<Entity> getEntitiesAtDistance(final int n) { return entities.get(n).getValue(); } private  Walk(final Builder builder); @JsonCreator  Walk(@JsonProperty("edges") final List<Set<Edge>> edges,
                @JsonProperty("entities") final List<Entry<Object, Set<Entity>>> entities); @JsonIgnore Set<Entity> getEntitiesForVertex(final Object vertex); @JsonIgnore Set<Entity> getEntitiesAtDistance(final int n); List<Set<Edge>> getEdges(); @JsonGetter("entities") List<Entry<Object, Set<Entity>>> getEntitiesAsEntries(); @JsonIgnore List<Set<Entity>> getEntities(); @JsonIgnore List<Object> getVerticesOrdered(); @JsonIgnore Set<Object> getVertexSet(); @JsonIgnore int length(); @JsonIgnore boolean isTrail(); @JsonIgnore boolean isPath(); @JsonIgnore Object getSourceVertex(); @JsonIgnore Object getDestinationVertex(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); @Override Iterator<Set<Edge>> iterator();  }
@Test public void shouldGetEntitiesAtDistance() { final Walk walk = new Walk.Builder() .entity(ENTITY_A) .edge(EDGE_AE) .entities(ENTITY_E, ENTITY_E) .edge(EDGE_ED) .entity(ENTITY_D) .build(); assertThat(walk.getEntitiesAtDistance(2), hasSize(1)); assertThat(walk.getEntitiesAtDistance(2), contains(ENTITY_D)); }