question: @ Override public boolean addEdge ( Number edge , Pair < ? extends Integer > endpoints , EdgeType edgeType ) { if ( endpoints == null ) throw new IllegalArgumentException ( "endpoints may not be null" ) ; Integer v1 = endpoints . getFirst ( ) ; Integer v2 = endpoints . getSecond ( ) ; if ( v1 . equals ( v2 ) ) throw new IllegalArgumentException ( "No self-loops" ) ; else return super . addEdge ( edge , endpoints , edgeType ) ; }
target:  This anonymous class works as an UndirectedSparseGraph but will not accept edges that connect a vertex to itself.