File tree Expand file tree Collapse file tree
src/main/java/com/cronutils/parser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ public Cron parse(final String expression) {
9393 throw new IllegalArgumentException ("Empty expression!" );
9494 }
9595
96+ if (expression .contains ("||" )) {
97+ List <Cron > crons = Arrays .stream (expression .split ("\\ |\\ |" )).map (this ::parse ).collect (Collectors .toList ());
98+ return new CompositeCron (crons );
99+ }
96100 if (expression .contains ("|" )){
97101 List <String > crons = new ArrayList <>();
98102 int cronscount = Arrays .stream (expression .split ("\\ s+" )).mapToInt (s ->s .split ("\\ |" ).length ).max ().orElse (0 );
@@ -107,7 +111,7 @@ public Cron parse(final String expression) {
107111 }
108112 crons .add (builder .toString ().trim ());
109113 }
110- return new CompositeCron (crons .stream ().map (c -> parse ( c ) ).collect (Collectors .toList ()));
114+ return new CompositeCron (crons .stream ().map (this :: parse ).collect (Collectors .toList ()));
111115 }else {
112116 final String [] expressionParts = replaced .toUpperCase ().split (" " );
113117 final int expressionLength = expressionParts .length ;
You can’t perform that action at this time.
0 commit comments