Skip to content

Instantly share code, notes, and snippets.

@mickeypash
Last active August 29, 2015 14:16
Show Gist options
  • Save mickeypash/94891874634cab7e22b0 to your computer and use it in GitHub Desktop.
Save mickeypash/94891874634cab7e22b0 to your computer and use it in GitHub Desktop.
suggested way of calculating the number of files
Lab exam for calculating the number of files and folders in a file system
http://sourcemaking.com/design_patterns/Composite/java/1
interface FileComponent
+ calculateTotal();
FileComposite
+ calculateTotal()
for item in composite
total += leaf.calculateTotal();
FileLeaf
+ calculateTotal()
return 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment