Extract an intra-method control-flow diagram (flowchart) from the following code snippet. Given that we haven't provided you with all the relevant source code, you won't be able to use the debugger to help. We'd like you to recognize control structures that you've seen in class or in the lab, recall what they do and thereby construct the flowchart.
/**
* Find a StorageFormat that can be used according to a file object
* to store a Drawing in a file or restore it from a file respectively.
*
* @param file a File object to be matched
* @return StorageFormat, if a matching file extension could be found,
* null otherwise
*/
public StorageFormat findStorageFormat(File file) {
StorageFormat currentStorageFormat;
for (int i = 0; i < myStorageFormats.size(); i++) {
currentStorageFormat = (StorageFormat) myStorageFormats.get(i);
if (currentStorageFormat.getFileFilter().accept(file)) {
return currentStorageFormat;
}
}
return null;
}
Solution: