Results 1 to 3 of 3
  1. #1
    bv_arvind is offline Member
    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    Default Q on using generics in java

    Hi,
    I am using the org.apache.commons.math3 library for an application i am developing. I am using a class called DBSCANclusterer and here is the documentation,
    DBSCANClusterer (Commons Math 3.2 API)
    I am coding using eclipse and I get an error in one of the lines and I was not able to debug it further. Can some one help me?


    Here is what I have,
    List<DoublePoint> data = new ArrayList<DoublePoint>();
    /* Add a few points to the data */
    DBSCANClusterer<? extends Clusterable> dbscan = new DBSCANClusterer<DoublePoint>(10,3);
    List <Cluster<DoublePoint>> clusters = dbscan.cluster(data );

    Above line gives an error,
    The method cluster(Collection<capture#1-of ? extends Clusterable>) in the type DBSCANClusterer<capture#1-of ? extends
    Clusterable> is not applicable for the arguments (List<DoublePoint>)

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: Q on using generics in java

    Moved from Advanced Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    2,936
    Rep Power
    4

    Default Re: Q on using generics in java

    Try changing this:

    Java Code:
    DBSCANClusterer<? extends Clusterable> dbscan = new DBSCANClusterer<DoublePoint>(10,3);
    
    // to this
    
    DBSCANClusterer<DoublePoint> dbscan = new DBSCANClusterer<DoublePoint>(10,3);
    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

Similar Threads

  1. Java Generics
    By zonic in forum New To Java
    Replies: 1
    Last Post: 04-16-2012, 08:23 PM
  2. Regarding java generics
    By JKoder70014 in forum New To Java
    Replies: 3
    Last Post: 08-12-2011, 01:48 AM
  3. Java Generics
    By learn2java in forum Advanced Java
    Replies: 4
    Last Post: 05-05-2011, 07:11 AM
  4. java generics implementation
    By sardare in forum Advanced Java
    Replies: 1
    Last Post: 01-14-2010, 01:51 AM
  5. Generics in java
    By ajeeb in forum Advanced Java
    Replies: 5
    Last Post: 01-23-2009, 04:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •