Results 1 to 3 of 3
  1. #1
    kkid is offline Senior Member
    Join Date
    Jul 2012
    Posts
    240
    Rep Power
    3

    Default Mapping: "redundant type arguments in new expression (use diamond operator instead)"

    I am getting a notification on the line number in NetBeans saying "redundant type arguments in new expression (use diamond operator instead)".

    I have only just learnt basic mapping theory and this is my first time using it. I have tested my code and the map actually appears to be working perfectly fine - no compilation errors, no runtime errors.



    This is the line of code with the alert put on it.

    Java Code:
    HashMap<String, AtoCSeat> seatMap = new HashMap<String, AtoCSeat>();
    Is there something wrong with it?
    AtoCSeat is my own data type.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: Mapping: "redundant type arguments in new expression (use diamond operator instea

    There is nothing wrong, the IDE is just suggesting you write it as

    Java Code:
    HashMap<String, AtoCSeat> seatMap = new HashMap<>();
    See the Type Inference for Generic Instance Creation notes that come with the JDK 7 sdk.

  3. #3
    kkid is offline Senior Member
    Join Date
    Jul 2012
    Posts
    240
    Rep Power
    3

    Default Re: Mapping: "redundant type arguments in new expression (use diamond operator instea

    ah right, ok, thanks.

Similar Threads

  1. Replies: 1
    Last Post: 01-26-2012, 01:21 AM
  2. Replies: 2
    Last Post: 10-03-2011, 06:22 PM
  3. "Best" implementation of math operator methods?
    By rgrant222 in forum New To Java
    Replies: 2
    Last Post: 09-01-2010, 07:47 AM
  4. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 03:03 AM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

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