File tree Expand file tree Collapse file tree 1 file changed +39
-1
lines changed
arduino-core/src/processing/app/packages Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change 3030
3131import java .io .File ;
3232import java .util .Collections ;
33+ import java .util .EnumSet ;
3334import java .util .LinkedList ;
3435import 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 ;
3542
3643import processing .app .helpers .FileUtils ;
3744
@@ -76,5 +83,36 @@ public synchronized boolean hasLibrary(UserLibrary lib) {
7683 if (l == lib ) return true ;
7784 return false ;
7885 }
79- }
8086
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