Ciao a tutti, vi posto le classi e poi vi spiego il problema:
package graph;
public abstract class Vertex {
	
	/**
	 * The label of this vertex
	 */
	private final String label;
	
	/**
	 * Constructs a vertex with the given label.
	 *  
	 * @param label
	 */
	public Vertex(String label) {
		this.label = label;
	}
	
	/**
	 * Returns the label of this vertex.
	 * 
	 * @return a String which is the label of this vertex.
	 */
	public String getLabel() {
		return this.label;
	}
	
	/**
	 * Returns a string representation of this vertex. 
	 * HINT: potrebbe essere la label stessa.
	 * 
	 * @return a string representation of this vertex
	 */
	@Override
    public abstract String toString();
	
	/**
	 * Returns the graph this vertex belongs to
	 * 
	 * @return the graph this vertex belongs to
	 */
	public abstract Graph getGraph();
	
	/**
	 * Compares this vertex to the specified object. The result is true if and only if 
	 * the argument is not null and is a Vertex object with the same label.
	 * 
	 * @param o The object to compare this Vertex against
	 * 
	 * @return true if the given object represents a vertex with the same label of this vertex, false otherwise
	 */
	@Override
	public boolean equals(Object o) {
		return (o != null) && (o instanceof Vertex) && ((Vertex) o).getLabel() == this.getLabel(); 
	}
}
package impl;
import graph.Graph;
import graph.Vertex;
public class VertexImpl extends Vertex{
	public String label;
	public Graph grafo;
	public String colour;
	public double livello;
	public double endTime;
	public double startTime;
	
	public VertexImpl(String label, Graph grafo, String colour, double livello) {
		super(label);
		this.grafo = grafo;
		this.colour = colour;
		this.livello = livello;
	}
	@Override
	public String toString() {
		return null;
	}
	@Override
	public Graph getGraph() {
		return this.grafo;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((label == null) ? 0 : label.hashCode());
		return result;
	}
}
Poi ho una classe(DirectedGraphAdjListImpl) in cui inizializzo un HashMap<Vertex, LinkedList<Vertex>> in questo modo:
public DirectedGraphAdjListImpl(int numVertices) {
		adj = new HashMap<Vertex, LinkedList<Vertex>>();
		for(int i=1; i <= numVertices; i++) {
			Vertex v = new VertexImpl(Integer.toString(i), this, DEFAULT_VERTEX_COLOUR, Double.POSITIVE_INFINITY);
			adj.put(v, new LinkedList<Vertex>());
		}
	}
Il problema è il seguente:
Se io provo a fare: 
Set<Vertex> set = new HashSet<Vertex>;
set = adj.keySet(); //dove adj è il nome della mia hashmap
Se io stampo questo set, mi crea il giusto numero di chiavi all'interno di set, ma tutte con valore null.
Il fatto è che se invece di fare il procedimento precedente faccio:
for(Vertex v : adj.keySet()){
System.out.println(v);
}
In questo caso mi stampa tranquillamente tutti i vertici, ovvero le chiavi. Non riesco proprio a capire perchè il primo metodo mi da quel problema, che dopotutto è uguale al for successivo. Inoltre i metodi containsKey sembrano non funzionare. 
Credo ci sia un problema di tipo degli oggetti da qualche parte. Il metodo equals mi è stato dato così, quindi non è li il problema. 
Sapete aiutarmi? Grazie mille