实例化用户定义类型集合的约定是什么?
2022-09-04 01:38:54
						我有一个名为Matchline的类
    public class MatchingLine implements Comparable
     {
        private String matchingLine;
        private int numberOfMatches;
        // constructor...
        // getters and setters...
        // interface method implementation...
     }
我在ArrayList中使用这个类,如下所示 -
    ArrayList<MatchingLine> matchingLines = new ArrayList<MatchingLine>();
但是,Netbeans IDE 在此语句旁边放置了一个注释,并说:
   redundant type arguments in new expression (use diamond operator instead)
它建议我使用 -
    ArrayList<MatchingLine> matchingLines = new ArrayList<>();
我一直以为以前的风格是惯例?后一种风格是惯例吗?