Given the following method, write a well-formed specification for it as a Javado
ID: 3827862 • Letter: G
Question
Given the following method, write a well-formed specification for it as a Javadoc comment header. Below is a skeleton javadoc that you are to provide comments for. Examine the code and provide a description of what the method does along which a brief description of the parameters, what the method returns and finally what exceptions are thrown. Description: @ param list @param from @ param to @ return @throws */public static int replaceAll(List list, String from, String to) {if (list = = null || from = = null) {throw new IllegalArgumentException();} int count = 0; for (String element:list) {if (element.equalsIgnoreCase(from)) {list. set (, to); count++;}Explanation / Answer
Here is the javadoc.
/**
* This function replace all the from string to to string ignoring case and return number of replacement made.
*
* @param list List of string
* @param from Word for which replacement is to be made (this is case insensitive)
* @param to word with which replacement is to be made
* @return number of replacement made of from to to ignoring case
* @throws IllegalArgumentException If list or from is null.
*/
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.