Skip to content

Commit cb292d6

Browse files
author
Federico Fissore
committed
Got rid of Guava lib: java 8 has its features builtin
1 parent 50cacc1 commit cb292d6

25 files changed

+80
-508
lines changed

app/.classpath

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<classpathentry combineaccessrules="false" kind="src" path="/arduino-core"/>
2929
<classpathentry kind="lib" path="test-lib/jcip-annotations-1.0.jar"/>
3030
<classpathentry kind="lib" path="lib/commons-lang3-3.3.2.jar"/>
31-
<classpathentry kind="lib" path="lib/guava-18.0.jar"/>
3231
<classpathentry kind="lib" path="lib/java-semver-0.8.0.jar"/>
3332
<classpathentry kind="lib" path="lib/rsyntaxtextarea-2.5.7.1+arduino.jar"/>
3433
<classpathentry kind="output" path="bin"/>

app/lib/guava-18.0.LICENSE.ASL-2.0.txt

-203
This file was deleted.

app/lib/guava-18.0.jar

-2.15 MB
Binary file not shown.

app/src/cc/arduino/contributions/BuiltInCoreIsNewerCheck.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,14 @@
3434
import cc.arduino.contributions.packages.ContributedPackage;
3535
import cc.arduino.contributions.packages.ContributedPlatform;
3636
import cc.arduino.view.Event;
37-
import com.google.common.collect.Collections2;
38-
import com.google.common.collect.Iterables;
39-
import com.google.common.collect.Lists;
4037
import processing.app.Base;
4138
import processing.app.BaseNoGui;
4239
import processing.app.I18n;
4340
import processing.app.PreferencesData;
4441

4542
import javax.swing.*;
4643
import java.awt.event.ActionEvent;
47-
import java.util.LinkedList;
44+
import java.util.Collection;
4845
import java.util.List;
4946
import java.util.stream.Collectors;
5047

@@ -72,7 +69,7 @@ private void builtInPackageIsNewerCheck() throws InterruptedException {
7269
return;
7370
}
7471

75-
LinkedList<ContributedPlatform> contributedPlatforms = Lists.newLinkedList(Iterables.concat(Collections2.transform(BaseNoGui.indexer.getPackages(), ContributedPackage::getPlatforms)));
72+
List<ContributedPlatform> contributedPlatforms = BaseNoGui.indexer.getPackages().stream().map(ContributedPackage::getPlatforms).flatMap(Collection::stream).collect(Collectors.toList());
7673

7774
List<ContributedPlatform> installedBuiltInPlatforms = contributedPlatforms.stream().filter(new InstalledPredicate()).filter(new BuiltInPredicate()).collect(Collectors.toList());
7875
if (installedBuiltInPlatforms.size() != 1) {

app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java

+8-10
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import cc.arduino.contributions.ui.InstallerTableCell;
3939
import cc.arduino.contributions.ui.listeners.DelegatingKeyListener;
4040
import cc.arduino.utils.ReverseComparator;
41-
import com.google.common.collect.Lists;
4241
import processing.app.Base;
4342

4443
import javax.swing.*;
@@ -51,11 +50,12 @@
5150
import java.awt.event.ActionEvent;
5251
import java.awt.event.ActionListener;
5352
import java.util.Collections;
53+
import java.util.LinkedList;
5454
import java.util.List;
5555
import java.util.stream.Collectors;
5656

57-
import static processing.app.I18n.tr;
5857
import static processing.app.I18n.format;
58+
import static processing.app.I18n.tr;
5959

6060
@SuppressWarnings("serial")
6161
public class ContributedLibraryTableCell extends InstallerTableCell {
@@ -158,8 +158,8 @@ private JTextPane makeNewDescription(JPanel panel) {
158158
HTMLDocument html = (HTMLDocument) doc;
159159
StyleSheet stylesheet = html.getStyleSheet();
160160
stylesheet.addRule("body { margin: 0; padding: 0;"
161-
+ "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;"
162-
+ "font-size: 100%;" + "font-size: 0.95em; }");
161+
+ "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;"
162+
+ "font-size: 100%;" + "font-size: 0.95em; }");
163163
}
164164
description.setOpaque(false);
165165
description.setBorder(new EmptyBorder(4, 7, 7, 7));
@@ -236,19 +236,17 @@ public Component getTableCellEditorComponent(JTable table, Object value,
236236
downgradeChooser.removeAllItems();
237237
downgradeChooser.addItem(tr("Select version"));
238238

239-
final List<ContributedLibrary> uninstalledPreviousReleases = Lists.newLinkedList();
240-
final List<ContributedLibrary> uninstalledNewerReleases = Lists.newLinkedList();
239+
final List<ContributedLibrary> uninstalledPreviousReleases = new LinkedList<>();
240+
final List<ContributedLibrary> uninstalledNewerReleases = new LinkedList<>();
241241

242242
final VersionComparator versionComparator = new VersionComparator();
243-
Lists.newLinkedList(Lists.transform(uninstalledReleases, input -> {
243+
uninstalledReleases.stream().forEach(input -> {
244244
if (installed == null || versionComparator.greaterThan(installed.getParsedVersion(), input.getParsedVersion())) {
245245
uninstalledPreviousReleases.add(input);
246246
} else {
247247
uninstalledNewerReleases.add(input);
248248
}
249-
250-
return input;
251-
}));
249+
});
252250
uninstalledNewerReleases.forEach(downgradeChooser::addItem);
253251
uninstalledPreviousReleases.forEach(downgradeChooser::addItem);
254252

app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java

+7-10
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import cc.arduino.contributions.ui.InstallerTableCell;
4040
import cc.arduino.contributions.ui.listeners.DelegatingKeyListener;
4141
import cc.arduino.utils.ReverseComparator;
42-
import com.google.common.collect.Lists;
4342
import processing.app.Base;
4443

4544
import javax.swing.*;
@@ -55,8 +54,8 @@
5554
import java.util.LinkedList;
5655
import java.util.stream.Collectors;
5756

58-
import static processing.app.I18n.tr;
5957
import static processing.app.I18n.format;
58+
import static processing.app.I18n.tr;
6059

6160
@SuppressWarnings("serial")
6261
public class ContributedPlatformTableCell extends InstallerTableCell {
@@ -170,8 +169,8 @@ private JTextPane makeNewDescription(JPanel panel) {
170169
HTMLDocument html = (HTMLDocument) doc;
171170
StyleSheet stylesheet = html.getStyleSheet();
172171
stylesheet.addRule("body { margin: 0; padding: 0;"
173-
+ "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;"
174-
+ "font-size: 100%;" + "font-size: 0.95em; }");
172+
+ "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;"
173+
+ "font-size: 100%;" + "font-size: 0.95em; }");
175174
}
176175
description.setOpaque(false);
177176
description.setBorder(new EmptyBorder(4, 7, 7, 7));
@@ -248,19 +247,17 @@ public Component getTableCellEditorComponent(JTable table, Object value,
248247
downgradeChooser.removeAllItems();
249248
downgradeChooser.addItem(tr("Select version"));
250249

251-
final java.util.List<ContributedPlatform> uninstalledPreviousReleases = Lists.newLinkedList();
252-
final java.util.List<ContributedPlatform> uninstalledNewerReleases = Lists.newLinkedList();
250+
final java.util.List<ContributedPlatform> uninstalledPreviousReleases = new LinkedList<>();
251+
final java.util.List<ContributedPlatform> uninstalledNewerReleases = new LinkedList<>();
253252

254253
final VersionComparator versionComparator = new VersionComparator();
255-
Lists.newLinkedList(Lists.transform(uninstalledReleases, input -> {
254+
uninstalledReleases.stream().forEach(input -> {
256255
if (installed == null || versionComparator.greaterThan(installed.getParsedVersion(), input.getParsedVersion())) {
257256
uninstalledPreviousReleases.add(input);
258257
} else {
259258
uninstalledNewerReleases.add(input);
260259
}
261-
262-
return input;
263-
}));
260+
});
264261
uninstalledNewerReleases.forEach(downgradeChooser::addItem);
265262
uninstalledPreviousReleases.forEach(downgradeChooser::addItem);
266263

app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929

3030
package cc.arduino.view.preferences;
3131

32-
import com.google.common.base.Joiner;
33-
import com.google.common.collect.FluentIterable;
3432
import processing.app.Base;
3533

3634
import java.awt.*;
@@ -39,6 +37,7 @@
3937
import java.awt.event.WindowEvent;
4038
import java.util.Arrays;
4139
import java.util.Collection;
40+
import java.util.stream.Collectors;
4241

4342
import static processing.app.I18n.tr;
4443

@@ -174,17 +173,17 @@ private void unofficialListURLLabelMouseClicked(java.awt.event.MouseEvent evt) {
174173

175174
public void setText(String text) {
176175
Collection<String> urls = splitAndTrim(text, ",");
177-
additionalBoardsManagerURLs.setText(Joiner.on("\n").skipNulls().join(urls));
176+
additionalBoardsManagerURLs.setText(urls.stream().filter(s -> s != null).collect(Collectors.joining("\n")));
178177
}
179178

180179
private Collection<String> splitAndTrim(String text, String separator) {
181180
Collection<String> urls = Arrays.asList(text.split(separator));
182-
return FluentIterable.from(urls).transform(String::trim).filter(url -> !url.isEmpty()).toList();
181+
return urls.stream().map(String::trim).filter(url -> !url.isEmpty()).collect(Collectors.toList());
183182
}
184183

185184
public String getText() {
186185
Collection<String> urls = splitAndTrim(additionalBoardsManagerURLs.getText(), "\n");
187-
return Joiner.on(",").skipNulls().join(urls);
186+
return urls.stream().filter(s -> s != null).collect(Collectors.joining(","));
188187
}
189188

190189
// Variables declaration - do not modify//GEN-BEGIN:variables

0 commit comments

Comments
 (0)