diff --git a/enterprise/web.debug/src/org/netbeans/modules/web/debug/variablesfilterring/JSPVariablesFilter.java b/enterprise/web.debug/src/org/netbeans/modules/web/debug/variablesfilterring/JSPVariablesFilter.java index 612e909131e2..19a6eb1de991 100644 --- a/enterprise/web.debug/src/org/netbeans/modules/web/debug/variablesfilterring/JSPVariablesFilter.java +++ b/enterprise/web.debug/src/org/netbeans/modules/web/debug/variablesfilterring/JSPVariablesFilter.java @@ -319,7 +319,7 @@ private static boolean isLeafType (String type) { //--------------------------------------------------------------------------------------- public static class ImplicitLocals { - private List locals = new ArrayList (); + private List locals = new ArrayList<>(); private static HashSet localsNames = null; public static boolean isImplicitLocal(String aLocalName) { @@ -343,7 +343,7 @@ void addLocal (LocalVariable local) { locals.add (local); } - List getLocals () { + List getLocals () { return locals; } @@ -358,7 +358,7 @@ public int hashCode () { } public static class AttributeMap {// extends java.util.HashMap { - private ArrayList attributes = new ArrayList(); + private ArrayList attributes = new ArrayList<>(); private ObjectVariable owner = null; private String ownerName = null; @@ -391,7 +391,7 @@ private void setOwnerName(String aOwnerName) { throw new UnknownOwnerNameException(aOwnerName); } - public ArrayList getAttributes() { return attributes; } + public ArrayList getAttributes() { return attributes; } public String getOwnerName() { return ownerName; } public class Attribute { diff --git a/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderSqlCompletion.java b/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderSqlCompletion.java index fc16fc5b2cf4..815b9747cbb0 100644 --- a/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderSqlCompletion.java +++ b/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/querybuilder/QueryBuilderSqlCompletion.java @@ -45,7 +45,7 @@ */ public class QueryBuilderSqlCompletion extends DefaultStyledDocument { - private List dictionary = new ArrayList(); + private List dictionary = new ArrayList<>(); private JTextComponent comp; private int charCount = -1; private int lastOffset = 0; @@ -91,8 +91,8 @@ public void insertString(int offs, String str, AttributeSet a) throws BadLocatio // Compare prefix of chars typed with sqlReservedWords from QueryBuilderSqlTextArea public String completeText( String text ) { - for( Iterator i = dictionary.iterator(); i.hasNext(); ) { - String word = (String) i.next(); + for( Iterator i = dictionary.iterator(); i.hasNext(); ) { + String word = i.next(); if( word.startsWith( text ) ) { return word.substring( text.length() ); } else if (word.startsWith(text.toUpperCase())) diff --git a/ide/editor.fold/src/org/netbeans/modules/editor/fold/FoldHierarchyTransactionImpl.java b/ide/editor.fold/src/org/netbeans/modules/editor/fold/FoldHierarchyTransactionImpl.java index b50a5eb78da8..c8f938c32976 100644 --- a/ide/editor.fold/src/org/netbeans/modules/editor/fold/FoldHierarchyTransactionImpl.java +++ b/ide/editor.fold/src/org/netbeans/modules/editor/fold/FoldHierarchyTransactionImpl.java @@ -117,7 +117,7 @@ public final class FoldHierarchyTransactionImpl { * starting with folds with the highest priority * going to folds with the lowest priority. */ - private List unblockedFoldLists = new ArrayList(4); + private List> unblockedFoldLists = new ArrayList<>(4); /** * Maximum priority of the unblocked folds added @@ -1191,9 +1191,9 @@ private void unblockBlocked(Fold block) { Fold blocked = (Fold)it.next(); int priority = getOperation(blocked).getPriority(); while (unblockedFoldLists.size() <= priority) { - unblockedFoldLists.add(new ArrayList(4)); + unblockedFoldLists.add(new ArrayList<>(4)); } - ((List)unblockedFoldLists.get(priority)).add(blocked); + unblockedFoldLists.get(priority).add(blocked); if (priority > unblockedFoldMaxPriority) { unblockedFoldMaxPriority = priority; } @@ -1208,11 +1208,11 @@ private void processUnblocked() { ApiPackageAccessor api = ApiPackageAccessor.get(); if (unblockedFoldMaxPriority >= 0) { // some folds became unblocked for (int priority = unblockedFoldMaxPriority; priority >= 0; priority--) { - List foldList = (List)unblockedFoldLists.get(priority); + List foldList = unblockedFoldLists.get(priority); Fold rootFold = execution.getRootFold(); for (int i = foldList.size() - 1; i >= 0; i--) { // Remove last fold from the list - Fold unblocked = (Fold)foldList.remove(i); + Fold unblocked = foldList.remove(i); if (!execution.isAddedOrBlocked(unblocked)) { // not yet processed unblockedFoldMaxPriority = -1; diff --git a/ide/editor.lib/src/org/netbeans/editor/StatusBar.java b/ide/editor.lib/src/org/netbeans/editor/StatusBar.java index 752ad18da5c5..8caf38e406b3 100644 --- a/ide/editor.lib/src/org/netbeans/editor/StatusBar.java +++ b/ide/editor.lib/src/org/netbeans/editor/StatusBar.java @@ -131,7 +131,7 @@ public static void setGlobalCell(String cellName, JLabel globalCell) { private boolean visible; - private List cellList = new ArrayList(); + private List cellList = new ArrayList<>(); private Caret caret; @@ -409,7 +409,7 @@ public void addCustomCell(int i, JLabel c) { private void addCellImpl(int i, JLabel c) { synchronized (cellList) { - ArrayList newCellList = new ArrayList(cellList); + List newCellList = new ArrayList<>(cellList); int cnt = newCellList.size(); if (i < 0 || i > cnt) { i = cnt; @@ -440,29 +440,29 @@ private void updateCellBorders(int addedIndex) { } if (cellCount == 1) { // only one cell - ((JLabel)cellList.get(0)).setBorder(onlyOneBorder); + cellList.get(0).setBorder(onlyOneBorder); return; } if (addedIndex == 0) { // added as first, updates second - ((JLabel)cellList.get(0)).setBorder(leftBorder); - JLabel second = (JLabel)cellList.get(1); + cellList.get(0).setBorder(leftBorder); + JLabel second = cellList.get(1); second.setBorder(cellCount == 2 ? rightBorder : innerBorder); } else if (addedIndex == cellCount - 1) { // added as last, updates previous - ((JLabel)cellList.get(cellCount - 1)).setBorder(rightBorder); - JLabel previous = (JLabel)cellList.get(cellCount - 2); + cellList.get(cellCount - 1).setBorder(rightBorder); + JLabel previous = cellList.get(cellCount - 2); previous.setBorder(cellCount == 2 ? leftBorder : innerBorder); } else { // cell added inside - ((JLabel)cellList.get(addedIndex)).setBorder(innerBorder); + cellList.get(addedIndex).setBorder(innerBorder); } } public JLabel getCellByName(String name) { - Iterator i = cellList.iterator(); + Iterator i = cellList.iterator(); while (i.hasNext()) { - JLabel c = (JLabel)i.next(); + JLabel c = i.next(); if (name.equals(c.getName())) { return c; } @@ -554,9 +554,9 @@ public void setText(String text, int importance) { private void refreshPanel() { if (isVisible()) { // refresh only if visible // Apply coloring to all cells - Iterator it = cellList.iterator(); + Iterator it = cellList.iterator(); while (it.hasNext()) { - JLabel c = (JLabel)it.next(); + JLabel c = it.next(); JTextComponent jtc = editorUI.getComponent(); if (c instanceof Cell && jtc != null /*#141362 Check editorUI.getComponent() not null*/) { Coloring col = getColoring( @@ -577,7 +577,7 @@ private void refreshPanel() { it = cellList.iterator(); while (it.hasNext()) { - JLabel c = (JLabel)it.next(); + JLabel c = it.next(); boolean main = CELL_MAIN.equals(c.getName()); if (main) { gc.fill = GridBagConstraints.HORIZONTAL; diff --git a/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/XMLSchemaParser.java b/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/XMLSchemaParser.java index 0f077bf3eb5d..4370fb9f1381 100644 --- a/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/XMLSchemaParser.java +++ b/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/XMLSchemaParser.java @@ -42,7 +42,7 @@ public class XMLSchemaParser extends GeneralParser implements SchemaParser { private Stack parentUniqueNames = new Stack(); private String lastDefinedType = null; private boolean lastDefinedExternalType = true; - private List perAttributeExtraData = new LinkedList(); + private List perAttributeExtraData = new LinkedList<>(); private String targetNamespace; private Map elementsAlreadyDefined = new IdentityHashMap(); @@ -362,7 +362,7 @@ protected void processElement(SchemaRep.Element el) throws Schema2BeansException handler.addExtraDataCurLink(new MinOccursRestriction(el.getMinOccurs())); } if (perAttributeExtraData.size() > 0) { - for (Iterator it = perAttributeExtraData.iterator(); it.hasNext(); ) { + for (Iterator it = perAttributeExtraData.iterator(); it.hasNext(); ) { handler.addExtraDataCurLink(it.next()); } } diff --git a/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/dbscript/DBScriptWizardDescriptor.java b/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/dbscript/DBScriptWizardDescriptor.java index c02d8ff17329..2202351189df 100644 --- a/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/dbscript/DBScriptWizardDescriptor.java +++ b/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/dbscript/DBScriptWizardDescriptor.java @@ -37,7 +37,7 @@ public class DBScriptWizardDescriptor implements WizardDescriptor.FinishablePanel, ChangeListener { private DBScriptPanel.WizardPanel p; - private List changeListeners = new ArrayList(); + private List changeListeners = new ArrayList<>(); private WizardDescriptor wizardDescriptor; private Project project; diff --git a/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/entity/EntityWizardDescriptor.java b/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/entity/EntityWizardDescriptor.java index db1885b15b14..a51dbbc70e01 100644 --- a/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/entity/EntityWizardDescriptor.java +++ b/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/entity/EntityWizardDescriptor.java @@ -43,7 +43,7 @@ public class EntityWizardDescriptor implements WizardDescriptor.FinishablePanel, ChangeListener { private EntityWizardPanel p; - private List changeListeners = new ArrayList(); + private List changeListeners = new ArrayList<>(); private WizardDescriptor wizardDescriptor; private Project project; diff --git a/java/performance/imagecache/src/org/netbeans/imagecache/CacheWriterTask.java b/java/performance/imagecache/src/org/netbeans/imagecache/CacheWriterTask.java index e61dc1f7850e..4778fc7495de 100644 --- a/java/performance/imagecache/src/org/netbeans/imagecache/CacheWriterTask.java +++ b/java/performance/imagecache/src/org/netbeans/imagecache/CacheWriterTask.java @@ -39,7 +39,7 @@ */ public class CacheWriterTask extends Task { private File outDir = null; - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); private boolean clean = true; /** Creates a new instance of CacheWriterTask */ public CacheWriterTask() { @@ -68,14 +68,14 @@ public void execute() throws BuildException { if (outDir == null) { throw new BuildException ("Output directory for cache file must be specified"); } - + try { CacheWriter writer = new CacheWriter(); writer.setDir(outDir.toString(), clean); - Iterator it = paths.iterator(); + Iterator it = paths.iterator(); while (it.hasNext()) { - Path curr = (Path) it.next(); + Path curr = it.next(); String[] dirs = curr.list(); for (int i=0; i < dirs.length; i++) { System.err.println("WriteDir " + dirs[i]); diff --git a/java/performance/sparrow/src/org/netbeans/performance/antext/ForEachFileTask.java b/java/performance/sparrow/src/org/netbeans/performance/antext/ForEachFileTask.java index 8975c12b90ae..a7019c1209a8 100644 --- a/java/performance/sparrow/src/org/netbeans/performance/antext/ForEachFileTask.java +++ b/java/performance/sparrow/src/org/netbeans/performance/antext/ForEachFileTask.java @@ -35,7 +35,7 @@ public void setTarget(String t) { subTarget = t; } - private List filesets = new LinkedList(); // List + private List filesets = new LinkedList<>(); public void addFileset(FileSet fs) { filesets.add(fs); } @@ -56,9 +56,9 @@ public void addParam(Param p) { public void execute() throws BuildException { if (subTarget == null) throw new BuildException("No subtarget set."); if (filesets.isEmpty()) throw new BuildException("No files to process - fileset is empty"); - Iterator it = filesets.iterator(); + Iterator it = filesets.iterator(); while (it.hasNext()) { - FileSet fs = (FileSet)it.next(); + FileSet fs = it.next(); DirectoryScanner ds = fs.getDirectoryScanner(project); File basedir = ds.getBasedir(); String[] files = ds.getIncludedFiles(); diff --git a/platform/openide.explorer/src/org/openide/explorer/view/ListView.java b/platform/openide.explorer/src/org/openide/explorer/view/ListView.java index f3a736590fcf..a2c0a9a70440 100644 --- a/platform/openide.explorer/src/org/openide/explorer/view/ListView.java +++ b/platform/openide.explorer/src/org/openide/explorer/view/ListView.java @@ -1194,7 +1194,7 @@ public String getAccessibleDescription() { private class SearchFieldListener extends KeyAdapter implements DocumentListener, FocusListener { /** The last search results */ - private List results = new ArrayList(); + private List results = new ArrayList<>(); /** The last selected index from the search results. */ private int currentSelectionIndex; @@ -1272,9 +1272,9 @@ private void displaySearchResult() { currentSelectionIndex = 0; } - Integer index = (Integer) results.get(currentSelectionIndex); - list.setSelectedIndex(index.intValue()); - list.ensureIndexIsVisible(index.intValue()); + Integer index = results.get(currentSelectionIndex); + list.setSelectedIndex(index); + list.ensureIndexIsVisible(index); } else { list.clearSelection(); }