Question: /** * Returns the value to which the specified flag is mapped as a {@link Path}, or {@code null} if * unable to retrieve this

/**

* Returns the value to which the specified flag is mapped as a {@link Path}, or {@code null} if

* unable to retrieve this mapping (including being unable to convert the value to a {@link Path}

* or no value exists).

*

* This method should not throw any exceptions!

*

* @param flag the flag whose associated value is to be returned

* @return the value to which the specified flag is mapped, or {@code null} if unable to retrieve

* this mapping

*

* @see Path#of(String, String...)

*/

public Path getPath(String flag) {

// TODO Fill in getPath method without looping

throw new UnsupportedOperationException("Not yet implemented.");

}

/**

* Returns the value the specified flag is mapped as a {@link Path}, or the default value if

* unable to retrieve this mapping (including being unable to convert the value to a {@link Path}

* or if no value exists).

*

* This method should not throw any exceptions!

*

* @param flag the flag whose associated value will be returned

* @param defaultValue the default value to return if there is no valid mapping

* @return the value the specified flag is mapped as a {@link Path}, or the default value if there

* is no valid mapping

*/

public Path getPath(String flag, Path defaultValue) {

// DO NOT MODIFY; THIS METHOD IS PROVIDED

Path value = getPath(flag);

return value == null ? defaultValue : value;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!