Java Application Error Jung Library

376 views Asked by At

I am trying to run a Project in Eclipse as a Java application. The error is in one of its class.

public static List<Graph<Integer, String>> graphList = new ArrayList<>(); // Java 7 syntax
public static Graph<Integer, String>[] graph = new Graph[100];

    // populate 'graph'

public static Graph<Integer, String> g=new SparseMultigraph<Integer,String>();

and the error is this : Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems: The type Graph is not generic; it cannot be parameterized with arguments

I tried everything from configuring path to updating JRE system library. I am using java.util.List too. Can anyone please throw some light on how to solve this problem . Thanks

1

There are 1 answers

1
Chaitanya P On

The Graph interface needs Vertex and Edge types specified < V,E >.

public static Graph g=new SparseMultigraph();

Change the above code to something like this:

Graph<Integer, String> g = new SparseMultigraph<Integer, String>();

Refer link below for an example: http://www.grotto-networking.com/JUNG/BasicGraphCreation.java

If you still experience a problem, refer thread below: The type Collection is not generic; it cannot be parameterized with arguments <? extends E>