File tree 1 file changed +39
-1
lines changed
arduino-core/src/processing/app/packages
1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change 30
30
31
31
import java .io .File ;
32
32
import java .util .Collections ;
33
+ import java .util .EnumSet ;
33
34
import java .util .LinkedList ;
34
35
import java .util .List ;
36
+ import java .util .Set ;
37
+ import java .util .function .BiConsumer ;
38
+ import java .util .function .BinaryOperator ;
39
+ import java .util .function .Function ;
40
+ import java .util .function .Supplier ;
41
+ import java .util .stream .Collector ;
35
42
36
43
import processing .app .helpers .FileUtils ;
37
44
@@ -76,5 +83,36 @@ public synchronized boolean hasLibrary(UserLibrary lib) {
76
83
if (l == lib ) return true ;
77
84
return false ;
78
85
}
79
- }
80
86
87
+ public static Collector <UserLibrary , LibraryList , LibraryList > collector () {
88
+ return new Collector <UserLibrary , LibraryList , LibraryList >() {
89
+ @ Override
90
+ public Supplier <LibraryList > supplier () {
91
+ return () -> new LibraryList ();
92
+ }
93
+
94
+ @ Override
95
+ public BiConsumer <LibraryList , UserLibrary > accumulator () {
96
+ return (libs , lib ) -> libs .add (lib );
97
+ }
98
+
99
+ @ Override
100
+ public BinaryOperator <LibraryList > combiner () {
101
+ return (we , they ) -> {
102
+ we .addAll (they );
103
+ return we ;
104
+ };
105
+ }
106
+
107
+ @ Override
108
+ public Function <LibraryList , LibraryList > finisher () {
109
+ return (libs ) -> libs ;
110
+ }
111
+
112
+ @ Override
113
+ public Set <Collector .Characteristics > characteristics () {
114
+ return EnumSet .noneOf (Characteristics .class );
115
+ }
116
+ };
117
+ }
118
+ }
You can’t perform that action at this time.
0 commit comments