diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeOrganizer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeOrganizer.java index b1e50cdedec..85d6601d6cc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeOrganizer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeOrganizer.java @@ -146,7 +146,7 @@ public class IncludeOrganizer { this.name = name; this.declaration = null; this.type = DeclarationType.NAMESPACE; - this.children = new ArrayList(); + this.children = new ArrayList<>(); } /** @@ -214,8 +214,7 @@ public class IncludeOrganizer { // Use a map instead of a set to be able to retrieve existing elements using equal elements. // Maps each element to itself. - Map includePrototypes = - new HashMap(); + Map includePrototypes = new HashMap<>(); // Put the new includes into includePrototypes. for (IPath header : fContext.getHeadersToInclude()) { IncludeGroupStyle style = fContext.getIncludeStyle(header); @@ -258,7 +257,7 @@ public class IncludeOrganizer { int position = allowReordering ? groupingStyle.getOrder() : 0; List prototypes = groupedPrototypes[position]; if (prototypes == null) { - prototypes = new ArrayList(); + prototypes = new ArrayList<>(); groupedPrototypes[position] = prototypes; } prototypes.add(prototype); @@ -280,7 +279,7 @@ public class IncludeOrganizer { } } - List includeDirectives = new ArrayList(); + List includeDirectives = new ArrayList<>(); IncludeGroupStyle previousStyle = null; for (List prototypes : groupedPrototypes) { if (prototypes != null && !prototypes.isEmpty()) { @@ -469,7 +468,7 @@ public class IncludeOrganizer { } // Consider the namespace(s) of the binding. - List namespaces = new ArrayList(); + List namespaces = new ArrayList<>(); try { IScope scope = binding.getScope(); while (scope != null && scope.getKind() == EScopeKind.eNamespace) { @@ -693,7 +692,7 @@ public class IncludeOrganizer { private static int skipStandaloneCommentBlock(String contents, int offset, int endOffset, IASTComment[] comments, NodeCommentMap commentMap) { - Map inverseLeadingMap = new HashMap(); + Map inverseLeadingMap = new HashMap<>(); for (Map.Entry> entry : commentMap.getLeadingMap().entrySet()) { IASTNode node = entry.getKey(); if (getNodeOffset(node) <= endOffset) { @@ -702,7 +701,7 @@ public class IncludeOrganizer { } } } - Map inverseFreestandingMap = new HashMap(); + Map inverseFreestandingMap = new HashMap<>(); for (Map.Entry> entry : commentMap.getFreestandingMap().entrySet()) { IASTNode node = entry.getKey(); if (getNodeEndOffset(node) < endOffset) { @@ -749,10 +748,10 @@ public class IncludeOrganizer { private Set removeBindingsDefinedInIncludedHeaders(IASTTranslationUnit ast, Set bindings, IIndexFileSet reachableHeaders) throws CoreException { - Set filteredBindings = new HashSet(bindings); + Set filteredBindings = new HashSet<>(bindings); List requests = createInclusionRequests(ast, bindings, true, reachableHeaders); - Set allIncludedHeaders = new HashSet(); + Set allIncludedHeaders = new HashSet<>(); allIncludedHeaders.addAll(fContext.getHeadersAlreadyIncluded()); allIncludedHeaders.addAll(fContext.getHeadersToInclude());