mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 18:10:43 +01:00
Merge pull request #5134 from rbonifacio/refactor-towards-language-evolution
Refactor to use a few Java 8 features
This commit is contained in:
@@ -81,7 +81,7 @@ public class VariableInspector extends JDialog {
|
||||
// protected Debugger dbg;
|
||||
|
||||
/// list of expanded tree paths. (using list to maintain the order of expansion)
|
||||
protected List<TreePath> expandedNodes = new ArrayList<TreePath>();
|
||||
protected List<TreePath> expandedNodes = new ArrayList<>();
|
||||
|
||||
|
||||
public VariableInspector(final JavaEditor editor) {
|
||||
@@ -696,7 +696,7 @@ public class VariableInspector extends JDialog {
|
||||
// first remove all children of collapsed path
|
||||
// this makes sure children do not appear before parents in the list.
|
||||
// (children can't be expanded before their parents)
|
||||
List<TreePath> removalList = new ArrayList<TreePath>();
|
||||
List<TreePath> removalList = new ArrayList<>();
|
||||
for (TreePath path : expandedNodes) {
|
||||
if (path.getParentPath().equals(tee.getPath())) {
|
||||
removalList.add(path);
|
||||
@@ -911,7 +911,7 @@ public class VariableInspector extends JDialog {
|
||||
* @return the filtered list.
|
||||
*/
|
||||
protected List<VariableNode> filterNodes(List<VariableNode> nodes, VariableNodeFilter filter) {
|
||||
List<VariableNode> filtered = new ArrayList<VariableNode>();
|
||||
List<VariableNode> filtered = new ArrayList<>();
|
||||
for (VariableNode node : nodes) {
|
||||
if (filter.accept(node)) {
|
||||
filtered.add(node);
|
||||
|
||||
@@ -52,9 +52,7 @@ public class ArrayFieldNode extends VariableNode {
|
||||
public void setValue(Value value) {
|
||||
try {
|
||||
array.setValue(index, value);
|
||||
} catch (InvalidTypeException ex) {
|
||||
Messages.loge(null, ex);
|
||||
} catch (ClassNotLoadedException ex) {
|
||||
} catch (InvalidTypeException | ClassNotLoadedException ex) {
|
||||
Messages.loge(null, ex);
|
||||
}
|
||||
this.value = value;
|
||||
|
||||
@@ -51,9 +51,7 @@ public class LocalVariableNode extends VariableNode {
|
||||
public void setValue(Value value) {
|
||||
try {
|
||||
frame.setValue(var, value);
|
||||
} catch (InvalidTypeException ex) {
|
||||
Messages.loge(null, ex);
|
||||
} catch (ClassNotLoadedException ex) {
|
||||
} catch (InvalidTypeException | ClassNotLoadedException ex) {
|
||||
Messages.loge(null, ex);
|
||||
}
|
||||
this.value = value;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class VariableNode implements MutableTreeNode {
|
||||
protected String type;
|
||||
protected String name;
|
||||
protected Value value;
|
||||
protected List<MutableTreeNode> children = new ArrayList<MutableTreeNode>();
|
||||
protected List<MutableTreeNode> children = new ArrayList<>();
|
||||
protected MutableTreeNode parent;
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ package processing.mode.java.tweak;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class SketchParser {
|
||||
@@ -581,11 +582,9 @@ public class SketchParser {
|
||||
for (int i = 0; i < codeTabs.length; i++) {
|
||||
List<ColorControlBox> toDelete = new ArrayList<ColorControlBox>();
|
||||
for (String context : multipleContexts) {
|
||||
for (ColorControlBox ccb : colorBoxes.get(i)) {
|
||||
if (ccb.drawContext.equals(context) && !ccb.isHex) {
|
||||
toDelete.add(ccb);
|
||||
}
|
||||
}
|
||||
toDelete = colorBoxes.get(i).stream()
|
||||
.filter(ccb -> ccb.drawContext.equals(context) && !ccb.isHex)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
colorBoxes.get(i).removeAll(toDelete);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user