Skip to content

Commit bd7e765

Browse files
committed
Removed redundant type specifiers for generics
1 parent 72a1d92 commit bd7e765

22 files changed

+52
-52
lines changed

app/src/cc/arduino/view/Event.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class Event extends ActionEvent {
3939

4040
public Event(Object source, int id, String command) {
4141
super(source, id, command);
42-
this.payload = new HashMap<String, Object>();
42+
this.payload = new HashMap<>();
4343
}
4444

4545
public Map<String, Object> getPayload() {

app/src/processing/app/Base.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class Base {
8585
public static volatile Base INSTANCE;
8686

8787
public static SplashScreenHelper splashScreenHelper = new SplashScreenHelper(SplashScreen.getSplashScreen());
88-
public static Map<String, Object> FIND_DIALOG_STATE = new HashMap<String, Object>();
88+
public static Map<String, Object> FIND_DIALOG_STATE = new HashMap<>();
8989
private final ContributionInstaller contributionInstaller;
9090
private final LibraryInstaller libraryInstaller;
9191
private ContributionsSelfCheck contributionsSelfCheck;
@@ -266,7 +266,7 @@ static public File absoluteFile(String path) {
266266

267267
public Base(String[] args) throws Exception {
268268
BaseNoGui.notifier = new GUIUserNotifier(this);
269-
this.recentSketchesMenuItems = new LinkedList<JMenuItem>();
269+
this.recentSketchesMenuItems = new LinkedList<>();
270270

271271
CommandlineParser parser = new CommandlineParser(args);
272272
parser.parseArgumentsPhase1();
@@ -584,15 +584,15 @@ protected void storeRecentSketches(SketchController sketch) {
584584
return;
585585
}
586586

587-
Set<String> sketches = new LinkedHashSet<String>();
587+
Set<String> sketches = new LinkedHashSet<>();
588588
sketches.add(sketch.getSketch().getMainFilePath());
589589
sketches.addAll(PreferencesData.getCollection("recent.sketches"));
590590

591591
PreferencesData.setCollection("recent.sketches", sketches);
592592
}
593593

594594
protected void removeRecentSketchPath(String path) {
595-
Collection<String> sketches = new LinkedList<String>(PreferencesData.getCollection("recent.sketches"));
595+
Collection<String> sketches = new LinkedList<>(PreferencesData.getCollection("recent.sketches"));
596596
sketches.remove(path);
597597
PreferencesData.setCollection("recent.sketches", sketches);
598598
}
@@ -1049,7 +1049,7 @@ protected void rebuildSketchbookMenu(JMenu menu) {
10491049
}
10501050

10511051
private List<ContributedLibrary> getSortedLibraries() {
1052-
List<ContributedLibrary> installedLibraries = new LinkedList<ContributedLibrary>(BaseNoGui.librariesIndexer.getInstalledLibraries());
1052+
List<ContributedLibrary> installedLibraries = new LinkedList<>(BaseNoGui.librariesIndexer.getInstalledLibraries());
10531053
Collections.sort(installedLibraries, new LibraryByTypeComparator());
10541054
Collections.sort(installedLibraries, new LibraryOfSameTypeComparator());
10551055
return installedLibraries;
@@ -1415,7 +1415,7 @@ public void actionPerformed(ActionEvent actionevent) {
14151415
boardMenu.add(new JSeparator());
14161416

14171417
// Generate custom menus for all platforms
1418-
Set<String> customMenusTitles = new HashSet<String>();
1418+
Set<String> customMenusTitles = new HashSet<>();
14191419
for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
14201420
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
14211421
customMenusTitles.addAll(targetPlatform.getCustomMenus().values());
@@ -1427,10 +1427,10 @@ public void actionPerformed(ActionEvent actionevent) {
14271427
boardsCustomMenus.add(customMenu);
14281428
}
14291429

1430-
List<JMenuItem> menuItemsToClickAfterStartup = new LinkedList<JMenuItem>();
1430+
List<JMenuItem> menuItemsToClickAfterStartup = new LinkedList<>();
14311431

14321432
ButtonGroup boardsButtonGroup = new ButtonGroup();
1433-
Map<String, ButtonGroup> buttonGroupsMap = new HashMap<String, ButtonGroup>();
1433+
Map<String, ButtonGroup> buttonGroupsMap = new HashMap<>();
14341434

14351435
// Cycle through all packages
14361436
boolean first = true;
@@ -2129,7 +2129,7 @@ static public byte[] loadBytesRaw(File file) throws IOException {
21292129
* that are separated by = and ignore comments with #.
21302130
*/
21312131
static public HashMap<String, String> readSettings(File inputFile) {
2132-
HashMap<String, String> outgoing = new HashMap<String, String>();
2132+
HashMap<String, String> outgoing = new HashMap<>();
21332133
if (!inputFile.exists()) return outgoing; // return empty hash
21342134

21352135
String lines[] = PApplet.loadStrings(inputFile);

app/src/processing/app/Editor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public void windowActivated(WindowEvent e) {
230230
public void windowDeactivated(WindowEvent e) {
231231
fileMenu.remove(sketchbookMenu);
232232
fileMenu.remove(examplesMenu);
233-
List<Component> toolsMenuItemsToRemove = new LinkedList<Component>();
233+
List<Component> toolsMenuItemsToRemove = new LinkedList<>();
234234
for (Component menuItem : toolsMenu.getMenuComponents()) {
235235
if (menuItem instanceof JComponent) {
236236
Object removeOnWindowDeactivation = ((JComponent) menuItem).getClientProperty("removeOnWindowDeactivation");
@@ -816,7 +816,7 @@ private void addTools(JMenu menu, File sourceFolder) {
816816
if (sourceFolder == null)
817817
return;
818818

819-
Map<String, JMenuItem> toolItems = new HashMap<String, JMenuItem>();
819+
Map<String, JMenuItem> toolItems = new HashMap<>();
820820

821821
File[] folders = sourceFolder.listFiles(new FileFilter() {
822822
public boolean accept(File folder) {
@@ -906,7 +906,7 @@ public void actionPerformed(ActionEvent e) {
906906
e.printStackTrace();
907907
}
908908
}
909-
ArrayList<String> toolList = new ArrayList<String>(toolItems.keySet());
909+
ArrayList<String> toolList = new ArrayList<>(toolItems.keySet());
910910
if (toolList.size() == 0) return;
911911

912912
menu.addSeparator();

app/src/processing/app/PresentMode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class PresentMode {
5959
devices = environment.getScreenDevices();
6060
GraphicsDevice defaultDevice = environment.getDefaultScreenDevice();
6161

62-
Vector<String> names = new Vector<String>();
62+
Vector<String> names = new Vector<>();
6363
for (int i = 0; i < devices.length; i++) {
6464
String name = String.valueOf(i + 1);
6565
if (devices[i] == defaultDevice) {

app/src/processing/app/SerialPlotter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public SerialPlotter(BoardPort port) {
185185
});
186186

187187
messageBuffer = new StringBuffer();
188-
graphs = new ArrayList<Graph>();
188+
graphs = new ArrayList<>();
189189
}
190190

191191
protected void onCreateWindow(Container mainPane) {

app/src/processing/app/Theme.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ public static Map<String, Object> getStyledFont(String what, Font font) {
228228
Font styledFont = new Font(font.getFamily(),
229229
(bold ? Font.BOLD : 0) | (italic ? Font.ITALIC : 0), font.getSize());
230230
if (underlined) {
231-
Map<TextAttribute, Object> attr = new Hashtable<TextAttribute, Object>();
231+
Map<TextAttribute, Object> attr = new Hashtable<>();
232232
attr.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
233233
styledFont = styledFont.deriveFont(attr);
234234
}
235235

236-
Map<String, Object> result = new HashMap<String, Object>();
236+
Map<String, Object> result = new HashMap<>();
237237
result.put("color", color);
238238
result.put("font", styledFont);
239239

arduino-core/src/cc/arduino/UploaderUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public boolean upload(Sketch data, Uploader uploader, String suggestedClassName,
7070

7171
boolean useNewWarningsAccumulator = false;
7272
if (warningsAccumulator == null) {
73-
warningsAccumulator = new LinkedList<String>();
73+
warningsAccumulator = new LinkedList<>();
7474
useNewWarningsAccumulator = true;
7575
}
7676

arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndex.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public String toString() {
6666
}
6767

6868
public List<String> getCategories() {
69-
List<String> categories = new LinkedList<String>();
69+
List<String> categories = new LinkedList<>();
7070
for (ContributedLibrary lib : getLibraries()) {
7171
if (lib.getCategory() != null && !categories.contains(lib.getCategory())) {
7272
categories.add(lib.getCategory());
@@ -78,14 +78,14 @@ public List<String> getCategories() {
7878
}
7979

8080
public List<String> getTypes() {
81-
Collection<String> typesAccumulator = new HashSet<String>();
81+
Collection<String> typesAccumulator = new HashSet<>();
8282
for (ContributedLibrary lib : getLibraries()) {
8383
if (lib.getTypes() != null) {
8484
typesAccumulator.addAll(lib.getTypes());
8585
}
8686
}
8787

88-
List<String> types = new LinkedList<String>(typesAccumulator);
88+
List<String> types = new LinkedList<>(typesAccumulator);
8989
Collections.sort(types);
9090

9191
return types;

arduino-core/src/cc/arduino/contributions/packages/ContributedTargetPackage.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class ContributedTargetPackage implements TargetPackage {
4343

4444
public ContributedTargetPackage(String _id) {
4545
id = _id;
46-
platforms = new HashMap<String, TargetPlatform>();
46+
platforms = new HashMap<>();
4747
}
4848

4949
void addPlatform(TargetPlatform p) {

arduino-core/src/cc/arduino/files/DeleteFilesOnShutdown.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void add(File file) {
4848
private final List<File> files;
4949

5050
public DeleteFilesOnShutdown() {
51-
this.files = new LinkedList<File>();
51+
this.files = new LinkedList<>();
5252
}
5353

5454
public synchronized void addFile(File file) {
@@ -63,7 +63,7 @@ public void run() {
6363
}
6464
List<File> copyOfFiles;
6565
synchronized (this) {
66-
copyOfFiles = new LinkedList<File>(files);
66+
copyOfFiles = new LinkedList<>(files);
6767
}
6868
Collections.reverse(copyOfFiles);
6969
for (File file : copyOfFiles) {

arduino-core/src/cc/arduino/packages/DiscoveryManager.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class DiscoveryManager {
4444
private final NetworkDiscovery networkDiscoverer = new NetworkDiscovery();
4545

4646
public DiscoveryManager() {
47-
discoverers = new ArrayList<Discovery>();
47+
discoverers = new ArrayList<>();
4848
discoverers.add(serialDiscoverer);
4949
discoverers.add(networkDiscoverer);
5050

@@ -76,15 +76,15 @@ public SerialDiscovery getSerialDiscoverer() {
7676
}
7777

7878
public List<BoardPort> discovery() {
79-
List<BoardPort> res = new ArrayList<BoardPort>();
79+
List<BoardPort> res = new ArrayList<>();
8080
for (Discovery d : discoverers) {
8181
res.addAll(d.listDiscoveredBoards());
8282
}
8383
return res;
8484
}
8585

8686
public List<BoardPort> discovery(boolean complete) {
87-
List<BoardPort> res = new ArrayList<BoardPort>();
87+
List<BoardPort> res = new ArrayList<>();
8888
for (Discovery d : discoverers) {
8989
res.addAll(d.listDiscoveredBoards(complete));
9090
}

arduino-core/src/cc/arduino/utils/ArchiveExtractor.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
8686

8787
// Folders timestamps must be set at the end of archive extraction
8888
// (because creating a file in a folder alters the folder's timestamp)
89-
Map<File, Long> foldersTimestamps = new HashMap<File, Long>();
89+
Map<File, Long> foldersTimestamps = new HashMap<>();
9090

9191
ArchiveInputStream in = null;
9292
try {
@@ -106,10 +106,10 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
106106

107107
String pathPrefix = "";
108108

109-
Map<File, File> hardLinks = new HashMap<File, File>();
110-
Map<File, Integer> hardLinksMode = new HashMap<File, Integer>();
111-
Map<File, String> symLinks = new HashMap<File, String>();
112-
Map<File, Long> symLinksModifiedTimes = new HashMap<File, Long>();
109+
Map<File, File> hardLinks = new HashMap<>();
110+
Map<File, Integer> hardLinksMode = new HashMap<>();
111+
Map<File, String> symLinks = new HashMap<>();
112+
Map<File, Long> symLinksModifiedTimes = new HashMap<>();
113113

114114
// Cycle through all the archive entries
115115
while (true) {

arduino-core/src/edazdarevic/commons/net/CIDRUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private void calculate() throws UnknownHostException {
100100

101101
private byte[] toBytes(byte[] array, int targetSize) {
102102
int counter = 0;
103-
List<Byte> newArr = new ArrayList<Byte>();
103+
List<Byte> newArr = new ArrayList<>();
104104
while (counter < targetSize && (array.length - 1 - counter >= 0)) {
105105
newArr.add(0, array[array.length - 1 - counter]);
106106
counter++;

arduino-core/src/processing/app/BaseNoGui.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static public void init(String[] args) throws Exception {
500500
showError(tr("Multiple files not supported"), tr("The --upload option supports only one file at a time"), null);
501501
}
502502

503-
List<String> warningsAccumulator = new LinkedList<String>();
503+
List<String> warningsAccumulator = new LinkedList<>();
504504
boolean success = false;
505505
try {
506506
// Editor constructor loads the sketch with handleOpenInternal() that
@@ -619,7 +619,7 @@ static public void initPackages() throws Exception {
619619
}
620620
indexer.syncWithFilesystem();
621621

622-
packages = new LinkedHashMap<String, TargetPackage>();
622+
packages = new LinkedHashMap<>();
623623
loadHardware(getHardwareFolder());
624624
loadContributedHardware(indexer);
625625
loadHardware(getSketchbookHardwareFolder());
@@ -794,7 +794,7 @@ public static boolean isIDEInstalledIntoSettingsFolder() {
794794
static public void onBoardOrPortChange() {
795795
examplesFolder = getContentFile("examples");
796796
toolsFolder = getContentFile("tools");
797-
librariesFolders = new ArrayList<File>();
797+
librariesFolders = new ArrayList<>();
798798

799799
// Add IDE libraries folder
800800
librariesFolders.add(getContentFile("libraries"));
@@ -874,7 +874,7 @@ static public void populateImportToLibraryTable() {
874874
// a list of libraries. Compiler.java will use only the first
875875
// library on each list. The others are used only to advise
876876
// user of ambiguously matched and duplicate libraries.
877-
importToLibraryTable = new HashMap<String, LibraryList>();
877+
importToLibraryTable = new HashMap<>();
878878
for (UserLibrary lib : librariesIndexer.getInstalledLibraries()) {
879879
try {
880880
String headers[] = headerListFromIncludePath(lib.getSrcFolder());

arduino-core/src/processing/app/Platform.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public String preListAllCandidateDevices() {
177177
}
178178

179179
public List<String> listSerials() {
180-
return new ArrayList<String>(Arrays.asList(listSerialsNative()));
180+
return new ArrayList<>(Arrays.asList(listSerialsNative()));
181181
}
182182

183183
public List<String> listSerialsNames(){
@@ -233,13 +233,13 @@ public synchronized Map<String, Object> resolveDeviceByVendorIdProductId(String
233233
for (TargetPackage targetPackage : packages.values()) {
234234
for (TargetPlatform targetPlatform : targetPackage.getPlatforms().values()) {
235235
for (TargetBoard board : targetPlatform.getBoards().values()) {
236-
List<String> vids = new LinkedList<String>(board.getPreferences().subTree("vid", 1).values());
236+
List<String> vids = new LinkedList<>(board.getPreferences().subTree("vid", 1).values());
237237
if (!vids.isEmpty()) {
238-
List<String> pids = new LinkedList<String>(board.getPreferences().subTree("pid", 1).values());
238+
List<String> pids = new LinkedList<>(board.getPreferences().subTree("pid", 1).values());
239239
for (int i = 0; i < vids.size(); i++) {
240240
String vidPid = vids.get(i) + "_" + pids.get(i);
241241
if (vid_pid_iSerial.toUpperCase().contains(vidPid.toUpperCase())) {
242-
Map<String, Object> boardData = new HashMap<String, Object>();
242+
Map<String, Object> boardData = new HashMap<>();
243243
boardData.put("board", board);
244244
boardData.put("vid", vids.get(i));
245245
boardData.put("pid", pids.get(i));
@@ -286,7 +286,7 @@ protected void showLauncherWarning() {
286286
}
287287

288288
public List<BoardPort> filterPorts(List<BoardPort> ports, boolean aBoolean) {
289-
return new LinkedList<BoardPort>(ports);
289+
return new LinkedList<>(ports);
290290
}
291291

292292
public void fixPrefsFilePermissions(File prefsFile) throws IOException, InterruptedException {

arduino-core/src/processing/app/SerialPortList.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ private static String[] getWindowsPortNames(Pattern pattern, Comparator<String>
310310
if(portNames == null){
311311
return new String[]{};
312312
}
313-
TreeSet<String> ports = new TreeSet<String>(comparator);
313+
TreeSet<String> ports = new TreeSet<>(comparator);
314314
for(String portName : portNames){
315315
if(pattern.matcher(portName).find()){
316316
ports.add(portName);
@@ -329,7 +329,7 @@ private static String[] getUnixBasedPortNames(String searchPath, Pattern pattern
329329
if(dir.exists() && dir.isDirectory()){
330330
File[] files = dir.listFiles();
331331
if(files.length > 0){
332-
TreeSet<String> portsTree = new TreeSet<String>(comparator);
332+
TreeSet<String> portsTree = new TreeSet<>(comparator);
333333
for(File file : files){
334334
String fileName = file.getName();
335335
if(!file.isDirectory() && !file.isFile() && pattern.matcher(fileName).find()){

arduino-core/src/processing/app/Sketch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class Sketch {
2727
*/
2828
private File folder;
2929

30-
private List<SketchFile> files = new ArrayList<SketchFile>();
30+
private List<SketchFile> files = new ArrayList<>();
3131

3232
private File buildPath;
3333

arduino-core/src/processing/app/helpers/FileUtils.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public static String readFileToString(File file, String encoding) throws IOExcep
210210
}
211211

212212
public static List<String> readFileToListOfStrings(File file) throws IOException {
213-
List<String> strings = new LinkedList<String>();
213+
List<String> strings = new LinkedList<>();
214214
BufferedReader reader = null;
215215
try {
216216
reader = new BufferedReader(new FileReader(file));
@@ -343,7 +343,7 @@ public static List<File> listFiles(File folder, boolean recursive,
343343

344344
public static List<File> listFiles(File folder, boolean recursive,
345345
List<String> extensions) {
346-
List<File> result = new ArrayList<File>();
346+
List<File> result = new ArrayList<>();
347347

348348
for (File file : folder.listFiles()) {
349349
if (isSCCSOrHiddenFile(file))

0 commit comments

Comments
 (0)