@@ -221,6 +221,45 @@ public String[] getArgs() {
221221 return args .toArray (Util .EMPTY_STRING_ARRAY );
222222 }
223223
224+ /**
225+ * Gets the number of times this option appears in the command line
226+ *
227+ * @param optionChar the character name of the option.
228+ * @return Number of times the option is present
229+ * @since 1.11.0
230+ */
231+ public int getOptionCount (final char optionChar ) {
232+ return getOptionCount (String .valueOf (optionChar ));
233+ }
234+
235+ /**
236+ * Gets the number of times this option appears in the command line.
237+ *
238+ * @param option the option.
239+ * @return Number of times the option is present
240+ * @since 1.11.0
241+ */
242+ public int getOptionCount (final Option option ) {
243+ int result = 0 ;
244+ for (Option opt : options ) {
245+ if (Objects .equals (opt , option )) {
246+ ++result ;
247+ }
248+ }
249+ return result ;
250+ }
251+
252+ /**
253+ * Gets the number of times this option appears in the command line
254+ *
255+ * @param optionName the name of the option.
256+ * @return Number of times the option is present
257+ * @since 1.11.0
258+ */
259+ public int getOptionCount (final String optionName ) {
260+ return getOptionCount (resolveOption (optionName ));
261+ }
262+
224263 /**
225264 * Gets the {@code Object} type of this {@code Option}.
226265 *
@@ -300,45 +339,6 @@ public Option[] getOptions() {
300339 return options .toArray (Option .EMPTY_ARRAY );
301340 }
302341
303- /**
304- * Gets the number of times this option appears in the command line.
305- *
306- * @param option the option.
307- * @return Number of times the option is present
308- * @since 1.11.0
309- */
310- public int getOptionCount (final Option option ) {
311- int result = 0 ;
312- for (Option opt : options ) {
313- if (Objects .equals (opt , option )) {
314- ++result ;
315- }
316- }
317- return result ;
318- }
319-
320- /**
321- * Gets the number of times this option appears in the command line
322- *
323- * @param optionChar the character name of the option.
324- * @return Number of times the option is present
325- * @since 1.11.0
326- */
327- public int getOptionCount (final char optionChar ) {
328- return getOptionCount (String .valueOf (optionChar ));
329- }
330-
331- /**
332- * Gets the number of times this option appears in the command line
333- *
334- * @param optionName the name of the option.
335- * @return Number of times the option is present
336- * @since 1.11.0
337- */
338- public int getOptionCount (final String optionName ) {
339- return getOptionCount (resolveOption (optionName ));
340- }
341-
342342 /**
343343 * Gets the first argument, if any, of this option.
344344 *
0 commit comments