Debian Codegraph @

src/test/java/io/reactivex/rxjava3/internal/util/OperatorMatrixGenerator.java

raw
1 /*
2 * Copyright (c) 2016-present, RxJava Contributors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is
10 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
11 * the License for the specific language governing permissions and limitations under the License.
12 */
13
14 package io.reactivex.rxjava3.internal.util;
15
16 import java.io.*;
17 import java.lang.reflect.Method;
18 import java.nio.file.*;
19 import java.util.*;
20
21 import io.reactivex.rxjava3.core.*;
22 import io.reactivex.rxjava3.core.Observable;
23
24 /**
25 * Generate a table of available operators across base classes in {@code Operator-Matrix.md}.
26 *
27 * Should be run with the main project directory as working directory where the {@code docs}
28 * folder is.
29 */
30 public final class OperatorMatrixGenerator {
31
32 private OperatorMatrixGenerator() {
33 throw new IllegalStateException("No instances!");
34 }
35
36 static final String PRESENT = "![present](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_on.png)";
37 static final String ABSENT = "![absent](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_off.png)";
38 static final String TBD = "![absent](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_half.png)";
39
40 static final Class<?>[] CLASSES = {
41 Flowable.class, Observable.class, Maybe.class, Single.class, Completable.class
42 };
43
44 static String header(String type) {
45 return "![" + type + "](https://raw.github.com/wiki/ReactiveX/RxJava/images/opmatrix-" + type.toLowerCase() + ".png)";
46 }
47
48 public static void main(String[] args) throws IOException {
49 Set<String> operatorSet = new HashSet<>();
50 Map<Class<?>, Set<String>> operatorMap = new HashMap<>();
51
52 for (Class<?> clazz : CLASSES) {
53 Set<String> set = operatorMap.computeIfAbsent(clazz, c -> new HashSet<>());
54
55 for (Method m : clazz.getMethods()) {
56 String name = m.getName();
57 if (!name.equals("bufferSize")
58 && m.getDeclaringClass() == clazz
59 && !m.isSynthetic()) {
60 operatorSet.add(m.getName());
61 set.add(m.getName());
62 }
63 }
64 }
65
66 List<String> sortedOperators = new ArrayList<>(operatorSet);
67 sortedOperators.sort(Comparator.naturalOrder());
68
69 try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(Paths.get("docs", "Operator-Matrix.md"), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING))) {
70 out.print("Operator |");
71 for (Class<?> clazz : CLASSES) {
72 out.print(" ");
73 out.print(header(clazz.getSimpleName()));
74 out.print(" |");
75 }
76 out.println();
77 out.print("-----|");
78 for (int i = 0; i < CLASSES.length; i++) {
79 out.print("---|");
80 }
81 out.println();
82
83 Map<String, Integer> notesMap = new HashMap<>();
84 List<String> notesList = new ArrayList<>();
85 List<String> tbdList = new ArrayList<>();
86 int[] counters = new int[CLASSES.length];
87
88 for (String operatorName : sortedOperators) {
89 out.print("<a name='");
90 out.print(operatorName);
91 out.print("'></a>`");
92 out.print(operatorName);
93 out.print("`|");
94 int m = 0;
95 for (Class<?> clazz : CLASSES) {
96 if (operatorMap.get(clazz).contains(operatorName)) {
97 out.print(PRESENT);
98 counters[m]++;
99 } else {
100 String notes = findNotes(clazz.getSimpleName(), operatorName);
101 if (notes != null) {
102 out.print(ABSENT);
103 Integer index = notesMap.get(notes);
104 if (index == null) {
105 index = notesMap.size() + 1;
106 notesMap.put(notes, index);
107 notesList.add(notes);
108 }
109 out.print(" <sup title='");
110 out.print(notes.replace("`", "").replace("[", "").replace("]", "").replaceAll("\\(#.+\\)", ""));
111 out.print("'>([");
112 out.print(index);
113 out.print("](#notes-");
114 out.print(index);
115 out.print("))</sup>");
116 } else {
117 out.print(TBD);
118 tbdList.add(clazz.getSimpleName() + "." + operatorName + "()");
119 }
120 }
121 out.print("|");
122 m++;
123 }
124 out.println();
125 }
126 out.print("<a name='total'></a>**");
127 out.print(sortedOperators.size());
128 out.print(" operators** |");
129 for (int m = 0; m < counters.length; m++) {
130 out.print(" **");
131 out.print(counters[m]);
132 out.print("** |");
133 }
134 out.println();
135
136 if (!notesList.isEmpty()) {
137 out.println();
138 out.println("#### Notes");
139
140 for (int i = 0; i < notesList.size(); i++) {
141 out.print("<a name='notes-");
142 out.print(i + 1);
143 out.print("'></a><sup>");
144 out.print(i + 1);
145 out.print("</sup> ");
146 out.print(notesList.get(i));
147 out.println("<br/>");
148 }
149 }
150 if (tbdList.isEmpty()) {
151 out.println();
152 out.println("#### Under development");
153 out.println();
154 out.println("*Currently, all intended operators are implemented.*");
155 } else {
156 out.println();
157 out.println("#### Under development");
158 out.println();
159
160 for (int i = 0; i < tbdList.size(); i++) {
161 out.print(i + 1);
162 out.print(". ");
163 out.println(tbdList.get(i));
164 }
165 }
166 }
167 }
168
169 static String findNotes(String clazzName, String operatorName) {
170 Map<String, String> classNotes = NOTES_MAP.get(operatorName);
171 if (classNotes != null) {
172 return classNotes.get(clazzName.substring(0, 1));
173 }
174 switch (operatorName) {
175 case "empty": {
176 if ("Completable".equals(clazzName)) {
177 return "Use [`complete()`](#complete).";
178 }
179 if ("Single".equals(clazzName)) {
180 return "Never empty.";
181 }
182 break;
183 }
184 }
185 return null;
186 }
187
188 static final String[] NOTES = {
189 // Format
190 // FOMSC methodName note
191 " MS all Use [`contains()`](#contains).",
192 " C all Always empty.",
193 "FOMS andThen Use [`concatWith`](#concatWith).",
194 " MS any Use [`contains()`](#contains).",
195 " C any Always empty.",
196 "FO blockingAwait Use [`blockingFirst()`](#blockingFirst), [`blockingSingle()`](#blockingSingle) or [`blockingLast()`](#blockingLast).",
197 " MS blockingAwait Use [`blockingGet()`](#blockingGet).",
198 " MS blockingFirst At most one element to get. Use [`blockingGet()`](#blockingGet).",
199 " C blockingFirst No elements to get. Use [`blockingAwait()`](#blockingAwait).",
200 " MSC blockingForEach Use [`blockingSubscribe()`](#blockingSubscribe)",
201 "FO blockingGet Use [`blockingFirst()`](#blockingFirst), [`blockingSingle()`](#blockingSingle) or [`blockingLast()`](#blockingLast).",
202 " C blockingGet No elements to get. Use [`blockingAwait()`](#blockingAwait).",
203 " MS blockingIterable At most one element to get. Use [`blockingGet()`](#blockingGet).",
204 " C blockingIterable No elements to get. Use [`blockingAwait()`](#blockingAwait).",
205 " MS blockingLast At most one element to get. Use [`blockingGet()`](#blockingGet).",
206 " C blockingLast No elements to get. Use [`blockingAwait()`](#blockingAwait).",
207 " MS blockingLatest At most one element to get. Use [`blockingGet()`](#blockingGet).",
208 " C blockingLatest No elements to get. Use [`blockingAwait()`](#blockingAwait).",
209 " MS blockingMostRecent At most one element to get. Use [`blockingGet()`](#blockingGet).",
210 " C blockingMostRecent No elements to get. Use [`blockingAwait()`](#blockingAwait).",
211 " MS blockingNext At most one element to get. Use [`blockingGet()`](#blockingGet).",
212 " C blockingNext No elements to get. Use [`blockingAwait()`](#blockingAwait).",
213 " MS blockingSingle At most one element to get. Use [`blockingGet()`](#blockingGet).",
214 " C blockingSingle No elements to get. Use [`blockingAwait()`](#blockingAwait).",
215 " MS blockingStream At most one element to get. Use [`blockingGet()`](#blockingGet).",
216 " C blockingStream No elements to get. Use [`blockingAwait()`](#blockingAwait).",
217 " M buffer Use [`map()`](#map) and [`switchIfEmpty()`](#switchIfEmpty) to transform into a list/collection.",
218 " S buffer Use [`map()`](#map) to transform into a list/collection.",
219 " C buffer Always empty. Use [`andThen()`](#andThen) to bring in a list/collection.",
220 " MSC cacheWithInitialCapacity At most one element to store. Use [`cache()`](#cache).",
221 " C cast Always empty.",
222 " M collect At most one element to collect. Use [`map()`](#map) and [`switchIfEmpty()`](#switchIfEmpty) to transform into a list/collection.",
223 " S collect One element to collect. Use [`map()`](#map) to transform into a list/collection.",
224 " C collect Always empty. Use [`andThen()`](#andThen) to bring in a collection.",
225 " M collectInto At most one element to collect. Use [`map()`](#map) and [`switchIfEmpty()`](#switchIfEmpty) to transform into a list/collection.",
226 " S collectInto One element to collect. Use [`map()`](#map) to transform into a list/collection.",
227 " C collectInto Always empty. Use [`andThen()`](#andThen) to bring in a collection.",
228 " MS combineLatest At most one element per source. Use [`zip()`](#zip).",
229 " C combineLatest Always empty. Use [`merge()`](#merge).",
230 " MS combineLatestArray At most one element per source. Use [`zipArray()`](#zipArray).",
231 " C combineLatestArray Always empty. Use [`mergeArray()`](#mergeArray).",
232 " MS combineLatestDelayError At most one element per source. Use [`zip()`](#zip).",
233 " C combineLatestDelayError Always empty. Use [`mergeDelayError()`](#mergeDelayError).",
234 " MS combineLatestArrayDelayError At most one element per source. Use [`zipArray()`](#zipArray).",
235 " C combineLatestArrayDelayError Always empty. Use [`mergeArrayDelayError()`](#mergeArrayDelayError).",
236 "FOM complete Use [`empty()`](#empty).",
237 " S complete Never empty.",
238 " C concatArrayEager No items to keep ordered. Use [`mergeArray()`](#mergeArray).",
239 " C concatArrayEagerDelayError No items to keep ordered. Use [`mergeArrayDelayError()`](#mergeArrayDelayError).",
240 " C concatEager No items to keep ordered. Use [`merge()`](#merge).",
241 " C concatEagerDelayError No items to keep ordered. Use [`mergeDelayError()`](#mergeDelayError).",
242 " C concatMap Always empty thus no items to map.",
243 " C concatMapCompletable Always empty thus no items to map.",
244 " MS concatMapCompletableDelayError Either the upstream fails (thus no inner) or the mapped-in source, but never both. Use [`concatMapCompletable`](#concatMapCompletable).",
245 " C concatMapCompletableDelayError Always empty thus no items to map.",
246 " MS concatMapDelayError Either the upstream fails (thus no inner) or the mapped-in source, but never both. Use [`concatMap`](#concatMap).",
247 " C concatMapDelayError Always empty thus no items to map.",
248 " MS concatMapEager At most one item to map. Use [`concatMap()`](#concatMap).",
249 " C concatMapEager Always empty thus no items to map.",
250 " MS concatMapEagerDelayError At most one item to map. Use [`concatMap()`](#concatMap).",
251 " C concatMapEagerDelayError Always empty thus no items to map.",
252 " C concatMapIterable Always empty thus no items to map.",
253 " M concatMapMaybe Use [`concatMap`](#concatMap).",
254 " C concatMapMaybe Always empty thus no items to map.",
255 " MS concatMapMaybeDelayError Either the upstream fails (thus no inner) or the mapped-in source, but never both. Use [`concatMapMaybe`](#concatMapMaybe).",
256 " C concatMapMaybeDelayError Always empty thus no items to map.",
257 " S concatMapSingle Use [`concatMap()`](#concatMap).",
258 " C concatMapSingle Always empty thus no items to map.",
259 " MS concatMapSingleDelayError Either the upstream fails (thus no inner) or the mapped-in source, but never both. Use [`concatMapSingle`](#concatMapSingle).",
260 " C concatMapSingleDelayError Always empty thus no items to map.",
261 " C concatMapStream Always empty thus no items to map.",
262 " MS concatMapIterable At most one item. Use [`flattenAsFlowable`](#flattenAsFlowable) or [`flattenAsObservable`](#flattenAsObservable).",
263 " MS concatMapStream At most one item. Use [`flattenStreamAsFlowable`](#flattenStreamAsFlowable) or [`flattenStreamAsObservable`](#flattenStreamAsObservable).",
264 " C contains Always empty.",
265 " S count Never empty thus always 1.",
266 " C count Always empty thus always 0.",
267 " MS debounce At most one item signaled so no subsequent items to work with.",
268 " C debounce Always empty thus no items to work with.",
269 " S defaultIfEmpty Never empty.",
270 " C defaultIfEmpty Always empty. Use [`andThen()`](#andThen) to chose the follow-up sequence.",
271 " C dematerialize Always empty thus no items to work with.",
272 " MS distinct At most one item, always distinct.",
273 " C distinct Always empty thus no items to work with.",
274 " MS distinctUntilChanged At most one item, always distinct.",
275 " C distinctUntilChanged Always empty thus no items to work with.",
276 " MS doAfterNext Different terminology. Use [`doAfterSuccess()`](#doAfterSuccess).",
277 " C doAfterNext Always empty.",
278 "FO doAfterSuccess Different terminology. Use [`doAfterNext()`](#doAfterNext).",
279 " C doAfterSuccess Always empty thus no items to work with.",
280 " OMSC doOnCancel Different terminology. Use [`doOnDispose()`](#doOnDispose).",
281 " S doOnComplete Always succeeds or fails, there is no `onComplete` signal.",
282 "F doOnDispose Different terminology. Use [`doOnCancel()`](#doOnCancel).",
283 " MS doOnEach At most one item. Use [`doOnEvent()`](#doOnEvent).",
284 " C doOnEach Always empty thus no items to work with.",
285 "FO doOnEvent Use [`doOnEach()`](#doOnEach).",
286 " MS doOnNext Different terminology. Use [`doOnSuccess()`](#doOnSuccess).",
287 " C doOnNext Always empty thus no items to work with.",
288 " OMSC doOnRequest Backpressure related and not supported outside `Flowable`.",
289 "FO doOnSuccess Different terminology. Use [`doOnNext()`](#doOnNext).",
290 " C doOnSuccess Always empty thus no items to work with.",
291 " M elementAt At most one item with index 0. Use [`defaultIfEmpty`](#defaultIfEmpty).",
292 " S elementAt Always one item with index 0.",
293 " C elementAt Always empty thus no items to work with.",
294 " M elementAtOrError At most one item with index 0. Use [`toSingle`](#toSingle).",
295 " S elementAtOrError Always one item with index 0.",
296 " C elementAtOrError Always empty thus no items to work with.",
297 " S empty Never empty.",
298 " C empty Use [`complete()`](#complete).",
299 " C filter Always empty thus no items to work with.",
300 " M first At most one item. Use [`defaultIfEmpty`](#defaultIfEmpty).",
301 " S first Always one item.",
302 " C first Always empty. Use [`andThen()`](#andThen) to chose the follow-up sequence.",
303 " M firstElement At most one item, would be no-op.",
304 " S firstElement Always one item, would be no-op.",
305 " C firstElement Always empty.",
306 " M firstOrError At most one item, would be no-op.",
307 " S firstOrError Always one item, would be no-op.",
308 " C firstOrError Always empty. Use [`andThen()`](#andThen) and [`error()`](#error).",
309 " MS firstOrErrorStage At most one item. Use [`toCompletionStage()`](#toCompletionStage).",
310 " C firstOrErrorStage Always empty. Use [`andThen()`](#andThen), [`error()`](#error) and [`toCompletionStage()`](#toCompletionStage).",
311 " MSC firstStage At most one item. Use [`toCompletionStage()`](#toCompletionStage).",
312 " C flatMap Always empty thus no items to map.",
313 " C flatMapCompletable Always empty thus no items to map.",
314 " C flatMapCompletableDelayError Always empty thus no items to map.",
315 " C flatMapIterable Always empty thus no items to map.",
316 " M flatMapMaybe Use [`flatMap()`](#flatMap).",
317 " C flatMapMaybe Always empty thus no items to map.",
318 " C flatMapMaybeDelayError Always empty thus no items to map.",
319 " S flatMapSingle Use [`flatMap()`](#flatMap).",
320 " C flatMapSingle Always empty thus no items to map.",
321 " C flatMapStream Always empty thus no items to map.",
322 " MS flatMapIterable At most one item. Use [`flattenAsFlowable`](#flattenAsFlowable) or [`flattenAsObservable`](#flattenAsObservable).",
323 " MS flatMapStream At most one item. Use [`flattenStreamAsFlowable`](#flattenStreamAsFlowable) or [`flattenStreamAsObservable`](#flattenStreamAsObservable).",
324 "F flatMapObservable Not supported. Use [`flatMap`](#flatMap) and [`toFlowable()`](#toFlowable).",
325 " O flatMapObservable Use [`flatMap`](#flatMap).",
326 " C flatMapObservable Always empty thus no items to map.",
327 " O flatMapPublisher Not supported. Use [`flatMap`](#flatMap) and [`toObservable()`](#toFlowable).",
328 "F flatMapPublisher Use [`flatMap`](#flatMap).",
329 " C flatMapPublisher Always empty thus no items to map.",
330 "FO flatMapSingleElement Use [`flatMapSingle`](#flatMapSingle).",
331 " S flatMapSingleElement Use [`flatMap`](#flatMap).",
332 " C flatMapSingleElement Always empty thus no items to map.",
333 "FO flattenAsFlowable Use [`flatMapIterable()`](#flatMapIterable).",
334 " C flattenAsFlowable Always empty thus no items to map.",
335 "FO flattenAsObservable Use [`flatMapIterable()`](#flatMapIterable).",
336 " C flattenAsObservable Always empty thus no items to map.",
337 "FO flattenStreamAsFlowable Use [`flatMapStream()`](#flatMapStream).",
338 " C flattenStreamAsFlowable Always empty thus no items to map.",
339 "FO flattenStreamAsObservable Use [`flatMapStream()`](#flatMapStream).",
340 " C flattenStreamAsObservable Always empty thus no items to map.",
341 " MSC forEach Use [`subscribe()`](#subscribe).",
342 " MSC forEachWhile Use [`subscribe()`](#subscribe).",
343 " S fromAction Never empty.",
344 " M fromArray At most one item. Use [`just()`](#just) or [`empty()`](#empty).",
345 " S fromArray Always one item. Use [`just()`](#just).",
346 " C fromArray Always empty. Use [`complete()`](#complete).",
347 " S fromCompletable Always error.",
348 " C fromCompletable Use [`wrap()`](#wrap).",
349 " M fromIterable At most one item. Use [`just()`](#just) or [`empty()`](#empty).",
350 " S fromIterable Always one item. Use [`just()`](#just).",
351 " C fromIterable Always empty. Use [`complete()`](#complete).",
352 " M fromMaybe Use [`wrap()`](#wrap).",
353 " O fromObservable Use [`wrap()`](#wrap).",
354 " S fromOptional Always one item. Use [`just()`](#just).",
355 " C fromOptional Always empty. Use [`complete()`](#complete).",
356 " S fromRunnable Never empty.",
357 " S fromSingle Use [`wrap()`](#wrap).",
358 " M fromStream At most one item. Use [`just()`](#just) or [`empty()`](#empty).",
359 " S fromStream Always one item. Use [`just()`](#just).",
360 " C fromStream Always empty. Use [`complete()`](#complete).",
361 " MSC generate Use [`fromSupplier()`](#fromSupplier).",
362 " MS groupBy At most one item.",
363 " C groupBy Always empty thus no items to group.",
364 " MS groupJoin At most one item.",
365 " C groupJoin Always empty thus no items to join.",
366 "FO ignoreElement Use [`ignoreElements()`](#ignoreElements).",
367 " C ignoreElement Always empty.",
368 " MS ignoreElements Use [`ignoreElement()`](#ignoreElement).",
369 " C ignoreElements Always empty.",
370 " MSC interval At most one item. Use [`timer()`](#timer).",
371 " MSC intervalRange At most one item. Use [`timer()`](#timer).",
372 " S isEmpty Always one item.",
373 " C isEmpty Always empty.",
374 " MS join At most one item. Use [`zip()`](#zip)",
375 " C join Always empty thus no items to join.",
376 " C just Always empty.",
377 " M last At most one item. Use [`defaultIfEmpty`](#defaultIfEmpty).",
378 " S last Always one item.",
379 " C last Always empty. Use [`andThen()`](#andThen) to chose the follow-up sequence.",
380 " M lastElement At most one item, would be no-op.",
381 " S lastElement Always one item, would be no-op.",
382 " C lastElement Always empty.",
383 " M lastOrError At most one item, would be no-op.",
384 " S lastOrError Always one item, would be no-op.",
385 " C lastOrError Always empty. Use [`andThen()`](#andThen) and [`error()`](#error).",
386 " MS lastOrErrorStage At most one item. Use [`toCompletionStage()`](#toCompletionStage).",
387 " C lastOrErrorStage Always empty. Use [`andThen()`](#andThen), [`error()`](#error) and [`toCompletionStage()`](#toCompletionStage).",
388 " MSC lastStage At most one item. Use [`toCompletionStage()`](#toCompletionStage).",
389 " C map Always empty thus no items to map.",
390 " C mapOptional Always empty thus no items to map.",
391 " C ofType Always empty thus no items to filter.",
392 " OMSC onBackpressureBuffer Backpressure related and not supported outside `Flowable`.",
393 " OMSC onBackpressureDrop Backpressure related and not supported outside `Flowable`.",
394 " OMSC onBackpressureLatest Backpressure related and not supported outside `Flowable`.",
395 " OMSC parallel Needs backpressure thus not supported outside `Flowable`.",
396 " M publish Connectable sources not supported outside `Flowable` and `Observable`. Use a `MaybeSubject`.",
397 " S publish Connectable sources not supported outside `Flowable` and `Observable`. Use a `SingleSubject`.",
398 " C publish Connectable sources not supported outside `Flowable` and `Observable`. Use a `ConnectableSubject`.",
399 " MS range At most one item. Use [`just()`](#just).",
400 " C range Always empty. Use [`complete()`](#complete).",
401 " MS rangeLong At most one item. Use [`just()`](#just).",
402 " C rangeLong Always empty. Use [`complete()`](#complete).",
403 " OMSC rebatchRequests Backpressure related and not supported outside `Flowable`.",
404 " MS reduce At most one item. Use [`map()`](#map).",
405 " C reduce Always empty thus no items to reduce.",
406 " MS reduceWith At most one item. Use [`map()`](#map).",
407 " C reduceWith Always empty thus no items to reduce.",
408 " M replay Connectable sources not supported outside `Flowable` and `Observable`. Use a `MaybeSubject`.",
409 " S replay Connectable sources not supported outside `Flowable` and `Observable`. Use a `SingleSubject`.",
410 " C replay Connectable sources not supported outside `Flowable` and `Observable`. Use a `ConnectableSubject`.",
411 " MS sample At most one item, would be no-op.",
412 " C sample Always empty thus no items to work with.",
413 " MS scan At most one item. Use [`map()`](#map).",
414 " C scan Always empty thus no items to reduce.",
415 " MS scanWith At most one item. Use [`map()`](#map).",
416 " C scanWith Always empty thus no items to reduce.",
417 " MSC serialize At most one signal type.",
418 " M share Connectable sources not supported outside `Flowable` and `Observable`. Use a `MaybeSubject`.",
419 " S share Connectable sources not supported outside `Flowable` and `Observable`. Use a `SingleSubject`.",
420 " C share Connectable sources not supported outside `Flowable` and `Observable`. Use a `ConnectableSubject`.",
421 " M single At most one item. Use [`defaultIfEmpty`](#defaultIfEmpty).",
422 " S single Always one item.",
423 " C single Always empty. Use [`andThen()`](#andThen) to chose the follow-up sequence.",
424 " M singleElement At most one item, would be no-op.",
425 " S singleElement Always one item, would be no-op.",
426 " C singleElement Always empty.",
427 " M singleOrError At most one item, would be no-op.",
428 " S singleOrError Always one item, would be no-op.",
429 " C singleOrError Always empty. Use [`andThen()`](#andThen) and [`error()`](#error).",
430 " MS singleOrErrorStage At most one item. Use [`toCompletionStage()`](#toCompletionStage).",
431 " C singleOrErrorStage Always empty. Use [`andThen()`](#andThen), [`error()`](#error) and [`toCompletionStage()`](#toCompletionStage).",
432 " MSC singleStage At most one item. Use [`toCompletionStage()`](#toCompletionStage).",
433 " MSC skip At most one item, would be no-op.",
434 " MSC skipLast At most one item, would be no-op.",
435 " MS skipWhile At most one item. Use [`filter()`](#filter).",
436 " C skipWhile Always empty.",
437 " MSC skipUntil At most one item. Use [`takeUntil()`](#takeUntil).",
438 " MSC sorted At most one item.",
439 " MSC startWithArray Use [`startWith()`](#startWith) and [`fromArray()`](#fromArray) of `Flowable` or `Observable`.",
440 " MSC startWithItem Use [`startWith()`](#startWith) and [`just()`](#just) of another reactive type.",
441 " MSC startWithIterable Use [`startWith()`](#startWith) and [`fromIterable()`](#fromArray) of `Flowable` or `Observable`.",
442 " S switchIfEmpty Never empty.",
443 " C switchIfEmpty Always empty. Use [`defaultIfEmpty()`](#defaultIfEmpty).",
444 " MS switchMap At most one item. Use [`flatMap()`](#flatMap).",
445 " C switchMap Always empty thus no items to map.",
446 " MS switchMapDelayError At most one item. Use [`flatMap()`](#flatMap).",
447 " C switchMapDelayError Always empty thus no items to map.",
448 " MS switchMapCompletable At most one item. Use [`flatMap()`](#flatMap).",
449 " C switchMapCompletable Always empty thus no items to map.",
450 " MS switchMapCompletableDelayError At most one item. Use [`flatMap()`](#flatMap).",
451 " C switchMapCompletableDelayError Always empty thus no items to map.",
452 " MS switchMapMaybe At most one item. Use [`flatMap()`](#flatMap).",
453 " C switchMapMaybe Always empty thus no items to map.",
454 " MS switchMapMaybeDelayError At most one item. Use [`flatMap()`](#flatMap).",
455 " C switchMapMaybeDelayError Always empty thus no items to map.",
456 " MS switchMapSingle At most one item. Use [`flatMap()`](#flatMap).",
457 " C switchMapSingle Always empty thus no items to map.",
458 " MS switchMapSingleDelayError At most one item. Use [`flatMap()`](#flatMap).",
459 " C switchMapSingleDelayError Always empty thus no items to map.",
460 " MSC take At most one item, would be no-op.",
461 " MSC takeLast At most one item, would be no-op.",
462 " MS takeWhile At most one item. Use [`filter()`](#filter).",
463 " C takeWhile Always empty.",
464 " MS throttleFirst At most one item signaled so no subsequent items to work with.",
465 " C throttleFirst Always empty thus no items to work with.",
466 " MS throttleLast At most one item signaled so no subsequent items to work with.",
467 " C throttleLast Always empty thus no items to work with.",
468 " MS throttleLatest At most one item signaled so no subsequent items to work with.",
469 " C throttleLatest Always empty thus no items to work with.",
470 " MS throttleWithTimeout At most one item signaled so no subsequent items to work with.",
471 " C throttleWithTimeout Always empty thus no items to work with.",
472 " C timeInterval Always empty thus no items to work with.",
473 " C timestamp Always empty thus no items to work with.",
474 "FO toCompletionStage Use [`firstStage`](#firstStage), [`lastStage`](#lastStage) or [`singleStage`](#singleStage).",
475 "F toFlowable Would be no-op.",
476 " M toList At most one element to collect. Use [`map()`](#map) and [`switchIfEmpty()`](#switchIfEmpty) to transform into a list/collection.",
477 " S toList One element to collect. Use [`map()`](#map) to transform into a list/collection.",
478 " C toList Always empty. Use [`andThen()`](#andThen) to bring in a collection.",
479 " M toMap At most one element to collect. Use [`map()`](#map) and [`switchIfEmpty()`](#switchIfEmpty) to transform into a list/collection.",
480 " S toMap One element to collect. Use [`map()`](#map) to transform into a list/collection.",
481 " C toMap Always empty. Use [`andThen()`](#andThen) to bring in a collection.",
482 " M toMultimap At most one element to collect. Use [`map()`](#map) and [`switchIfEmpty()`](#switchIfEmpty) to transform into a list/collection.",
483 " S toMultimap One element to collect. Use [`map()`](#map) to transform into a list/collection.",
484 " C toMultimap Always empty. Use [`andThen()`](#andThen) to bring in a collection.",
485 "FO toMaybe Use [`firstElement`](#firstElement), [`lastElement`](#lastElement) or [`singleElement`](#singleElement).",
486 " M toMaybe Would be no-op.",
487 " O toObservable Would be no-op.",
488 "FO toSingle Use [`firstOrError`](#firstOrError), [`lastOrError`](#lastOrError) or [`singleOrError`](#singleOrError).",
489 " S toSingle Would be no-op.",
490 "FO toSingleDefault Use [`first`](#first), [`last`](#last) or [`single`](#single).",
491 " M toSingleDefault Use [`defaultIfEmpty()`](#defaultIfEmpty).",
492 " S toSingleDefault Would be no-op.",
493 " M toSortedList At most one element to collect. Use [`map()`](#map) and [`switchIfEmpty()`](#switchIfEmpty) to transform into a list/collection.",
494 " S toSortedList One element to collect. Use [`map()`](#map) to transform into a list/collection.",
495 " C toSortedList Always empty. Use [`andThen()`](#andThen) to bring in a collection.",
496 " M window Use [`map()`](#map) and [`switchIfEmpty()`](#switchIfEmpty) to transform into a nested source.",
497 " S window Use [`map()`](#map) to transform into a nested source.",
498 " C window Always empty. Use [`andThen()`](#andThen) to bring in a nested source.",
499 " MS withLatestFrom At most one element per source. Use [`zip()`](#zip).",
500 " C withLatestFrom Always empty. Use [`merge()`](#merge).",
501 "F wrap Use [`fromPublisher()`](#fromPublisher).",
502 " C zip Use [`merge()`](#merge).",
503 " C zipArray Use [`mergeArray()`](#mergeArray).",
504 " C zipWith Use [`mergeWith()`](#mergeWith).",
505 };
506
507 static final Map<String, Map<String, String>> NOTES_MAP;
508 static {
509 NOTES_MAP = new HashMap<>();
510 for (String s : NOTES) {
511 char[] classes = s.substring(0, 5).trim().toCharArray();
512 int idx = s.indexOf(' ', 7);
513 String method = s.substring(6, idx);
514 String note = s.substring(idx).trim();
515
516 for (char c : classes) {
517 NOTES_MAP.computeIfAbsent(method, v -> new HashMap<>())
518 .put(String.valueOf(c), note);
519 }
520 }
521 }
522 }